Skip to content

Commit aa7812b

Browse files
authored
feat(native): port Julia extractor to Rust (#1098)
* feat(native): port Julia extractor to Rust Adds tree-sitter-julia dependency and native extractor matching the WASM-side behavior for Julia symbol, import, and call extraction. Part of #1071 * fix(parser): register .jl in NATIVE_SUPPORTED_EXTENSIONS Native Julia support landed in this PR but the JS-side mirror of the Rust LanguageKind enum was not updated, so the drift guard in tests/parsers/native-drop-classification.test.ts (and the WASM-only bucket in classifyNativeDrops) flagged .jl as missing. Add .jl to the set and drop it from the WASM-only test fixture. * fix(julia): emit base name for parameterized abstract types handle_abstract_def previously fell back to the type_head node itself when no plain identifier was found, dumping the full raw text "Name{T} <: Super{T,1}" as a definition name for any parameterized generic abstract type. The TS counterpart returns early on no-name; the native port should match. Recurse into wrapper shapes (binary_expression, parameterized identifier, type_parameter_list, type_argument_list) to locate the base identifier, and skip emission when none is found. Adds a regression test asserting the base name "AbstractVector" for "abstract type AbstractVector{T} <: AbstractArray{T,1} end". * fix(native/julia): handle parameterized structs, qualified defs, qualified selected imports (#1098)
1 parent 06aaa85 commit aa7812b

11 files changed

Lines changed: 804 additions & 9 deletions

File tree

Cargo.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/codegraph-core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ tree-sitter-dart = "0.0.4"
3636
tree-sitter-zig = "1"
3737
tree-sitter-haskell = "0.23"
3838
tree-sitter-ocaml = "0.24"
39+
tree-sitter-julia = "0.23"
3940
tree-sitter-clojure-orchard = "0.2"
4041
rayon = "1"
4142
ignore = "0.4"

crates/codegraph-core/src/change_detection.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,15 +774,14 @@ mod tests {
774774

775775
#[test]
776776
fn detect_removed_skips_unsupported_extensions() {
777-
// Files in WASM-only languages (Gleam, Julia, F#) live in
777+
// Files in WASM-only languages (Gleam, F#) live in
778778
// `file_hashes` because the JS-side WASM backfill writes them, but
779779
// Rust's narrower file_collector never collects them. Without this
780780
// skip, every incremental rebuild would flag them as removed and
781781
// purge their rows — the #1066 ~2s floor.
782782
let mut existing = HashMap::new();
783783
for path in [
784784
"tests/fixtures/gleam/main.gleam",
785-
"tests/fixtures/julia/main.jl",
786785
"tests/fixtures/fsharp/Main.fs",
787786
] {
788787
existing.insert(

crates/codegraph-core/src/extractors/helpers.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,16 @@ pub const OCAML_AST_CONFIG: LangAstConfig = LangAstConfig {
374374
string_prefixes: &[],
375375
};
376376

377+
pub const JULIA_AST_CONFIG: LangAstConfig = LangAstConfig {
378+
new_types: &[],
379+
throw_types: &[],
380+
await_types: &[],
381+
string_types: &["string_literal", "prefixed_string_literal"],
382+
regex_types: &[],
383+
quote_chars: &['"'],
384+
string_prefixes: &[],
385+
};
386+
377387
pub const CLOJURE_AST_CONFIG: LangAstConfig = LangAstConfig {
378388
new_types: &[],
379389
throw_types: &[],

0 commit comments

Comments
 (0)