Repository navigation
fix(ai): the AST engine parses with tree-sitter - #562
Merged
Merged
Conversation
TreeSitterEngine mapped TypeScript, JavaScript, Go, Rust, Java and HCL with tree-sitter, but neither tree_sitter nor any grammar was a dependency, so every file went to the regex fallback. In the pinned samples, 16 of 31 TypeScript and 10 of 37 Rust files yielded no symbols. tree-sitter and the official grammars are now dependencies. Each language loads by its package's entry point; TypeScript and TSX are separate grammars, and `grammar.language()` did not exist for TypeScript. The native walk names: - arrow-function declarators; - Go type specs; - Rust enums, modules, constants and macros; - Java enums, records, constructors and annotations; - top-level Terraform blocks. A file tree-sitter parses with no symbols is reported as parsed. On the samples, every file in those languages parses with tree-sitter. TypeScript symbols rose from 54 to 194 and Rust from 763 to 1,552. Closes #538
This was referenced Sep 25, 2026
Merged
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.
Closes #538.
Problem
TreeSitterEnginemaps TypeScript, JavaScript, Go, Rust, Java and HCL with tree-sitter, but neithertree_sitternor any grammar was a dependency, so every file fell back to the regex parser. In the pinned samples, 16 of 31 TypeScript, 10 of 37 Rust, 8 of 85 Java and 1 of 5 HCL files yielded no symbols.Changes
tree-sitterplus the official grammars (python, typescript, javascript, go, rust, java) andtree-sitter-hclfrom tree-sitter-grammars.LANG_TO_GRAMMARpairs each language with its package and entry point. TypeScript'slanguage_typescriptandlanguage_tsxare separate grammars, so.tsxgets the JSX-aware one.grammar.language()didn't exist for TypeScript, so loading had been failing silently.const f = () =>), type aliases, enums, abstract classes;macro_rules!;resource "aws_vpc" "this"), nested blocks excluded.Verification on the pinned samples
package-info.java(was 8)Java's count fell because the regex over-counted: it reported 80 methods in
Gson.java, where tree-sitter finds 38 methods and 2 constructors. Repository maps grew from 102 to 126 files for TS/JS, and from 41 to 64 for Terraform.Test plan
tests/test_treesitter_native_symbols.py(8 tests):tests/test_treesitter_engine.py:.tsxnow detects astsxuv run devops ci --force: all 13 gates pass