Skip to content

Commit 06b6536

Browse files
authored
feat(native): port Gleam extractor to Rust (#1105)
* feat(native): port Gleam extractor to Rust * fix(gleam): use named_child to skip anonymous punctuation tokens Replaces child(0) fallbacks in handleCall / handle_call with named_child(0) in both the native Rust and WASM/JS Gleam extractors. The Gleam tree-sitter grammar's field_access node includes the '.' punctuation token as a child, so child(0) on field_access could return '.' as the receiver text on malformed input. named_child(0) skips anonymous tokens and is consistent across both engines. The field accessors always succeed on valid Gleam, so this only affects the defensive fallback path, but it removes a silent asymmetry that Greptile flagged in review of #1105. * fix(gleam): match both function_call and call nodes for parity with JS (#1105) * fix(gleam): align alias fallback with JS extractor and add aliased import test (#1105) * test: add explicit .gleam assertion to NATIVE_SUPPORTED_EXTENSIONS test (#1105)
1 parent 11f975a commit 06b6536

13 files changed

Lines changed: 506 additions & 17 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-gleam = "1"
3940
tree-sitter-julia = "0.23"
4041
tree-sitter-clojure-orchard = "0.2"
4142
tree-sitter-erlang = "0.16"

crates/codegraph-core/src/change_detection.rs

Lines changed: 3 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. `.gleam`, `.jl`, `.fs` — WASM-only languages) are skipped:
135+
/// (e.g. `.fs`, `.fsx` — 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,15 +774,15 @@ mod tests {
774774

775775
#[test]
776776
fn detect_removed_skips_unsupported_extensions() {
777-
// Files in WASM-only languages (Gleam, F#) live in
777+
// Files in WASM-only languages (F#, F# Script) 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/gleam/main.gleam",
785784
"tests/fixtures/fsharp/Main.fs",
785+
"tests/fixtures/fsharp/Main.fsx",
786786
] {
787787
existing.insert(
788788
path.to_string(),

0 commit comments

Comments
 (0)