Skip to content

Commit a0420de

Browse files
committed
fix(lsp): qualify Kotlin LSP caller/callee QNs with module_qn
The Kotlin LSP initialized package_qn to "" for files without a source `package` declaration, so it emitted bare resolved-call QNs (caller_qn "caller", callee_qn "helper"). The pipeline join keys on an exact caller_qn == enclosing_func_qn match, but the textual extractor qualifies the enclosing function with the FS-path module_qn ("<project>.main.caller"). Bare != qualified, so every Kotlin LSP resolution was dropped and no strategy-tagged CALLS edge survived. Initialize package_qn to module_qn (the same FS-path prefix the textual extractor uses); a source `package_header`, when present, still overrides it for cross-file import resolution. Recovers the Kotlin top_level/method/ static/this/super/... LSP strategy reproductions (kt suite 11->15). Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 7b7684b commit a0420de

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎internal/cbm/lsp/kotlin_lsp.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4076,11 +4076,14 @@ void cbm_run_kotlin_lsp(CBMArena *arena, CBMFileResult *result, const char *sour
40764076
project_name = module_qn;
40774077
}
40784078

4079-
/* Initial package_qn is empty — overridden by kotlin_lsp_process_file
4080-
* when it sees the `package_header` AST node. */
4079+
/* Initial package_qn is the FS-path module_qn ("<project>.<rel.path>"),
4080+
* matching the textual extractor's QN prefix so the LSP's caller_qn equals
4081+
* the call site's enclosing_func_qn (the join keys on an exact caller_qn
4082+
* match). A source `package_header`, when present, overrides this in
4083+
* kotlin_lsp_process_file for cross-file import resolution. */
40814084
KotlinLSPContext ctx;
4082-
kotlin_lsp_init(&ctx, arena, use_source, use_source_len, &registry, "", module_qn, project_name,
4083-
/*rel_path=*/NULL, &result->resolved_calls);
4085+
kotlin_lsp_init(&ctx, arena, use_source, use_source_len, &registry, module_qn, module_qn,
4086+
project_name, /*rel_path=*/NULL, &result->resolved_calls);
40844087

40854088
kotlin_lsp_process_file(&ctx, use_root);
40864089

0 commit comments

Comments
 (0)