Summary
tree-sitter-language-pack is currently held back at >=1.5.0,<1.6.3 (resolved to 1.6.2). The bump to 1.9.0 was excluded from #52 because it breaks the Dart and R parsers. This issue tracks doing the upgrade properly in a dedicated PR.
The problem
In 1.9.0, tree-sitter-language-pack drops its explicit tree-sitter dependency and bundles a newer tree-sitter core. The newer core's parse() no longer accepts a bytes object the way our code calls it, producing:
TypeError: 'bytes' object is not an instance of 'str'
while processing 'source'
This only affects parsers that get their grammar from the language pack — there are no standalone tree-sitter-dart / tree-sitter-r packages in our deps — which is why the other 22 parsers (using their own tree-sitter-<lang> packages) are unaffected.
Affected code
server/parser/dart.py:285 — tree = self._parser.parse(source)
server/parser/r.py:126 — tree = self._parser.parse(source)
Both obtain their parser via from tree_sitter_language_pack import get_parser.
Failing tests
tests/parser/test_dart.py::test_empty_file_returns_no_symbols
tests/parser/test_dart.py::test_canonical_user_widget_fixture
tests/parser/test_r.py::test_empty_file_returns_no_symbols
tests/parser/test_r.py::test_canonical_utils_fixture
(Observed in CI on #52: 4 failed, 200 passed.)
Proposed fix
Adapt the parse() calls in dart.py and r.py to the newer tree-sitter API — likely passing str (or using the encoding= / read-callable form) instead of raw bytes for the language-pack-backed parsers. Verify whether the standalone tree-sitter-<lang> parsers need the same treatment once the bundled core is upgraded, then:
- Bump
tree-sitter-language-pack to 1.9.0 in pyproject.toml and re-lock.
- Update the Dart and R parsers to the new
parse() API.
- Confirm
uv run pytest is fully green.
Context
Summary
tree-sitter-language-packis currently held back at>=1.5.0,<1.6.3(resolved to 1.6.2). The bump to 1.9.0 was excluded from #52 because it breaks the Dart and R parsers. This issue tracks doing the upgrade properly in a dedicated PR.The problem
In
1.9.0,tree-sitter-language-packdrops its explicittree-sitterdependency and bundles a newer tree-sitter core. The newer core'sparse()no longer accepts abytesobject the way our code calls it, producing:This only affects parsers that get their grammar from the language pack — there are no standalone
tree-sitter-dart/tree-sitter-rpackages in our deps — which is why the other 22 parsers (using their owntree-sitter-<lang>packages) are unaffected.Affected code
server/parser/dart.py:285—tree = self._parser.parse(source)server/parser/r.py:126—tree = self._parser.parse(source)Both obtain their parser via
from tree_sitter_language_pack import get_parser.Failing tests
(Observed in CI on #52:
4 failed, 200 passed.)Proposed fix
Adapt the
parse()calls indart.pyandr.pyto the newer tree-sitter API — likely passingstr(or using theencoding=/ read-callable form) instead of rawbytesfor the language-pack-backed parsers. Verify whether the standalonetree-sitter-<lang>parsers need the same treatment once the bundled core is upgraded, then:tree-sitter-language-packto1.9.0inpyproject.tomland re-lock.parse()API.uv run pytestis fully green.Context