Add RedCMD TextMate diagnostics guard#13
Merged
Conversation
johnsoncodehk
added a commit
that referenced
this pull request
Jun 6, 2026
PR #13 rewrote variable-length look-behinds to satisfy the RedCMD/Onigmo diagnostics, which verify that patterns COMPILE under Onigmo but not that they still mean the same thing. Two regressions compiled clean and slipped through (the scope-gap corpus contains neither case): 1. regex-literal-prefix-ops emitted `s*` instead of `\s*`: a lone `\s` in a gen-tm template literal collapses to `s` (`"\s" === "s"`), so a regex after a prefix `!` lost its highlighting whenever whitespace preceded the `!` (`= !/re/`, `return !/re/`, `&& !/re/`, `! /re/`) in all four JS/TS grammars. Doubled the backslashes. 2. arrow-function-params-generic's look-behind was degraded to `(?<=>)`, so a multi-line generic call `foo<Bar>(` or comparison `a > (` was wrongly scoped meta.parameters.arrow. A fixed-width look-behind cannot tell a generic ARROW's `>` from a generic CALL's `>` (the deciding `<` at expression-start sits a variable distance back, which Onigmo rejects in look-behind). Replaced it with a nameless wrapper (generic-arrow-function) that reuses arrow-type-parameters' exact disambiguation and owns both the `<...>` and `(...)` as children, so the param list needs no look-behind -- correct and Onigmo-clean. Removed the now-dead close/typeParamCloseBehind disambig fields. Added test/tm-highlight-guards.ts (wired into CI) asserting both behaviours via vscode-oniguruma tokenization, since neither the Onigmo guard nor the scope-gap corpus can catch a semantic break here. tsx scope-gap 95.545 -> 95.607; ts/js/jsx unchanged; RedCMD 10/10 clean.
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.
Summary
npm run test:tm-diagnosticsto guard generated top-level.tmLanguage.jsonfiles against RedCMD-styleTextMate(include),TextMate(dead), andTextMate(Onigmo)issuesvscode-onigmodev dependency so the diagnostics guard can compile TextMate 2.0 / Onigmo regexes in CI#type-innerfor grammars without a real type annotation layer, removing dead JS/JSX/YAML repository entriesValidation
npm run test:tm-diagnosticsnpm testnpm run scope-gap:yamlgit diff --check