Global vs Local Snippets
VS Code has two kinds of snippet files: <language>.json
and <filename>.code-snippets
.
File Creation Commands
SnippetStudio can create these files using the three-dot menu of the Locations Manager sidebar view, or by using the command pallete.
Create Global Language Snippets File
- Command:
snippetstudio.file.createGlobalLang
- Creates a snippet file matching the language of the currently open editor.
Create Global Mixed Snippets File
- Command:
snippetstudio.file.createGlobalSnippets
- Creates a mixed-language global .code-snippets snippets.
Create Local Project Snippets File
- Command:
snippetstudio.file.createProjectSnippets
- Creates a project-level .code-snippets snippets.
Folder Location
Global Snippets exist deep in the VS Code configuration of your computer
Operating System | Snippets Folder Location |
---|---|
Linux | ~/.config/Code/User/snippets |
macOS | ~/Library/Application Support/Code/User/snippets |
Windows | C:\Users\username\AppData\Roaming\Code\User\snippets |
Operating systems listed in the order of how cool they are.
Local Snippets exist in the .vscode
folder of any directory.
Globals are expandable system-wide and locals are expandable only while coding in the directory they were created in.
Filetype Differences
Global or Local .code-snippets snippets can be scoped to multiple languages. If the scope
property is left blank, it is visible to any language.
See a list of recognized languages to use in the scope field.