VSCodium logo made up of a white circle with a blue tree of branches with no leaves in the center.

Improve Your Development Productivity with Snippets

  • Adam Douglas

I’ve found that over the years of writing code or just entering notes down that we often produce text that can be partially reproduced. Often I would create reference files for code snippets or formatted text that I could go and grab to reuse when needed. I’m sure most of us would agree that this is not effective and accessible as having access to the snippets right within the editor. When using VSCodium a free open source software fork of VSCode, there is a built-in system that can help manage snippets and take them to a whole new level with tabstops, placeholders, choices (value picker), and variables. Join me in exploring this wonderful feature.

What are Snippets?

Re-usable text pattern or source code that aids in avoiding repetitive typing and recreating the text that has already been done in the past. Typically, snippets are used in programming or specifically formatted text.

There are two types of code snippets, built-in and user-defined. Built-in snippets are provided by the editor itself or from installing extensions. The user-defined snippets are created by you the user. All snippets are written in JSON (JavaScript Object Notation) and have support for C-style comments. Such use cases can be Jekyll code blocks, loops, or Jekyll admonitions.

Snippet Properties

Each code snippet is defined with the following properties.

name (required)
Snippet name that is displayed at the time of code completion if no description is defined.
scope (optional)
Defines the context in which the code snippet is available by using one or more language identifiers. This helps code completion list only relevant suggestions. If scope property is omitted, then the snippet will be available in all languages.
prefix (required)
One or more trigger words that will cause the snippet to be listed as an option at the time of code completion.
body (required)
One or more lines of content that will be added to the desired location from which it was called. Newlines, tabs, etc. will be formatted based upon the context in which the snippet is inserted.
description (optional)
A descriptive text of the code snippet that will be displayed at the time of code completion.
isFileTemplate (optional)
To control whether the code snippet can be used to populate or replace a file’s contents when running “Snippets: Populate File from Snippet” via the Command Palette for a new or existing file. The property has a value of either true or false.

Using Snippets

Accessing the list of user-defined, and built-in snippets can be done using one of the below methods.

Code Completion (IntelliSense)
Type the snippet keyword (prefix) followed by pressing, CTRL+Spacebar and then select a snippet by pressing enter.
Command Palette
Use command “Snippets: Insert Snippet” or “Snippets: Populate File from Snippet” by pressing CTRL+Shift+P and then select a snippet by pressing enter.
Tab Completion
This method is supported, but must be enabled within the settings (CTRL+,) under User > Text Editors ("editor.tabCompletion": "on"). Then simply type the snippet keyword (prefix), and press the tab key and then select a snippet by pressing enter.

Creating Snippets

Use the following steps to create either a language, project or global scope snippet.

  1. Open the Command Palette, press CTRL+Shift+P.
  2. Run the command “Snippets: Configure User Snippets”.
  3. Selected the desired option under “New Snippets”.
    • Options displayed as a language will only be applied to a specific language
    • Options displayed as “New Snippets file for” will only be applied to a specific project
    • Options displayed as “New Global Snippets file” will be applied to all languages


Snippets are stored with the file extension of "json" or "code-snippets" (global/projects).

Editing Snippets

  1. Open the Command Palette, press CTRL+Shift+P.
  2. Run the command “Snippets: Configure User Snippets”.
  3. Selected the desired snippet to modify.

Removing Snippets


This process is permanent and cannot be undone.

  1. Open the Explorer Workspace (CTRL+Shift+E).
  2. Browse and select the desired code snippet by left mouse clicking on the file.
  3. Press the del key or right mouse click on the file and left click on “Delete”.

Deleting a snippet can be done manually by browsing to one of the following applicable directories using a file manager or terminal to remove the desired file.

  • /home/{username-here}/.config/VSCodium/User/snippets
  • .vscode (located within each project folder)
  • C:\Users\{username-here}\AppData\Roaming\VSCodium\User\snippets

Example Snippets

This example illustrations language specific snippets for YAML (yaml.json). Multiple snippets are stored together. The first snippet is a changelog that is stored within the Jekyll front matter for a post. This snippet is triggered by the keyword (prefix) “adlog” (Adamsdesk post changelog). The second example is another Jekyll front matter for a wallpaper post that is triggered by adwal (Adamsdesk wallpaper item).

The variable $CURRENT_YEAR will be replaced with the current four digit year, $CURRENT_MONTH two-digit month and $CURRENT_DATE two digit day of the month. The numbered variables control the order of cursor placement after being inserted. Enter the desired value at each cursor positing and jump to the next position by pressing the tab key. The last cursor position is defined by the variable $0. The \t represents a tab character.

//This is comment for the snippets stored in the yaml.json file.
    "Adamsdesk Changelog": {
        "prefix": "adlog",
        "body": [
                "\t-   date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE",
                        "\t\t\t- $0"
        "description": "Adamsdesk YAML frontmatter changelog."
    "Adamsdesk Wallpaper Item": {
        "prefix": "adwal",
        "body": [
            "\t-   caption: $1",
            "\t\tlink: $2",
            "\t\tsource: $3",
            "\t\timage: $4",
            "\t\talt: $5",
        "description": "Adamsdesk YAML wallpapers array item."

Dive Deeper

For further details on snippet scope, special constructs, remove built-in snippets from IntelliSense, and more refer to the knowledge base article.