Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>snippets by extensionNew to Visual Studio Code? Get it now.
snippets by extension

snippets by extension

tim760255458

|
14 installs
| (0) | Free
A single instruction inserts code snippets in multiple places, based on file extension matching
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

snippets by extension

A single instruction inserts code snippets in multiple places, based on file extension matching

Features

When you enter a directive, you can insert the template in multiple places in the file according to the configured rules

test

Extension Settings

This extension contributes the following settings:

  • snippets-by-extension.maxInputLength: The maximum length of the instruction (default 6).
  • snippets-by-extension.configJsonUrl: Required, folder address of the configuration file. should be added \ to the end of the address, for example: D:\CODE\snippets-config\

Configuration description

Note: Formatting issues when regular expressions are written as strings

Note: When adding rules to different file extensions, you need to create a JOSN file and name it with the file extension

// The plugin matches the rules based on the name of the profile
// Like the vue.json file below, the plugin will use the rules when editing the .vue file

// vue.json
{
  "tmp-cp": {
    "default": [
      "<div id=\"test\"></div>"
    ],
    "rules": [
      ["\\s+computed:\\s*{", [
        "value2() {",
        "  return 2;",
        "},"
      ]],
      ["\\s+watch:\\s*{", [
        "text: 2"
      ]]
    ]
  }
}

Enjoy!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft