Repository navigation
grammar(ts): build TypeScript from marionebl's maintained fork - #15
Merged
Merged
Conversation
Switch the vendored tree-sitter-typescript base from upstream v0.23.2 (no commit since 2025-01-30) to marionebl/tree-sitter-typescript@53071c9. On top of it, the patch now carries dokimasia 55b0687 + 96ce7e6 (import types as primary types, typeof import() in call type arguments) and our own `out`-as-a-name alias and `<in const T>`. Regenerated with tree-sitter-cli 0.25.10 (ABI 15) into both the wasm and the kernel's vendored C. The differential job: divergent files across Effect / Zod / Excalidraw / VS Code drop 201 -> 32, new 0, worse 0. Fixes the colbymchenry#335 overload-after-member ASI case. The variance test reads `in` / `out` from the new `variance` node. Four strict ts-syntax fixtures pin what the base and dokimasia fix.
marionebl's colbymchenry#335 fix inserts an implicit `;` before any `<` that starts a line in a type or class body. Right after a bare member name tsc reads `find\n <T>(id): T` as one method, but the scanner split it into a property plus a call signature (no parse error in an interface), and a class method lost its call edges. The grammar now lists `(` as an external the scanner never produces, as JavaScript does for '||', and the scanner skips that `;` when `(` is valid, which is only right after a member name. colbymchenry#335's shapes (`a: string\n<A>(self: A): A`) still split. Comparing every node of every file over the four corpora, src and ui/src, the fix changes no tree (0 of 14,929); differential unchanged at 32. Also: node-kind test for both sides, tsx twins for the new strict fixtures, Known limits for parenthesized import types and the scanner's `in` edge cases, and doc provenance fixes.
The previous fix skipped ASI before a line-start `<` whenever `(` could
come next. `(` is also valid after `typeof x` / `import("m").X` types and
after `return`, so `a: typeof b\n<A>(self: A): A` errored again and
`return\n<any>x` kept the expression.
The grammar now has a never-produced external, `_member_signature_marker`,
between the name and the signature of method_signature, method_definition
and abstract_method_signature, so it is valid exactly where tsc reads a
next-line `<` or `(` as that member's signature. That also keeps
`find\n(id): T` one method, which was split even before the base switch.
Against the build without the scanner hunk, no tree changes on 15,037
files (corpora, src, ui/src, TypeScript's lib) except the member fixtures;
differential unchanged at 32.
Round-3 review: the return-after-ASI test gets a tsx twin, and the Moving-the-base checklist names the define-grammar.js half of the member marker alongside the scanner.h hunk.
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
Switches the vendored tree-sitter-typescript base from upstream v0.23.2 to
marionebl/tree-sitter-typescript@53071c9.
docs/grammars/tree-sitter-typescript.patchis now our delta on that base:55b0687: an import type is a primary type (import("m").X[],keyof import("m").X).96ce7e6:f<typeof import("m")>()parses as a call.outas a type-parameter name (<out>,<in out>), plusconstafter the variance (<in const T>).<in out>vs<in out T>needs a[variance]conflict.Regenerated with tree-sitter-cli 0.25.10 (ABI 15) into the wasm and the kernel's vendored C.
Differential (tsc-ok, tree-sitter-error files)
new 0, worse 0 at each step. marionebl alone fails only
variance-out-name.*. The baseline is updated, and a re-run after--updateexits 0.Tests
npm run build:kernelexit 0. Variance, kernel-*, and extraction tests:Test Files 20 passed (20),Tests 1086 passed | 2 skipped.npx vitest run: 6 failures before the helper fix. 4 weretypescript-variance-parse(in/outnow sit in avariancenode; helper updated, cases unchanged).index-recovery-off-threadpasses on rerun. The ui-server-api "busiest symbol" test fails withexpected 33 to be greater than 300on unmodified main bb0ea5b as well, because it reads the local.codegraphindex.overload-asi,template-literal-escapes,export-type-starandimport-type-primaryare all agree-ok.No EXTRACTION_VERSION bump: the fork re-indexes JS/TS repos manually after deploying, which follows the #13 precedent.