Skip to main content
The LanguageRegistry service manages tree-sitter-based language definitions for syntax highlighting and parsing. Each registry is scoped to a specific language.

Accessing the LanguageRegistry

Registering a language

Register a new tree-sitter language definition:

LanguageDescriptor

LanguageGrammarProvider

A fun interface that provides the tree-sitter grammar:

LanguageThemeProvider

An optional fun interface for syntax highlighting theme support:

QueryProvider

Provides tree-sitter queries for the language:

LanguageRegistration

LanguageRegistry methods

CaptureStyle

Generated highlight spans use CaptureStyle to define how tree-sitter nodes are styled:

ColorKey values

Predefined CaptureStyle constants

CaptureStyle provides convenient constants for common styles:

Unregistering

Listing registered languages

Example

Register a language registry for a custom file extension: