How Language Support Works
VS Code’s language support is built on several key components:Syntax Highlighting
TextMate grammars provide tokenization and syntax coloring for source code. Each language extension includes a
.tmLanguage.json file that defines the grammar rules.Language Configuration
Language configuration files define comment styles, bracket pairs, auto-closing behavior, and indentation rules specific to each language.
Language Features
Advanced features like IntelliSense, code navigation, and refactoring are powered by language servers following the Language Server Protocol (LSP).
Built-in Language Support
VS Code ships with built-in support for the following languages in theextensions/ directory:
Programming Languages
JavaScript & TypeScript
Full-featured support including IntelliSense, debugging, refactoring, and task running. Powered by the TypeScript language service.
Python
Syntax highlighting with MagicPython grammar. Enhanced features available through the Python extension.
Markdown
Preview, validation, IntelliSense for links and headers, and integrated notebook rendering.
Additional Built-in Languages
VS Code includes syntax support for:- Web: HTML, CSS, SCSS, LESS, JSON, XML
- Systems: C/C++, C#, Java, Go, Rust
- Scripting: Python, Ruby, Perl, Lua, Shell Script, PowerShell, Batch
- JVM: Java, Groovy, Scala
- .NET: C#, F#, VB
- Functional: Clojure, F#
- Data: SQL, YAML, TOML, INI
- Markup: Markdown, LaTeX, reStructuredText
- Other: Dockerfile, Makefile, R, Julia, Swift, Dart
Language Configuration Structure
Every language extension defines its capabilities through apackage.json contribution:
The
language-configuration.json file defines language-specific editor behavior like comment styles, bracket matching, and auto-indentation rules.Language Features API
Language extensions can provide intelligent features through VS Code’s provider API:| Feature | Provider | Purpose |
|---|---|---|
| IntelliSense | CompletionItemProvider | Code completion suggestions |
| Diagnostics | DiagnosticCollection | Error and warning reporting |
| Hover | HoverProvider | Type information on hover |
| Signature Help | SignatureHelpProvider | Parameter hints |
| Go to Definition | DefinitionProvider | Navigate to symbol definitions |
| Find References | ReferenceProvider | Find all symbol references |
| Rename | RenameProvider | Intelligent symbol renaming |
| Formatting | DocumentFormattingEditProvider | Code formatting |
| Code Actions | CodeActionProvider | Quick fixes and refactorings |
Language Server Protocol
Many advanced language features are implemented using the Language Server Protocol (LSP), which separates language analysis from the editor:Extension Categories
Language extensions in VS Code fall into several categories:Basic Language Support
Provides syntax highlighting and basic editor features through grammar and configuration files. Examples: Batch, Dockerfile, INI.Language Features Extensions
Add intelligent features like IntelliSense and diagnostics. Examples:typescript-language-features- JavaScript/TypeScript supportmarkdown-language-features- Markdown preview and validationhtml-language-features- HTML IntelliSensejson-language-features- JSON schema validation
Debugger Extensions
Provide debugging capabilities through the Debug Adapter Protocol. Built-in examples:debug-auto-launch- Auto-attach Node.js debuggingdebug-server-ready- Open browser when server is ready
Semantic Tokens
Modern language extensions can provide semantic highlighting that goes beyond syntax-based coloring:Creating Language Support
To add support for a new language:Create Language Extension
Use
yo code to scaffold a new language extension with grammar and configuration files.Configure Language Behavior
Set up
language-configuration.json with brackets, comments, and auto-closing rules.Configuration Defaults
Language extensions can set default editor configurations for their language:Next Steps
Explore detailed documentation for specific languages:All built-in language extensions are open source and available in the VS Code repository under
extensions/.