Skip to content

Add RedCMD TextMate diagnostics guard#13

Merged
johnsoncodehk merged 3 commits into
masterfrom
test/redcmd-textmate-diagnostics
Jun 6, 2026
Merged

Add RedCMD TextMate diagnostics guard#13
johnsoncodehk merged 3 commits into
masterfrom
test/redcmd-textmate-diagnostics

Conversation

@johnsoncodehk
Copy link
Copy Markdown
Owner

@johnsoncodehk johnsoncodehk commented Jun 6, 2026

Summary

  • add RedCMD/TmLanguage-Syntax-Highlighter as a git submodule for TextMate diagnostic reference
  • extend npm run test:tm-diagnostics to guard generated top-level .tmLanguage.json files against RedCMD-style TextMate(include), TextMate(dead), and TextMate(Onigmo) issues
  • add root vscode-onigmo dev dependency so the diagnostics guard can compile TextMate 2.0 / Onigmo regexes in CI
  • stop emitting #type-inner for grammars without a real type annotation layer, removing dead JS/JSX/YAML repository entries
  • make generated JS/JSX/TS/TSX/YAML TextMate regexes compatible with TextMate 2.0 by avoiding variable-length lookbehind patterns that Onigmo rejects

Validation

  • npm run test:tm-diagnostics
  • npm test
  • npm run scope-gap:yaml
  • git diff --check

@johnsoncodehk johnsoncodehk merged commit 4a26317 into master Jun 6, 2026
2 checks passed
@johnsoncodehk johnsoncodehk deleted the test/redcmd-textmate-diagnostics branch June 6, 2026 15:29
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant