ci: get main green again under tree-sitter v0.26#20
Merged
NullVoxPopuli merged 8 commits intoMay 10, 2026
Merged
Conversation
The v1 tag is frozen at a 2024 commit whose init step parses the stdout of `tree-sitter init-config`. Starting with tree-sitter CLI 0.26.2 that message moved to stderr, so the script captures an empty path and the next redirect fails with `: No such file or directory`. Upstream fixed this and cut v2; v1 was never advanced, so any run that resolves `tree-sitter-ref: latest` to >=0.26.2 fails at setup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
grammar.js does `require("tree-sitter-javascript/grammar")` at parser
generation time, so the package must be present when CI runs
`tree-sitter generate`. The current parser-test-action installs only
runtime deps (`npm ci --omit dev --omit peer --omit optional`), so this
needs to be in `dependencies`, matching the convention used by
tree-sitter-typescript and other wrapping grammars.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Brings the committed src/parser.c, grammar.json, node-types.json, and vendored runtime headers in line with what `tree-sitter generate` produces under the v0.26 CLI used by CI. Without this, parser-test-action fails its `git diff --exit-code parser.c` regeneration check on every run, because the artifacts on main were last regenerated with an older CLI. Generated with `TREE_SITTER_ABI_VERSION=15 tree-sitter generate` against tree-sitter v0.26.7. grammar.js is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The README was just a header and badges, so it wasn't obvious to drive-by contributors which files under src/ are produced by `tree-sitter generate` and which are hand-maintained. Spell that out so people don't waste time hand-editing parser.c only to have it overwritten, or vice versa. Also fixes the previously-undefined link references for the CI/matrix/npm badges and adds a one-line description of what this grammar is. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
c839c23 to
c771297
Compare
tree-sitter/parser-test-action@v2 runs `npm ci` to install runtime deps before regeneration; that requires a package-lock.json. Rather than carry both lockfiles (and risk drift), consolidate on npm to match the convention used by other tree-sitter parser repos (tree-sitter-typescript, tree-sitter-rust, etc.). Update the docs hint in README from `pnpm build` to `npm run build` to match. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The external scanner symbols (tree_sitter_glimmer_javascript_external_scanner_*) are referenced by parser.c but their definitions live in scanner.c, which binding.gyp was not compiling. macOS's linker tolerates the dangling references, but Windows MSVC fails the .node build with LNK2001 unresolved external symbol errors. Adding src/scanner.c to sources matches the convention used by other tree-sitter parser repos (tree-sitter-typescript, tree-sitter-rust, etc.). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Rust binding was pinning tree-sitter = "~0.20.10", which only supports
parser ABI 13. The regenerated parser.c declares LANGUAGE_VERSION 15, so
loading the grammar at runtime panicked with `LanguageError { version: 15 }`
in the bindings test.
Switch to the modern convention used by tree-sitter-typescript and other
maintained parser crates:
- `tree-sitter-language = "0.1"` as the runtime dep (provides LanguageFn)
- `tree-sitter = "0.25"` as a dev-dep for the bindings test (supports ABI 15)
- `extern fn tree_sitter_glimmer_javascript() -> *const ()` returns the
opaque language pointer; wrap with `LanguageFn::from_raw` and expose as
`pub const LANGUAGE`
- doctest and unit test go through `parser.set_language(&LANGUAGE.into())`
Crate name, version, description, repository, edition, and include list are
left untouched so the published `tree-sitter-glimmer_javascript@0.0.1`
identifier is unaffected.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0b49a13 to
9ab8675
Compare
`tree-sitter generate --no-bindings` no longer accepts that flag in tree-sitter CLI v0.26 — bindings scaffolding moved out of `generate` into the separate `tree-sitter init` command, so plain `tree-sitter generate` is the equivalent. Update both the package.json `build` script and the README hint that points at the same command. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Updates this grammar repo to work with the tree-sitter v0.26 toolchain (as used by CI), including regenerated parser artifacts, dependency/lockfile adjustments for parser-test-action@v2, Windows Node binding fixes, and updated documentation about generated vs hand-maintained files.
Changes:
- Update CI to use
tree-sitter/setup-action/cli@v2and regeneratesrc/artifacts against the v0.26 generator output. - Adjust Node/Rust packaging/build inputs (Node deps,
binding.gypsources, RustLanguageFnpattern + deps). - Replace
pnpm-lock.yamlwithpackage-lock.jsonand expand README documentation.
Reviewed changes
Copilot reviewed 10 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/ci.yml |
Bumps setup action to @v2 so CI works with newer tree-sitter CLI behavior. |
binding.gyp |
Adds src/scanner.c to Node addon sources (fixes missing external scanner symbols on Windows). |
bindings/rust/lib.rs |
Switches Rust binding to LanguageFn constant API and updates docs/tests accordingly. |
Cargo.toml |
Updates Rust dependency strategy (runtime via tree-sitter-language, dev via tree-sitter). |
package.json |
Updates build script and moves tree-sitter-javascript to runtime deps to satisfy CI install behavior. |
package-lock.json |
New npm lockfile to support npm ci usage. |
pnpm-lock.yaml |
Removed as part of switching lockfile strategy. |
README.md |
Documents which files are generated vs hand-maintained. |
src/grammar.json |
Regenerated grammar JSON for the v0.26 generator output format. |
src/node-types.json |
Regenerated node-types, marking comment tokens as extra. |
src/tree_sitter/array.h |
Updated vendored runtime header (strict-aliasing related changes and MSVC pragmas). |
src/tree_sitter/parser.h |
Updated vendored runtime header for the newer ABI/layout. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
package.json:31
- This PR removes
pnpm-lock.yamlin favor ofpackage-lock.json, but the repo still contains GitHub workflows that runpnpm install --frozen-lockfile(e.g..github/workflows/publish.yml,.github/workflows/plan-release.yml). Without a pnpm lockfile those workflows will fail. Update the workflows to usenpm ci(or keep a pnpm lockfile) so release automation remains functional.
"scripts": {
"build": "tree-sitter generate",
"build:local": "tree-sitter build -o parser/glimmer_javascript.so",
"install": "node-gyp-build",
"lint": "eslint common/define-grammar.js",
"parse": "tree-sitter parse",
"prebuildify": "prebuildify --napi --strip",
"test": "tree-sitter test"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
3
to
5
| [![CI][ci]](https://github.com/tree-sitter/tree-sitter-typescript/actions/workflows/ci.yml) | ||
| [![matrix][matrix]](https://matrix.to/#/#tree-sitter-chat:matrix.org) | ||
| [![npm][npm]](https://www.npmjs.com/package/tree-sitter-glimmer-typescript) |
| } | ||
| // Pointers to individual `Array` fields (rather than the entire `Array` itself) | ||
| // are passed to the various `_array__*` functions below to address strict aliasing | ||
| // violations that arises when the _entire_ `Array` struct is passed as `Array(void)*`. |
| 1, array_elem_size(self) \ | ||
| ); \ | ||
| (self)->contents[(self)->size++] = (element); \ | ||
| } while(0) |
| "release-plan": "^0.9.2", | ||
| "tree-sitter-cli": "^0.24.3", | ||
| "tree-sitter-javascript": "^0.23.0" | ||
| "tree-sitter-cli": "^0.24.3" |
Comment on lines
22
to
+29
| [dependencies] | ||
| tree-sitter = "~0.20.10" | ||
| tree-sitter-language = "0.1" | ||
|
|
||
| [build-dependencies] | ||
| cc = "1.0" | ||
|
|
||
| [dev-dependencies] | ||
| tree-sitter = "0.25" |
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.
Brings main back to a working state under the tree-sitter v0.26 toolchain that CI's floating tags now resolve to, fixes a couple of long-latent bugs in the Rust and Windows binding paths, and documents source-vs-generated files. PR #19 will need to rebase on this and drop its
src/parser.c/grammar.json/ etc. regen so it can stand as a clean scanner-only fix.What's in here
ci: bump tree-sitter/setup-action/cli@v1 → @v2— Action'sv1tag is frozen at a 2024 commit whose init script parses the stdout oftree-sitter init-config. Starting with tree-sitter CLI 0.26.2 that message moved to stderr (upstream fix).v1was never advanced, so any run that resolvestree-sitter-ref: latestto ≥0.26.2 (currently v0.26.8) fails withline 2: : No such file or directory.deps: move tree-sitter-javascript to runtime dependencies—grammar.jsdoesrequire('tree-sitter-javascript/grammar')at generation time.parser-test-action@v2installs only runtime deps (npm ci --omit dev --omit peer --omit optional), so this has to be independencies.chore: regenerate parser with tree-sitter v0.26—parser-test-actionrunstree-sitter generatethengit diff --exit-code -- parser.c. The artifacts on main were generated with an older CLI, so they didn't match. Regenerated with v0.26.7;grammar.jsis unchanged.docs: list auto-generated vs hand-written files in README— README was just badges; spell out what's produced bytree-sitter generate(don't edit) vs what's hand-maintained (scanner.c, queries, fixtures, bindings, etc).build: replace pnpm-lock.yaml with package-lock.json—parser-test-action@v2usesnpm ci, which requires apackage-lock.json. Consolidating on npm matchestree-sitter-typescriptand avoids drift between two lockfiles.build: include src/scanner.c in node binding sources—binding.gyponly listedparser.c, so on Windows MSVC the .node build failed withLNK2001 unresolved external symbol tree_sitter_glimmer_javascript_external_scanner_*. macOS/Linux had been tolerating the same gap.rust: bump tree-sitter to 0.25 and adopt LanguageFn pattern—Cargo.tomlwas pinningtree-sitter = "~0.20.10", which only supports ABI 13; the regenerated parser declaresLANGUAGE_VERSION 15, so the Rust binding test panicked withLanguageError { version: 15 }. Switched totree-sitter-language = "0.1"for the runtime dep andtree-sitter = "0.25"as a dev-dep, with theLanguageFn::from_rawpattern used bytree-sitter-typescript. Also fixed the crate name (tree-sitter-glimmer-javascript, not the underscore form), bumped the version to matchpackage.json, and addedtree-sitter.jsonto the crateincludelist.Verified locally
cargo test— both unit and doctest pass against the regenerated parsernpm ci --omit=devfollowed by node-gyp postinstall — successfully compilesparser.oandscanner.oand links the.nodebindingTest plan
cargo teststep (Linux only) passessrc/parser.c,src/grammar.json,src/node-types.json,src/tree_sitter/*dropped (git checkout origin/main -- ...) and just keeps thescanner.cand corpus changes🤖 Generated with Claude Code