This guide is meant to be usable by both humans and coding agents.
If you want an agent to implement a new language, give it this guide plus a request like:
Add semantic parsing support for
<language>. If the grammar makes call extraction practical, addcall_graphsupport too. Update tests and docs, then runnpm run build,npm run typecheck,npm run lint, andnpm run test:run.
The agent should treat this as a staged task:
- confirm file discovery
- register the language
- add parser support
- add parser tests
- verify
- optionally add call-graph support
- update docs
- re-run verification
This guide removes repo-specific guesswork. It does not replace knowledge of the target language’s tree-sitter grammar.
The implementer still needs to know or look up:
- the grammar crate
- the parser constant
- the node kinds for declarations, comments, and calls
So this guide is a repo wiring guide, not a replacement for the target language's tree-sitter grammar docs.
There are three support levels in this repo:
- File discovery only — files are indexed, but may fall back to line-based chunking
- Semantic parsing — tree-sitter extracts better chunks for search
- Call graph support —
call_graphcan extract callers/callees too
If you are unsure, aim for semantic parsing first. It is much easier to land than full call-graph support.
- the language is registered in
native/src/types.rs - files in that language are discovered by the indexer
native/src/parser.rsuses the correct tree-sitter grammar- semantic chunks are produced for the main declaration types
tests/native.test.tscovers the language- docs are updated if user-facing support claims changed
npm run build,npm run typecheck,npm run lint, andnpm run test:runall pass
- a
native/queries/<language>-calls.scmfile exists native/src/call_extractor.rsroutes the language correctlysrc/indexer/index.tsincludes the language inCALL_GRAPH_LANGUAGESsrc/indexer/index.tsincludes the relevant declaration chunk types inCALL_GRAPH_SYMBOL_CHUNK_TYPEStests/call-graph.test.tscovers the supported call/query forms- full verification passes again
src/config/constants.ts— file extensions included in indexingnative/src/types.rs— language enum and string/extension mappingnative/src/parser.rs— tree-sitter parser wiring, semantic node kinds, comment kindstests/native.test.ts— parser coverage
native/src/call_extractor.rs— call extraction routingnative/queries/<language>-calls.scm— tree-sitter query filesrc/indexer/index.ts— call-graph language + symbol chunk-type allowliststests/call-graph.test.ts— call-graph coverage
README.md— supported-language claims
- Confirm file discovery in
src/config/constants.ts - Register the language in
native/src/types.rs - Add parser support in
native/src/parser.rs - Add one parser test in
tests/native.test.ts - Run
npm run buildandnpm run test:run - Only then add call-graph support
- Update docs
That order keeps failures easy to localize.
Use this exact sequence:
- Check whether the extensions are already present in
src/config/constants.ts - Add the language to
Language,from_extension(),as_str(), andfrom_string()innative/src/types.rs - Add the grammar crate in
native/Cargo.tomlif needed - Add parser selection, comment node kinds, and semantic node kinds in
native/src/parser.rs - Add one parser test in
tests/native.test.ts - Run
npm run buildandnpm run test:run - If call graph is needed, add
native/queries/<language>-calls.scm - Wire the language into
native/src/call_extractor.rs - Add the language and chunk types to
src/indexer/index.ts - Add call-graph tests in
tests/call-graph.test.ts - Update
README.mdif supported-language claims changed - Run full verification:
npm run build,npm run typecheck,npm run lint,npm run test:run
Add extensions only if they are not already included.
Important: discovery here does not mean semantic parsing is supported.
Add the language to:
Languagefrom_extension()as_str()from_string()
This is the canonical registry.
Add the language in three places:
- parser selection in
parse_file_internal() is_comment_node()is_semantic_node()
Start with narrow, declaration-like nodes:
- functions
- methods
- classes / structs
- interfaces / traits
- enums
- modules / namespaces
Avoid broad container nodes unless the grammar gives you no better option.
Add a small test proving the main declaration type becomes a chunk.
If the language should support call_graph, do all of this:
Create a query file modeled after the existing ones.
Use the same capture names already expected by native/src/call_extractor.rs:
@callee.name@call@constructor@import.name@import.default@import.namespace
Start small:
- direct calls
- method/member calls
- imports/includes if applicable
Add the language to:
- parser selection
- query-source selection
method_parent_kindsif needed
Add the language to CALL_GRAPH_LANGUAGES and add relevant declaration chunk types to CALL_GRAPH_SYMBOL_CHUNK_TYPES.
Those chunk-type strings must match the tree-sitter node kinds that actually become chunks in native/src/parser.rs.
Add focused tests for the constructs your query file supports.
The extension is included, but the language is not wired in types.rs and parser.rs, so indexing falls back to line-based chunks.
Usually the crate name, parser constant, or grammar version is wrong.
is_semantic_node() is using the wrong node kinds.
is_comment_node() is using the wrong comment node kinds.
The query file, query registration, or query node names do not match the grammar.
Also check that the query capture names match what native/src/call_extractor.rs expects.
The language is missing from CALL_GRAPH_LANGUAGES or its symbol chunk types are missing from CALL_GRAPH_SYMBOL_CHUNK_TYPES in src/indexer/index.ts.
Run:
npm run build
npm run typecheck
npm run lint
npm run test:runFor partial progress while implementing, the minimum useful checkpoint is:
npm run build
npm run test:runphp files are already included in src/config/constants.ts, but PHP is not yet wired in native/src/types.rs, native/src/parser.rs, or native/queries/.
So a PHP PR is mainly a semantic parsing change, with optional call-graph support.
If you know how to inspect a tree-sitter grammar, this guide should be enough to add a language in this repo without guessing where the plumbing lives.