From the course: Learning Visual Studio Code

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Creating custom code snippets

Creating custom code snippets

You've already seen how helpful VS Code's built-in code Snippets can be. You can get the same benefits with any code by creating your own Snippets. This can be a great way to speed up the writing of code that is specific to your company, project, or just patterns you personally use a lot. You can create your own Snippets by opening the command palette and searching for Snippet. Select "Configure User Snippets." That brings up another list where you specify which Snippets file to use. Most Snippets are going to be language-specific and stored in a file with other Snippets for that language. That's how VS Code determines which Snippets to show you while you're typing code. If you're working in a JavaScript file, for instance, it doesn't make much sense to show you Snippets for Python. If you did want a particular Snippet available everywhere, you could choose the option to create a new global Snippets file. I'm working in a JavaScript file right now, so I'm going to choose the…

Contents