VS Code’s secret snippets
Did you know that VS Code has built-in snippets for lots of languages?
They are not documented in the VS Code docs.
There is no way to browse them inside VS Code.
Soo, how can I find them?
It’s awkward to track them down yourself!
This spurred me to write an extension called Snippets Ranger to give a nice UI to explore all your snippets easily.
Also, remember that Snippets can be defined in a few different places. They can be added by:
- Creating a global snippets file, a workspace snippets file, or a language-specific file;
- Installing extensions found in the “Snippets” category in the Visual Studio Marketplace;
- Installing some of the Programming Language extensions, which often have hidden snippets cargo e.g. Python;
- the VS Code team to the built-in language extensions.
Keeping track of them yourself is not practical.
How do I find the built-in snippets myself?
If you want to track down the source files yourself, they live inside each individual language extension directory.
- The file for each language is located at
«app root»\resources\app\extensions\«language»\snippets\«language».code-snippets
on Windows. - The exact location varies on Linux depending on how you installed VS Code, the snippets files end up in one of the share directories. For example, if you installed VS Code as a snap, it may be located at
./snap/code/66/usr/share/code/resources/app/extensions/«language»/snippets/«language».code-snippets
.
Find this helpful?
I would appreciate if you add a favourable review in the marketplace or star the github repo.
If encounter an issue or have a feature request, you are welcome to make an issue on github.