Skip to content

deps: move tree-sitter-language-pack to 1.x, and read Dart type arguments from the call - #153

Closed
fabceolin wants to merge 1 commit into
FSoft-AI4Code:mainfrom
fabceolin:deps/language-pack-1x
Closed

fabceolin wants to merge 1 commit into
FSoft-AI4Code:mainfrom
fabceolin:deps/language-pack-1x

Conversation

@fabceolin

Copy link
Copy Markdown
Contributor

Summary

  • Move tree-sitter-language-pack from >=0.8.0,<0.9.0 to >=1.23.1,<2.0.0 (pyproject.toml, requirements.txt).
  • Fix the Dart analyzer for the 1.x Dart grammar, which parses Foo<T>(x) as a call.
  • Fetch the pack grammars at Docker build time, because 1.x downloads them on first use.

Why

The Lean grammar exists only in the 1.x pack. I tested get_parser("lean") on 0.8.0, 0.9.1, 0.13.0 and 1.23.1, and only 1.23.1 loads it. A Lean 4 analyzer will follow in a stacked PR. The bump is separate so you can review it on its own: the cap below 0.9 came in with 8d4a6f5.

What breaks with 1.x, and the fix

With only the pin changed, two Dart tests fail:

  • test_dart_analyzer.py::test_call_resolution_rules: Garage.open -> Item is missing.
  • test_dart_flutter.py::test_riverpod_and_router_edges: carProvider -> Car is missing.

Both have one cause. In 0.8, Box<Item>(1) was a relational_expression, and _handle_generic_invocation recovered it from the node text. In 1.x, it is an identifier followed by a selector whose argument_part holds type_arguments. _process_chain already emitted the Box instantiation edge from that shape, but not the type-argument edges. It now does. The relational-expression path stays.

No test changed: the existing assertions are the regression tests for this.

Runtime grammar download

1.x downloads each grammar on first use and caches it under tree_sitter_language_pack.cache_dir(). The grammars CodeWiki takes from the pack are dart, go, javascript, typescript, vue and zig. So:

  • The first run of those analyzers needs network access. When the download fails, the error is raised inside each analyzer's existing try/except. The file is logged and skipped, and the run continues.
  • docker/Dockerfile downloads the grammars at build time, so the image runs offline.
  • guides/development.md says to add a new pack grammar to that list.

Test plan

  • pytest -q -o addopts="": 654 passed with 1.23.1 (2 Dart failures before the fix).
  • ruff check codewiki tests and ruff format --check codewiki tests.
  • docker build -f docker/Dockerfile . (not run locally).

🤖 Generated with Claude Code

…ents from the call

The pin goes from >=0.8.0,<0.9.0 to >=1.23.1,<2.0.0. Grammars that 0.8
does not ship (Lean, among others) are only in 1.x.

The 1.x Dart grammar parses `Foo<T>(x)` as an identifier with a call
selector whose argument_part holds the type_arguments, not as a
relational expression. `_handle_generic_invocation` never saw it, so the
type-argument edges (`Garage.open -> Item`, `carProvider -> Car`) were
lost. `_process_chain` now takes them from the call. The relational
expression path stays for grammars that still misparse it.

1.x downloads each grammar on first use and caches it. The Docker image
fetches the grammars the analyzers load at build time, so it runs
offline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fabceolin

Copy link
Copy Markdown
Contributor Author

Closing: the motivation was the Lean grammar, which is only in the 1.x pack, and we are holding the Lean analyzer. Thank you.

@fabceolin fabceolin closed this Nov 2, 2026
@fabceolin
fabceolin deleted the deps/language-pack-1x branch November 2, 2026 20:20
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