본문으로 건너뛰기

Language Identifiers

In Visual Studio Code, each language mode has a unique specific language identifier. That identifier is rarely seen by the user except in the settings, for example, when associating file extensions to a language:

    "files.associations": {
"*.myphp": "php"
}

Note that casing matters for exact identifier matching ('Markdown' != 'markdown')

The language identifier becomes essential for VS Code extension developers when adding new language capabilities or when replacing a language support.

Every language defines its id through the languages configuration point in the extension's package.json file:

    "languages": [{
"id": "java",
"extensions": [ ".java", ".jav" ],
"aliases": [ "Java", "java" ]
}]

Language supports are added using the language identifier:

    "grammars": [{
"language": "groovy",
"scopeName": "source.groovy",
"path": "./syntaxes/Groovy.tmLanguage.json"
}],
"snippets": [{
"language": "groovy",
"path": "./snippets/groovy.json"
}]
languages.registerCompletionItemProvider('php', new PHPCompletionItemProvider(), '.', '$')

New identifier guidelines

When defining a new language identifier, use the following guidelines:

  • Use the lowercased programming language name.
  • Search for other extensions in the Marketplace to find out if a language identifier has already been used.

Known language identifiers

The following table lists known language identifiers:

LanguageIdentifier
ABAPabap
Windows Batbat
BibTeXbibtex
Clojureclojure
Coffeescriptcoffeescript
Cc
C++cpp
C#csharp
Composedockercompose
CSScss
CUDA C++cuda-cpp
Dd
Dartdart
Delphipascal
Diffdiff
Dockerfiledockerfile
Erlangerlang
F#fsharp
Gitgit-commit and git-rebase
Gogo
Groovygroovy
Handlebarshandlebars
Hamlhaml
Haskellhaskell
HTMLhtml
Iniini
Javajava
JavaScriptjavascript
JavaScript JSXjavascriptreact
JSONjson
JSON with Commentsjsonc
Juliajulia
LaTeXlatex
Lessless
Lualua
Makefilemakefile
Markdownmarkdown
Objective-Cobjective-c
Objective-C++objective-cpp
OCamlocaml
Pascalpascal
Perlperl and perl6
PHPphp
Plain Textplaintext
PowerShellpowershell
Pugjade, pug
Pythonpython
Rr
Razor (cshtml)razor
Rubyruby
Rustrust
SCSSscss (syntax using curly brackets), sass (indented syntax)
ShaderLabshaderlab
Shell Script (Bash)shellscript
Slimslim
SQLsql
Stylusstylus
Sveltesvelte
Swiftswift
TypeScripttypescript
TypeScript JSXtypescriptreact
TeXtex
Visual Basicvb
Vuevue
Vue HTMLvue-html
XMLxml
XSLxsl
YAMLyaml