Skip to content

Commit 70c1a3d

Browse files
committed
gen-tm: extend the repo-key naming CONSTRAINT to the ECMAScript family
Applies the `canonicalRepoNames` 限制器 (already done for source.ts) to javascript / javascriptreact / typescriptreact, so each emits the OFFICIAL VS Code repository KEY NAMES natively for every construct Monogram genuinely has — the same drop-in property source.ts gained, now across the family. Structure mirrors the rule-sharing (javascript.ts owns the ECMAScript vocab, so it owns the shared canonical names): - javascript.ts: NEW exported `jsBaseCanonical` — the shared half. 1:1 renames (type←type-inner, qstring-double/single←string-double/single, punctuation- comma/-semicolon/-accessor←scope-punctuation-*, regex←regex-literal, new-expr←new-expression, parameter-name←declaration-param-name, directives←tripleslash, this-/super-literal←scope-variable-language-this/super) + union wrappers (comment, string, boolean-literal, numeric-literal). - typescript.ts: imports + spreads `jsBaseCanonical`, keeps ONLY the TS-only type layer (type-parameters, type-alias-declaration, type-object, cast, parameter-type-annotation, type-predicate-operator, return-type). The inline 14-entry map is gone — no duplication. Side benefit: TS picks up 7 shared keys it never mapped (punctuation-semicolon/-accessor, this-/super-literal, string, boolean-/numeric-literal), 34→41. - javascriptreact.ts: `withJsx` already spreads `...base`, so both .jsx and .tsx inherit their base map; merge a JSX delta `{ ...base.canonicalRepoNames, ...JSX_CANONICAL }` with the one genuine JSX 1:1 (jsx-entities←jsx-entity). typescriptreact.ts unchanged (pure inheritance). Stays agnostic: the names are DATA in the grammar defs (which may know their language, like the scopes map); gen-tm only looks up + substitutes (agnostic 8/8). RENAME-only ⇒ tokenization byte-identical — direct old-vs-new scope-array diff over a rich corpus (strings/comments/jsdoc/triple-slash/all number bases/this/ super/semicolons/member-access/optional-chaining/new/params/types/jsx/entities/ regex) = 0 diffs on all 4 grammars; test-issues 350/0, tsx-highlight 56/56, highlight-bench held, js-highlight-bench 93.0%, vue-issues 20/20, tsc clean, deterministic, zero dangling refs. repo-compat: js 8.8→18.8%, jsx 10.6→21.3%, tsx 22.5→27.5%, ts 23.3→28.1% (all NATIVE names, public-#include subset still 100%). HTML audited too (separate agent): `tag` is a name-agnostic single rule spanning the official's tags-valid ∪ tags-invalid, math/svg/doctype/cdata aren't modeled (well-formed subset) — no genuine 1:1, so html.ts is intentionally left at its 3 already-matching keys (honest 25%, not an inflated rename).
1 parent f5c6d8d commit 70c1a3d

7 files changed

Lines changed: 797 additions & 532 deletions

0 commit comments

Comments
 (0)