Skip to content

build(deps): Update tree-sitter to 0.26.5 and all grammar dependencies - #1225

Merged
marco-c merged 5 commits into
mozilla:masterfrom
marlon-costa-dc:feature/tree-sitter-0.26.5
Nov 20, 2026
Merged

marco-c merged 5 commits into
mozilla:masterfrom
marlon-costa-dc:feature/tree-sitter-0.26.5

Conversation

@marlon-costa-dc

@marlon-costa-dc marlon-costa-dc commented Feb 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Updates tree-sitter from 0.25.3 to 0.26.5 and all related grammar/build dependencies.

Dependency updates

Crate From To
tree-sitter 0.25.3 0.26.5
tree-sitter-javascript 0.23.1 0.25.0
tree-sitter-python 0.23.6 0.25.0
tree-sitter-rust 0.23.2 0.24.0
tree-sitter-kotlin tree-sitter-kotlin-ng 1.1.0 tree-sitter-kotlin-sg 0.4.1
askama 0.14 0.15
insta 1.29.0 1.46.1
tree-sitter-preproc 0.20.3 0.20.4
tree-sitter-ccomment 0.20.3 0.20.4
tree-sitter-mozcpp 0.20.4 0.20.5
tree-sitter-mozjs 0.20.3 0.20.4

Code changes

  • Node::child() API fix: tree-sitter 0.26 changed parameter from usize to u32 — updated child(pos) → child(pos as u32)
  • Kotlin grammar: switched to tree-sitter-kotlin-sg, which exposes the standard LANGUAGE constant, so no special-case macro arm is needed
  • Regenerated Mozilla grammars: tree-sitter-mozcpp, tree-sitter-mozjs, tree-sitter-preproc and tree-sitter-ccomment regenerated with tree-sitter-cli 0.26 (scanners synced from tree-sitter-cpp 0.23.4 / tree-sitter-javascript 0.25.0)
  • Regenerated language enums: Updated all src/languages/ files for new grammar node types

Related

Why tree-sitter-kotlin-sg?

tree-sitter-kotlin-ng has had no commits since its 1.1.0 release in January 2025. The original grammar, fwcd/tree-sitter-kotlin, is actively developed, but its last crates.io release (0.3.8, 2024) only supports tree-sitter < 0.23, and a new release is still pending (fwcd/tree-sitter-kotlin#242).

tree-sitter-kotlin-sg is ast-grep's mirror of the fwcd grammar (last synced May 2026, ~2.8M downloads), built on tree-sitter-language and compatible with tree-sitter 0.26. tree-sitter-kotlin-codanna, used in an earlier revision of this PR, is another fwcd fork, but it hasn't been updated since November 2025 and is 135 commits behind upstream. Once fwcd publishes 0.4.0, we can switch to the upstream tree-sitter-kotlin crate.

Test Plan

  • cargo check passes
  • All 251 existing tests pass (cargo test --workspace)
  • Rebased on upstream/master

@marco-c

marco-c commented Feb 25, 2026

Copy link
Copy Markdown
Collaborator

@marlon-costa-dc the table in your PR description is missing the "From" version of some of the dependencies.

@Luni-4

Luni-4 commented Feb 25, 2026

Copy link
Copy Markdown
Collaborator

@marlon-costa-dc

We’ve also lost the regeneration of the tree-sitter-mozcpp, tree-sitter-mozjs, tree-sitter-preproc, and tree-sitter-ccomment grammars that was previously included in #1214.

@marco-c
marco-c force-pushed the feature/tree-sitter-0.26.5 branch 2 times, most recently from ecc17bd to bd713e4 Compare November 19, 2026 11:14
marlon-costa-dc and others added 4 commits November 19, 2026 21:36
Regenerate tree-sitter-mozcpp, tree-sitter-mozjs, tree-sitter-preproc and
tree-sitter-ccomment with tree-sitter-cli 0.26, syncing the mozcpp and mozjs
scanners from tree-sitter-cpp 0.23.4 and tree-sitter-javascript 0.25.0, and
bump the grammar crate versions accordingly.
tree-sitter-kotlin-codanna has not been updated since November 2025 and is
135 commits behind the upstream fwcd/tree-sitter-kotlin grammar.
tree-sitter-kotlin-sg is ast-grep's mirror of upstream, uses the modern
LANGUAGE API (dropping the special-case macro arm), and is far more widely used.
Computing the metrics of mozilla-central for tree-sitter-mozcpp takes more
than 2.5 hours per run, and the check runs it twice, so the task kept
hitting its 3 hours deadline. Raise both the deadline and maxRunTime of
the check tasks to 5 hours.
@marco-c
marco-c force-pushed the feature/tree-sitter-0.26.5 branch from 8d256cd to bff11bb Compare November 19, 2026 20:36
Computing the metrics of security/manager/ssl/nsSTSPreloadList.inc and
third_party/wasm2c/src/prebuilt/lexer-keywords.cc takes hours, because
they are parsed into very deep trees and some metrics walk up the
ancestors of a node with O(depth) parent lookups. This made the
tree-sitter-mozcpp check task always hit its deadline.

Exclude them until the underlying problem is fixed (mozilla#1258).
@marco-c
marco-c merged commit ac94f0c into mozilla:master Nov 20, 2026
1 check passed
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.

3 participants