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(), '.', '$')