visual-studio-codevscode-snippets

Use Snippets in launch.json in VS Code


I have a few dev systems that I constantly connect to. I work on many different and new projects. I reset the systems so that connection details do not change.

Right now, every time I create a new project, I have to copy the launch.json from elsewhere, either using a text copy or file copy, depending on what I need. This got pretty tiring, so I thought I would create snippets for the various launch configs. Created my json snippets, tried them, but when using insert snippet within a launch.json, it says no snippets found. That was the answer here, but I can't get it to work.

If I try to insert the snippet in a different json file, it works immediately.

Is there something special I need to do so that I can insert snippets into the launch.json? I can't seem to find any information on that. I tried to look for a way to customize the config options, but outside of writing an extension to insert them, I could not figure it out.


Solution

  • the languageId of tasks.json, settings.json and launch.json is JSON with Comments

    The short id is jsonc, so save your snippets in the jsonc.json file

    If your active file is launch.json and you select LowerLeft-Gear | User Snippets you see a list with a jsonc.json suggestion.