Deferred from PR #1104 review.
Original reviewer comment: #1104 (comment)
Context:
tree-sitter-fsharp ships two distinct grammars:
LANGUAGE_FSHARP — for .fs / .fsx source files
LANGUAGE_SIGNATURE (Rust) / tree_sitter_fsharp_signature (C) — for .fsi signature files
In codegraph, both engines route all three extensions (.fs, .fsx, .fsi) through the single main F# grammar:
- Native:
LanguageKind::FSharp => tree_sitter_fsharp::LANGUAGE_FSHARP (crates/codegraph-core/src/parser_registry.rs:187)
- WASM:
grammarFile: 'tree-sitter-fsharp.wasm' (src/domain/parser.ts:828)
For constructs that are valid only in the signature grammar (e.g., bare val declarations), .fsi files will produce ERROR nodes and the extractor will silently yield empty or partial output.
This was out of scope for PR #1104, whose mandate was to port the existing JS extractor to Rust while maintaining dual-engine parity. The JS engine already had this limitation; both engines remain in parity. Fixing this requires:
- Adding a separate
FSharpSignature LanguageKind variant (mirror of OcamlInterface)
- Wiring
.fsi → FSharpSignature in from_extension
- Wiring
FSharpSignature => tree_sitter_fsharp::LANGUAGE_SIGNATURE in tree_sitter_language
- On the JS side, building a separate
tree-sitter-fsharp-signature.wasm from the upstream grammar's fsharp_signature subdirectory (scripts/build-wasm.ts:208 only references the fsharp sub)
- Adding a
fsharp-signature entry to LANGUAGE_REGISTRY with extensions: ['.fsi']
- Updating
AST_TYPE_MAPS and AST_STRING_CONFIGS to register the fsharp-signature id (or share the F# config)
- Mirroring the same in
crates/codegraph-core/src/extractors/helpers.rs (FSHARP_AST_CONFIG)
The signature grammar may also need a tailored extractor for val bindings, abstract types, and module signatures.
Repro: Create a .fsi file with bare val declarations and run codegraph build; the file will produce ERROR nodes and the extractor will return no symbols.
Deferred from PR #1104 review.
Original reviewer comment: #1104 (comment)
Context:
tree-sitter-fsharpships two distinct grammars:LANGUAGE_FSHARP— for.fs/.fsxsource filesLANGUAGE_SIGNATURE(Rust) /tree_sitter_fsharp_signature(C) — for.fsisignature filesIn codegraph, both engines route all three extensions (
.fs,.fsx,.fsi) through the single main F# grammar:LanguageKind::FSharp => tree_sitter_fsharp::LANGUAGE_FSHARP(crates/codegraph-core/src/parser_registry.rs:187)grammarFile: 'tree-sitter-fsharp.wasm'(src/domain/parser.ts:828)For constructs that are valid only in the signature grammar (e.g., bare
valdeclarations),.fsifiles will produce ERROR nodes and the extractor will silently yield empty or partial output.This was out of scope for PR #1104, whose mandate was to port the existing JS extractor to Rust while maintaining dual-engine parity. The JS engine already had this limitation; both engines remain in parity. Fixing this requires:
FSharpSignatureLanguageKindvariant (mirror ofOcamlInterface).fsi→FSharpSignatureinfrom_extensionFSharpSignature => tree_sitter_fsharp::LANGUAGE_SIGNATUREintree_sitter_languagetree-sitter-fsharp-signature.wasmfrom the upstream grammar'sfsharp_signaturesubdirectory (scripts/build-wasm.ts:208only references thefsharpsub)fsharp-signatureentry toLANGUAGE_REGISTRYwithextensions: ['.fsi']AST_TYPE_MAPSandAST_STRING_CONFIGSto register thefsharp-signatureid (or share the F# config)crates/codegraph-core/src/extractors/helpers.rs(FSHARP_AST_CONFIG)The signature grammar may also need a tailored extractor for
valbindings, abstract types, and module signatures.Repro: Create a
.fsifile with barevaldeclarations and runcodegraph build; the file will produce ERROR nodes and the extractor will return no symbols.