How to create custom snippets in vs code

 vs code snippets

First of all, Create a new .vscode folder inside the current root directory like below image.

afterward create a new snippets file with .code-snippets extension like below image



File Structure:-

{
  "my": {
    "scope": "",//name of extension like javascript,css,html if you want to run all file then you can skip empty like this
    "prefix": "mymsg",//This is prefix name which you want to type
    "body": [ // This is your code which you want to call anywhere
      "This is my msg"
    ],
    "description": "custom msg" //This is description of your snippets
  },

 
}

Create Globaly snippets
inside the C:\Users\PC\AppData\Roaming\Code\User\snippets



Comments