iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
textmate-go is documented as a pure-Go port of Microsoft’s vscode-textmate, built to tokenize source code with TextMate grammars while carrying parsing state from line to line. But the available project documentation does not verify the story implied by this title: it does not identify a TSX bug report or establish that the report led to the engine. The project’s technical goals are documented; its origin story remains unconfirmed.
What a TextMate engine does
A TextMate grammar describes patterns that identify parts of source text—such as keywords, comments, and strings—and assigns scopes to those regions. Editors can use those scopes for syntax styling and related context-sensitive behavior. The TextMate manual describes grammars in these terms.
This is lexical tokenization, not full language understanding. A grammar engine assigns scopes according to its rules; it is not, by itself, a compiler or language server that resolves types, checks program meaning, or reports every semantic error.
What textmate-go documents
The package describes itself as a pure-Go port of Microsoft’s vscode-textmate. It tokenizes source one line at a time and carries an immutable state stack between lines. That carried state matters when a construct spans multiple lines: later tokenization can depend on whether an earlier line opened a string, comment, or other grammar context.
#1 Best Overall
The package documentation also describes an editable-document abstraction that keeps token and state caches. When an edit is made, the engine can reuse state after the changed region once the new state converges with an unchanged tail. This is an implementation detail reported by the project, not an independent evaluation of its incremental-edit behavior.
According to its current documentation, the API is under active development, the package targets Go 1.25 or newer, and it builds with CGO_ENABLED=0. These requirements and status can change, so check the project’s package documentation before adopting it.
Why Go’s standard regular expressions are not enough
TextMate grammars can rely on regular-expression features such as lookbehind, backreferences, and position-sensitive anchors. Go’s standard regexp package uses RE2-style regular expressions and does not support all of those constructs. A grammar engine that aims to handle TextMate patterns therefore has to address a compatibility gap.
The project says it uses regexp2 with RE2 compatibility mode disabled, translates some Oniguruma-specific syntax before compiling patterns, and reports unsupported constructs as diagnostics. This is its documented strategy; it is not evidence that every Oniguruma grammar will work unchanged. The package’s documentation is the place to check current implementation details and limitations.
Rank #3
What the published benchmarks show—and do not show
The project documentation publishes benchmark results for several language cases. The table below reproduces the figures reported for four cases. “Throughput units” are left as reported because the excerpted table does not clearly establish their units or the complete test conditions.
| Language case | textmate-go throughput | textmate-go allocations per line | vscode-textmate throughput | Chroma throughput | Project-reported ratio vs. vscode-textmate |
|---|---|---|---|---|---|
| TSX | 33.7 | 42.6 | 19.6 | 17.0 | 1.71× |
| HTML | 24.5 | 62.4 | 25.3 | 5.2 | 0.97× |
| Go | 9.1 | 31.3 | 13.6 | 19.6 | 0.67× |
| Markdown | 15.3 | 29.3 | 13.6 | 18.6 | 1.13× |
These are project-reported results, not independent measurements. The surfaced benchmark material does not fully specify units, hardware, or test conditions, so the figures do not establish that textmate-go is generally faster. Treat them as results for the project’s reported benchmark cases, and consult its documentation for the available methodology before using them to choose an engine.
Did a TSX bug report start the project?
That connection is not established by the available primary-source material. The project documentation includes a TSX benchmark case, but a benchmark alone cannot show that a particular TSX bug report prompted the project or shaped its design. No original issue, commit sequence, release note, or first-person account linking such a report to the engine is identified here.
Recommended Free Tools
As a result, the defensible account is narrower: textmate-go documents a Go implementation of a TextMate tokenization engine, with line-state handling and a regex-compatibility approach intended for grammars that use features beyond Go’s standard regular expressions. The claimed causal origin in a TSX bug report remains unverified.
Best Value
How it fits among Go implementations
A separate project, github.com/friedelschoen/go-textmate, documents loading .tmLanguage.json grammars, compiling rules, and emitting scoped tokens; its documentation names Oniguruma as a requirement. That makes it a relevant alternative to investigate, but the available descriptions do not provide enough evidence for a full feature, compatibility, or performance comparison with textmate-go.
For an implementation decision, compare the grammar support you need, regex handling, line-state and edit behavior, external dependencies, Go-version requirements, API stability, and benchmark methodology. The project pages establish some of those details, not a definitive ranking.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

