Skip to content

Commit 1acf15e

Browse files
authored
feat(native): port Clojure extractor to Rust (#1097)
* feat(native): port Clojure extractor to Rust Adds tree-sitter-clojure dependency and native extractor matching the WASM-side behavior for Clojure symbol, import, and call extraction. Part of #1071 * fix(native): harden clojure extractor child iteration and document parity gaps Address Greptile review feedback on PR #1097: - `find_first_symbol`/`find_second_symbol`: replace `?` with `match` so a `None` from `list_node.child(i)` skips and continues instead of aborting the whole scan, matching the JS extractor's `if (!child) continue;` semantics. Practically inert today (tree-sitter always returns `Some` for `i < child_count()`), but makes the invariant explicit and removes a fragile divergence. - `extract_clojure_params`: document the known `defmethod` dispatch-vector gap inherited from the JS extractor. - `handle_import_form`: document why top-level `(require 'some.ns)` and `(require '[some.ns :as s])` are silently dropped and point maintainers at the working `(ns ...)` path in `extract_ns_requires`.
1 parent f6c0289 commit 1acf15e

11 files changed

Lines changed: 529 additions & 10 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
@@ -35,6 +35,7 @@ tree-sitter-dart = "0.0.4"
3535
tree-sitter-zig = "1"
3636
tree-sitter-haskell = "0.23"
3737
tree-sitter-ocaml = "0.24"
38+
tree-sitter-clojure-orchard = "0.2"
3839
rayon = "1"
3940
ignore = "0.4"
4041
globset = "0.4"

crates/codegraph-core/src/change_detection.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ fn load_file_hashes(conn: &Connection) -> Option<HashMap<String, FileHashRow>> {
132132
/// found on disk are treated as removed.
133133
///
134134
/// Files whose extension is outside the Rust file_collector's supported set
135-
/// (e.g. `.clj`, `.gleam`, `.jl`, `.fs` — WASM-only languages) are skipped:
135+
/// (e.g. `.gleam`, `.jl`, `.fs` — WASM-only languages) are skipped:
136136
/// the orchestrator's narrower collector never sees them, so absence from
137137
/// `current` is a capability boundary, not a deletion. Their `nodes` and
138138
/// `file_hashes` rows are owned by the JS-side WASM backfill (#967, #1068)
@@ -774,14 +774,13 @@ mod tests {
774774

775775
#[test]
776776
fn detect_removed_skips_unsupported_extensions() {
777-
// Files in WASM-only languages (Clojure, Gleam, Julia, F#) live in
777+
// Files in WASM-only languages (Gleam, Julia, 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 [
784-
"tests/fixtures/clojure/main.clj",
785784
"tests/fixtures/gleam/main.gleam",
786785
"tests/fixtures/julia/main.jl",
787786
"tests/fixtures/fsharp/Main.fs",

0 commit comments

Comments
 (0)