This site provides a machine-readable index at /llms.txt.

Skip to main content Skip to navigation

TextMateLanguageRegistry Pennington.Highlighting

Registry for managing TextMate language grammars and scope mappings. Allows registration of custom languages in addition to built-in ones.

Constructors

.ctor

#
public TextMateLanguageRegistry(Action<TextMateLanguageRegistry>? configure = null);

Initializes a new instance of the TextMateLanguageRegistry class.

Parameters

configure Action<TextMateLanguageRegistry>? (optional)
Optional callback to configure custom languages.

Methods

AddGrammar

#
public TextMateLanguageRegistry AddGrammar(string languageId, string scopeName);

Adds a custom language-to-scope mapping.

Parameters

languageId string
The language identifier (e.g., "mylang").
scopeName string
The TextMate scope name (e.g., "source.mylang").

Returns

TextMateLanguageRegistry
This instance for method chaining.

AddGrammarFromJson

#
public TextMateLanguageRegistry AddGrammarFromJson(string languageId, string grammarJson);

Loads a grammar from a JSON string and associates it with a language identifier.

Parameters

languageId string
The language identifier (e.g., "mylang").
grammarJson string
The TextMate grammar in JSON format.

Returns

TextMateLanguageRegistry
This instance for method chaining.

Pennington.Highlighting.TextMateLanguageRegistry

namespace Pennington.Highlighting;

/// Registry for managing TextMate language grammars and scope mappings. Allows registration of custom languages in addition to built-in ones.
public class TextMateLanguageRegistry
{
    /// Initializes a new instance of the TextMateLanguageRegistry class.
    
public TextMateLanguageRegistry(Action<TextMateLanguageRegistry>? configure = null);
/// Adds a custom language-to-scope mapping.
public TextMateLanguageRegistry AddGrammar(string languageId, string scopeName);
/// Loads a grammar from a JSON string and associates it with a language identifier.
public TextMateLanguageRegistry AddGrammarFromJson(string languageId, string grammarJson);
}