This is a lexer and syntax highlighting for TextMate grammars. The grammars
may be regitered using the system layer.
register-grammar
Use Cases
Register grammar
To register a new TextMate grammar, add it as a file into the system filesystem,
under "Editors/<mime-type>/", and make sure it has an attribute "textmate-grammar"
whose value is a string representing the TextMate top-level scope. For example:
<folder name="Editors">
<folder name="text">
<folder name="x-kotlin">
<file name="Kotlin.tmLanguage.json" url="Kotlin.tmLanguage.json">
<attr name="textmate-grammar" stringvalue="source.kotlin" />
</file>
</folder>
</folder>
</folder>
Register grammar using Java API
To register a new TextMate grammar using Java API, add the GrammarRegistration
annotation to an appropriate package-info file, or an appropriate Java class.
For example:
@GrammarRegistration(mimeType="text/x-kotlin", grammar="path/to/Kotlin.tmLanguage.json")
Register injection grammar
Injection grammars let existing grammars to be extended. An injection grammar is
a regular TextMate grammar that is injected into a specific scope within
an existing grammar. To register a new injection grammar, add it as a file
into the system filesystem under "Editors/", and make sure it has attributes
"textmate-grammar" whose value is a string representing the TextMate top-level
scope and "inject-to" whose value is a string representing comma separated
list of scopes that the grammar is injected to. For example, registration
of the injection grammar highlighting TODO keywords in JavaScript and TypeScript
comments:
<folder name="Editors">
<file name="todo-comment-injection.json" url="todo-comment-injection.json">
<attr name="textmate-grammar" stringvalue="todo-comment.injection" />
<attr name="inject-to" stringvalue="source.js,source.ts" />
</file>
</folder>
Register injection grammar using Java API
To register a new injection grammar using Java API, add the GrammarInjectionRegistration
annotation to an appropriate package-info file, or an appropriate Java class.
For example:
@GrammarInjectionRegistration(grammar="path/to/todo-comment-injection.json", injectTo = {"source.js","source.ts"})
Exported Interfaces
This table lists all of the module exported APIs
with
defined stability classifications. It is generated
based on answers to questions about the architecture
of the module.
Read them all...
Group of layer interfaces
Interface Name | In/Out | Stability | Specified in What Document? |
register-grammar | Exported | Under Development | |
|
Group of java interfaces
Interface Name | In/Out | Stability | Specified in What Document? |
TextMateGrammars | Exported | Stable |
This project to allows to easily add syntax highlighting for languages by
using the TextMate grammar files.
|
|
Implementation Details
Where are the sources for the module?
The sources for the module are in the
Apache Git repositories
or in the GitHub repositories.
What do other modules need to do to declare a dependency on this one, in addition to or instead of a plain module dependency?
Nothing.
Read more about the implementation in the answers to
architecture questions.