Contextual Snippets Extension for VS Code
DemoBackgroundCode snippets are a great way to improve coding speed. A problem that I found on VS Code is that the user have limited control, related to the criteria of display the snippets suggestions. The only filter you can do is by language. This limitation can result in lots of noise, when we are dealing with many snippets, because the editor will provide snippet suggestions that are not applicable to the current context. For example, for YAML files, if I am editing a "GitHub Action" workflow, I don´t want to see snippet suggestions for other YAML files. Even in the scope of a particular language, if am working on a Javascript application, but I am not using Jest for testing, Jest suggestions would be not useful. This extension aims to help with these problems, by allowing you to define some more conditions for your snippets. InstallTo install the extension, open the command pallete and type: FeaturesThis extension works by extending the default VS Code snnippets format with a extra The following options are available:
UsageBy default, this extension will look for snippets on the VSCode User Folder. Depending on your platform, it is located at:
You can override this location, by setting the Then you need to create your snippets json files in that location. You can organize everything on a single file or create multiple files. It's really up to you and this extension doesn´t care. The snippet format is similar to the VS Code format, but with the extra For Example, to create Jest snippets, only for test files and with the Jest package installed, you could define your script as follows:
A more advanced example, using You can write your
Very basic regex, it will match all files starting with You can create your JSON files by hand (Snippet Creator is very useful to format the snippet correctly), or you can use the This extension also supports project level snippets, by looking into ContributingContributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
💛 Support the projectIf this project was useful to you in some form, I would be glad to have your support. It will help to keep the project alive and to have more time to work on Open Source. The sinplest form of support is to give a ⭐️ to this repo. You can also contribute with GitHub Sponsors. Or if you prefer a one time donation to the project, you can simple: Author👤 Bruno Paz
License |