Skip to content

feat(julia): add Julia language support with vendored tree-sitter grammar#290

Open
hexu2 wants to merge 1 commit into
colbymchenry:mainfrom
hexu2:feat/julia-language-support
Open

feat(julia): add Julia language support with vendored tree-sitter grammar#290
hexu2 wants to merge 1 commit into
colbymchenry:mainfrom
hexu2:feat/julia-language-support

Conversation

@hexu2
Copy link
Copy Markdown

@hexu2 hexu2 commented May 22, 2026

Summary

Adds first-class Julia (.jl) indexing to CodeGraph using the tree-sitter-julia grammar.

This PR extends and supersedes the groundwork in #244 by @kongdd, with additional handling for common Julia AST shapes seen in real-world packages (including Julia 1.11):

  • Structs without block wrappersstruct_definition may use typed_expression children instead of body/block; extractStruct now uses resolveBody (consistent with interface extraction).
  • Functions without block wrappers — many files use a flat statement list after signature; resolveBody returns the function node so nested calls are still indexed.
  • One-line definitions — e.g. f(x) = expr via assignment handling (not covered in add support for Julia #244).
  • module nodesmodule_definition mapped to module kind for namespacing.
  • macrocall_expression — included in callTypes.
  • Vendored WASMtree-sitter-julia.wasm is committed under src/extraction/wasm/ (the grammar is not in tree-sitter-wasms@0.1.11; npm-only loading would fail in CI and offline installs).

Also adds the optional getName hook on LanguageExtractor (as proposed in #244) and wires it through extractName.

Test plan

  • npm run build
  • npm test -- --run -t "Julia Extraction" (11 tests)
  • Manual: extractFromSource on representative fixtures (structs, one-liners, modules, call sites)
  • codegraph index on a Julia project; codegraph query <symbol> returns expected definitions and references

Related

Notes for maintainers

  • tree-sitter-julia is a devDependency only for rebuilding WASM; runtime uses the committed src/extraction/wasm/tree-sitter-julia.wasm binary (same pattern as lua/luau/pascal/scala vendoring).

Add tree-sitter-julia extraction with vendored WASM and registry wiring.
Builds on colbymchenry#244 (@kongdd) with support for common Julia 1.11 AST shapes:

- getName hook and resolveBody for structs/functions without block wrappers
- One-line assignment functions (e.g. f(x) = expr)
- Module nodes and macrocall_expression call sites
- Vendored tree-sitter-julia.wasm (not published in tree-sitter-wasms)
- Register .jl in grammars, types, and the language extractor map
@hexu2 hexu2 force-pushed the feat/julia-language-support branch from ae7ae0e to 7a3c565 Compare May 22, 2026 01:59
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