Repository navigation
fix(textmate): read indentation patterns as JavaScript - #57
Merged
Merged
Conversation
TextMate's line indent provider compiles language-configuration
patterns with java.util.regex. Go's increaseIndentPattern has a bare
"{", which JavaScript reads as a literal and Java rejects, so every
Enter in a .go file logged a SEVERE and the new line wasn't indented.
Take over line indentation for TextMate files. The rules stay the
platform's, but each pattern is rewritten into the Java regex that
reads the same and searched for in the line, as VS Code's RegExp.test
does. The gap is recorded in docs/platform-limitations.md.
Refs #56
CodeStyleSettings.getIndentOptionsByFile is internal, which failed verifyPlugin.
BartvHelvert
force-pushed
the
fix/textmate-indent-regex
branch
from
November 4, 2026 23:24
3dcb501 to
bbf7a02
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
The bundled TextMate plugin's
TextMateLineIndentProvidercompiles a language configuration'sindentationRulesandonEnterRuleswithjava.util.regex. VS Code compiles them as JavaScript regexes. Go'sincreaseIndentPatternhas a bare{, which JavaScript reads as a literal and Java rejects with "Illegal repetition". Every Enter in a.gofile logged a SEVERE error, and the new line wasn't indented.CodeBridgeTextMateLineIndentis now registered as the firstlineIndentProviderand takes over line indentation for TextMate files. It applies the same rules as the platform's, with two differences:JavaScriptRegex, which rewrites the JavaScript-only syntax that turns up in patterns into the Java equivalent: a literal{,[and&&inside a class,[],[^],\v, a lone\0, and identity escapes like\y.RegExp.testdoes, instead of the pattern being matched against the whole line.A pattern that still doesn't compile is logged once as a warning and ignored. The platform gap is recorded in
docs/platform-limitations.mdas a request to fix it in TextMate.Fixes #56
How it was tested
JavaScriptRegexTest(new, 5 tests) covers Go's realincreaseIndentPattern, quantifiers versus literal braces, class contents, empty classes, and escapes.increaseIndentPatternnow has a bare{, as Go's does.CodeBridgeTextMateEnterBetweenBracesTestregisters the new provider and checks that Enter afterif ready {indents the next line and Enter after a plain line doesn't.:textmate.backend:testpassed (10 tests).Checklist
A new feature has a UI test.Bug fix, not a feature.docs/is updated where behaviour changed,docs/status.mdespecially.Third-party material keeps its notice and is listed inNone added.NOTICE.md.