mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-12-06 04:56:45 +08:00
A method call on an instance of a class defined in another file produced no CALLS edge, while the identical code in the class's own file resolved via lsp_ts_method. The type-aware tier typed the receiver wrongly in two places, so the method lookup in the shared TS registry missed and the call fell to method_not_in_registry: 1. `new C()` always qualified a bare constructor name against the CURRENT module. `const t = new ImportedClass(); t.m()` and `new ImportedClass().m()` were typed as a phantom `<this module>.ImportedClass`. The constructor type now follows TS scoping: a class declared in this module, else the class an unambiguous import binding names, else the old spelling. 2. ts_import_symbol_qn (and the copy of its heuristic in resolve_type_with_imports) treated an import value ending in ".<name>" as an already-qualified symbol QN. For the dominant TS convention of a file named after its class (`Foo.ts` exports `class Foo`, module `x.Foo`, class `x.Foo.Foo`), the receiver was typed as the MODULE, for `new`, annotations and parameters alike. The registry now decides the ambiguous case: a registered `module.name` wins, else the value is the symbol QN as before. Both are resolved through the existing shared cross-file registry; no name-based fallback is reintroduced. Cost is one or two hashed lookups on the finalized overlay / sealed shared registry, per `new` expression or per ambiguous import spelling during the walk; nothing is looked up during registration and nothing is written to the shared registry. typeorm (3,593 .ts files, shallow f279fd13): lsp_ts_method 2,551 -> 3,130, all 579 new edges cross-file (cross-file lsp_ts_method 696 -> 1,275), 0 edges lost, other strategies unchanged, index time unchanged. 20 sampled new edges checked against source: 20 true positives. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>