Vs code snippets

Příklady kódu

3
0

vytvořte si vlastní snippet vscode

/*To create or edit your own snippets, select User Snippets 
under File > Preferences > User Snippets (Code > Preferences on macOS), 
and then select the language for which the snippets should appear*/

// Snippets are written in JSON Example:
{
	"Your Snippet Name": {
      "prefix": "ysn",
      "body": [
          "//Here you type all the code that should appear",
          "//Separating each line",
          "//Remember to add tabs with \t"
      ]
    }
}
0
0

vs code snippets

// in file 'Code/User/snippets/javascript.json' for only JS files
{
  "For Loop": {
    "prefix": ["for", "for-const"],
    "body": ["for (const ${2:element} of ${1:array}) {", "\t$0", "}"],
    "description": "A for loop."
  }
}

// in file 'Code/User/snippets/fileName.code-snippets' for Global Snippets
{
  "For Loop": {
    "scope": "javascript,typescript,php,html",
    "prefix": ["for", "for-const"],
    "body": ["for (const ${2:element} of ${1:array}) {", "\t$0", "}"],
    "description": "A for loop."
  }
}

Související stránky

Související stránky s příklady

V jiných jazycích

Tato stránka je v jiných jazycích

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................