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
configureAction<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
languageIdstring- The language identifier (e.g., "mylang").
scopeNamestring- The TextMate scope name (e.g., "source.mylang").
Returns
TextMateLanguageRegistryThis 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
languageIdstring- The language identifier (e.g., "mylang").
grammarJsonstring- The TextMate grammar in JSON format.
Returns
TextMateLanguageRegistryThis 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);
}