@lzehrung/codegraph 2.3.31 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -137
- package/codegraph-skill/codegraph/SKILL.md +5 -3
- package/dist/agent/artifact.d.ts +2 -0
- package/dist/agent/artifact.d.ts.map +1 -1
- package/dist/agent/artifact.js.map +1 -1
- package/dist/agent/search.d.ts.map +1 -1
- package/dist/agent/search.js +3 -0
- package/dist/agent/search.js.map +1 -1
- package/dist/agent/session.d.ts +3 -0
- package/dist/agent/session.d.ts.map +1 -1
- package/dist/agent/session.js +10 -2
- package/dist/agent/session.js.map +1 -1
- package/dist/bin/cli.js +42243 -29202
- package/dist/bin/query-index-worker.js +73 -11
- package/dist/cli/affected.d.ts.map +1 -1
- package/dist/cli/affected.js +4 -1
- package/dist/cli/affected.js.map +1 -1
- package/dist/cli/command-catalog.js +1 -1
- package/dist/cli/command-catalog.js.map +1 -1
- package/dist/cli/graph-queries.d.ts.map +1 -1
- package/dist/cli/graph-queries.js +27 -1
- package/dist/cli/graph-queries.js.map +1 -1
- package/dist/cli/help.d.ts +2 -2
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +4 -2
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/options.js +2 -2
- package/dist/cli/options.js.map +1 -1
- package/dist/drift/artifact.d.ts.map +1 -1
- package/dist/drift/artifact.js +15 -18
- package/dist/drift/artifact.js.map +1 -1
- package/dist/drift/compare.js +1 -1
- package/dist/drift/compare.js.map +1 -1
- package/dist/drift/snapshot.d.ts.map +1 -1
- package/dist/drift/snapshot.js +5 -6
- package/dist/drift/snapshot.js.map +1 -1
- package/dist/drift/types.d.ts +2 -0
- package/dist/drift/types.d.ts.map +1 -1
- package/dist/drift/types.js.map +1 -1
- package/dist/graph-builder.d.ts.map +1 -1
- package/dist/graph-builder.js +4 -6
- package/dist/graph-builder.js.map +1 -1
- package/dist/graph-edge-collector.d.ts +3 -0
- package/dist/graph-edge-collector.d.ts.map +1 -1
- package/dist/graph-edge-collector.js +8 -5
- package/dist/graph-edge-collector.js.map +1 -1
- package/dist/graphs/angularjs.d.ts.map +1 -1
- package/dist/graphs/angularjs.js +2 -1
- package/dist/graphs/angularjs.js.map +1 -1
- package/dist/graphs/edge-resolution.d.ts +4 -1
- package/dist/graphs/edge-resolution.d.ts.map +1 -1
- package/dist/graphs/edge-resolution.js +26 -2
- package/dist/graphs/edge-resolution.js.map +1 -1
- package/dist/graphs/specifiers.d.ts.map +1 -1
- package/dist/graphs/specifiers.js +6 -2
- package/dist/graphs/specifiers.js.map +1 -1
- package/dist/graphs/symbol-graph-detailed/ast.d.ts +20 -0
- package/dist/graphs/symbol-graph-detailed/ast.d.ts.map +1 -1
- package/dist/graphs/symbol-graph-detailed/ast.js +154 -15
- package/dist/graphs/symbol-graph-detailed/ast.js.map +1 -1
- package/dist/graphs/symbol-graph-detailed/edge-passes.d.ts +51 -8
- package/dist/graphs/symbol-graph-detailed/edge-passes.d.ts.map +1 -1
- package/dist/graphs/symbol-graph-detailed/edge-passes.js +823 -132
- package/dist/graphs/symbol-graph-detailed/edge-passes.js.map +1 -1
- package/dist/graphs/symbol-graph-detailed/import-aliases.d.ts +2 -1
- package/dist/graphs/symbol-graph-detailed/import-aliases.d.ts.map +1 -1
- package/dist/graphs/symbol-graph-detailed/import-aliases.js +139 -7
- package/dist/graphs/symbol-graph-detailed/import-aliases.js.map +1 -1
- package/dist/graphs/symbol-graph-detailed/member-chains.d.ts +1 -0
- package/dist/graphs/symbol-graph-detailed/member-chains.d.ts.map +1 -1
- package/dist/graphs/symbol-graph-detailed/member-chains.js +3 -1
- package/dist/graphs/symbol-graph-detailed/member-chains.js.map +1 -1
- package/dist/graphs/symbol-graph-detailed/receiver-calls.d.ts +128 -15
- package/dist/graphs/symbol-graph-detailed/receiver-calls.d.ts.map +1 -1
- package/dist/graphs/symbol-graph-detailed/receiver-calls.js +873 -93
- package/dist/graphs/symbol-graph-detailed/receiver-calls.js.map +1 -1
- package/dist/graphs/symbol-graph-detailed.d.ts.map +1 -1
- package/dist/graphs/symbol-graph-detailed.js +434 -40
- package/dist/graphs/symbol-graph-detailed.js.map +1 -1
- package/dist/graphs/symbol-graph.d.ts +2 -0
- package/dist/graphs/symbol-graph.d.ts.map +1 -1
- package/dist/graphs/symbol-graph.js +34 -16
- package/dist/graphs/symbol-graph.js.map +1 -1
- package/dist/impact/call-compatibility/providers/index.d.ts +4 -4
- package/dist/impact/call-compatibility/providers/index.d.ts.map +1 -1
- package/dist/impact/call-compatibility/providers/index.js +6 -6
- package/dist/impact/call-compatibility/providers/index.js.map +1 -1
- package/dist/impact/call-compatibility/providers/types.d.ts +2 -0
- package/dist/impact/call-compatibility/providers/types.d.ts.map +1 -1
- package/dist/impact/call-compatibility/types.d.ts +6 -0
- package/dist/impact/call-compatibility/types.d.ts.map +1 -1
- package/dist/impact/call-compatibility.d.ts.map +1 -1
- package/dist/impact/call-compatibility.js +310 -516
- package/dist/impact/call-compatibility.js.map +1 -1
- package/dist/impact/map.js +1 -0
- package/dist/impact/map.js.map +1 -1
- package/dist/impact/reference-cache.d.ts.map +1 -1
- package/dist/impact/reference-cache.js +2 -2
- package/dist/impact/reference-cache.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/indexer/ambiguous-resolution.d.ts +11 -0
- package/dist/indexer/ambiguous-resolution.d.ts.map +1 -0
- package/dist/indexer/ambiguous-resolution.js +19 -0
- package/dist/indexer/ambiguous-resolution.js.map +1 -0
- package/dist/indexer/build-cache/module-cache.d.ts +38 -0
- package/dist/indexer/build-cache/module-cache.d.ts.map +1 -1
- package/dist/indexer/build-cache/module-cache.js +151 -9
- package/dist/indexer/build-cache/module-cache.js.map +1 -1
- package/dist/indexer/build-cache/options.d.ts +16 -43
- package/dist/indexer/build-cache/options.d.ts.map +1 -1
- package/dist/indexer/build-cache/options.js +16 -43
- package/dist/indexer/build-cache/options.js.map +1 -1
- package/dist/indexer/build-cache/project-snapshot.d.ts +1 -0
- package/dist/indexer/build-cache/project-snapshot.d.ts.map +1 -1
- package/dist/indexer/build-cache/project-snapshot.js +117 -24
- package/dist/indexer/build-cache/project-snapshot.js.map +1 -1
- package/dist/indexer/build-cache/resolver-environment.d.ts.map +1 -1
- package/dist/indexer/build-cache/resolver-environment.js +32 -2
- package/dist/indexer/build-cache/resolver-environment.js.map +1 -1
- package/dist/indexer/build-cache.d.ts +1 -1
- package/dist/indexer/build-cache.d.ts.map +1 -1
- package/dist/indexer/build-cache.js +1 -1
- package/dist/indexer/build-cache.js.map +1 -1
- package/dist/indexer/build-index.d.ts.map +1 -1
- package/dist/indexer/build-index.js +593 -22
- package/dist/indexer/build-index.js.map +1 -1
- package/dist/indexer/call-hierarchy.js +1 -1
- package/dist/indexer/call-hierarchy.js.map +1 -1
- package/dist/indexer/compilation-units.d.ts +101 -0
- package/dist/indexer/compilation-units.d.ts.map +1 -0
- package/dist/indexer/compilation-units.js +605 -0
- package/dist/indexer/compilation-units.js.map +1 -0
- package/dist/indexer/cpp-callables.d.ts +20 -0
- package/dist/indexer/cpp-callables.d.ts.map +1 -0
- package/dist/indexer/cpp-callables.js +554 -0
- package/dist/indexer/cpp-callables.js.map +1 -0
- package/dist/indexer/declaration-visibility.d.ts +36 -2
- package/dist/indexer/declaration-visibility.d.ts.map +1 -1
- package/dist/indexer/declaration-visibility.js +136 -2
- package/dist/indexer/declaration-visibility.js.map +1 -1
- package/dist/indexer/expand-star-imports.d.ts.map +1 -1
- package/dist/indexer/expand-star-imports.js +28 -6
- package/dist/indexer/expand-star-imports.js.map +1 -1
- package/dist/indexer/import-types.d.ts +37 -0
- package/dist/indexer/import-types.d.ts.map +1 -1
- package/dist/indexer/import-types.js +24 -1
- package/dist/indexer/import-types.js.map +1 -1
- package/dist/indexer/imports/context.d.ts +11 -1
- package/dist/indexer/imports/context.d.ts.map +1 -1
- package/dist/indexer/imports/import-binding-tables.d.ts +12 -1
- package/dist/indexer/imports/import-binding-tables.d.ts.map +1 -1
- package/dist/indexer/imports/import-binding-tables.js +144 -19
- package/dist/indexer/imports/import-binding-tables.js.map +1 -1
- package/dist/indexer/imports/js-text-imports.js +4 -4
- package/dist/indexer/imports/js-text-imports.js.map +1 -1
- package/dist/indexer/imports/native-captures.d.ts.map +1 -1
- package/dist/indexer/imports/native-captures.js +18 -6
- package/dist/indexer/imports/native-captures.js.map +1 -1
- package/dist/indexer/imports/python.d.ts +10 -2
- package/dist/indexer/imports/python.d.ts.map +1 -1
- package/dist/indexer/imports/python.js +91 -40
- package/dist/indexer/imports/python.js.map +1 -1
- package/dist/indexer/imports/text-import-extractors.d.ts.map +1 -1
- package/dist/indexer/imports/text-import-extractors.js +51 -12
- package/dist/indexer/imports/text-import-extractors.js.map +1 -1
- package/dist/indexer/imports.d.ts.map +1 -1
- package/dist/indexer/imports.js +23 -4
- package/dist/indexer/imports.js.map +1 -1
- package/dist/indexer/incremental-plan.d.ts +33 -0
- package/dist/indexer/incremental-plan.d.ts.map +1 -1
- package/dist/indexer/incremental-plan.js +187 -1
- package/dist/indexer/incremental-plan.js.map +1 -1
- package/dist/indexer/locals-and-exports.d.ts +2 -0
- package/dist/indexer/locals-and-exports.d.ts.map +1 -1
- package/dist/indexer/locals-and-exports.js +565 -54
- package/dist/indexer/locals-and-exports.js.map +1 -1
- package/dist/indexer/name-lookup-policies/c-family.d.ts +7 -0
- package/dist/indexer/name-lookup-policies/c-family.d.ts.map +1 -0
- package/dist/indexer/name-lookup-policies/c-family.js +117 -0
- package/dist/indexer/name-lookup-policies/c-family.js.map +1 -0
- package/dist/indexer/name-lookup-policies/csharp-using-static.d.ts +11 -0
- package/dist/indexer/name-lookup-policies/csharp-using-static.d.ts.map +1 -0
- package/dist/indexer/name-lookup-policies/csharp-using-static.js +136 -0
- package/dist/indexer/name-lookup-policies/csharp-using-static.js.map +1 -0
- package/dist/indexer/name-lookup-policies/implicit-self.d.ts +10 -0
- package/dist/indexer/name-lookup-policies/implicit-self.d.ts.map +1 -0
- package/dist/indexer/name-lookup-policies/implicit-self.js +113 -0
- package/dist/indexer/name-lookup-policies/implicit-self.js.map +1 -0
- package/dist/indexer/name-lookup-policies/index.d.ts +3 -0
- package/dist/indexer/name-lookup-policies/index.d.ts.map +1 -0
- package/dist/indexer/name-lookup-policies/index.js +106 -0
- package/dist/indexer/name-lookup-policies/index.js.map +1 -0
- package/dist/indexer/name-lookup-policies/php.d.ts +3 -0
- package/dist/indexer/name-lookup-policies/php.d.ts.map +1 -0
- package/dist/indexer/name-lookup-policies/php.js +75 -0
- package/dist/indexer/name-lookup-policies/php.js.map +1 -0
- package/dist/indexer/name-resolution-types.d.ts +99 -0
- package/dist/indexer/name-resolution-types.d.ts.map +1 -0
- package/dist/indexer/name-resolution-types.js +2 -0
- package/dist/indexer/name-resolution-types.js.map +1 -0
- package/dist/indexer/name-resolution.d.ts +52 -0
- package/dist/indexer/name-resolution.d.ts.map +1 -0
- package/dist/indexer/name-resolution.js +189 -0
- package/dist/indexer/name-resolution.js.map +1 -0
- package/dist/indexer/navigation-cpp.d.ts +50 -0
- package/dist/indexer/navigation-cpp.d.ts.map +1 -0
- package/dist/indexer/navigation-cpp.js +654 -0
- package/dist/indexer/navigation-cpp.js.map +1 -0
- package/dist/indexer/navigation-goto.d.ts +106 -3
- package/dist/indexer/navigation-goto.d.ts.map +1 -1
- package/dist/indexer/navigation-goto.js +2074 -137
- package/dist/indexer/navigation-goto.js.map +1 -1
- package/dist/indexer/navigation-local.d.ts +18 -2
- package/dist/indexer/navigation-local.d.ts.map +1 -1
- package/dist/indexer/navigation-local.js +498 -61
- package/dist/indexer/navigation-local.js.map +1 -1
- package/dist/indexer/navigation-php.d.ts +66 -0
- package/dist/indexer/navigation-php.d.ts.map +1 -1
- package/dist/indexer/navigation-php.js +287 -4
- package/dist/indexer/navigation-php.js.map +1 -1
- package/dist/indexer/navigation-references.d.ts +72 -5
- package/dist/indexer/navigation-references.d.ts.map +1 -1
- package/dist/indexer/navigation-references.js +620 -54
- package/dist/indexer/navigation-references.js.map +1 -1
- package/dist/indexer/navigation-resolve.d.ts +33 -2
- package/dist/indexer/navigation-resolve.d.ts.map +1 -1
- package/dist/indexer/navigation-resolve.js +446 -193
- package/dist/indexer/navigation-resolve.js.map +1 -1
- package/dist/indexer/navigation.d.ts +28 -2
- package/dist/indexer/navigation.d.ts.map +1 -1
- package/dist/indexer/navigation.js +1082 -151
- package/dist/indexer/navigation.js.map +1 -1
- package/dist/indexer/php-namespace-symbols.d.ts +66 -0
- package/dist/indexer/php-namespace-symbols.d.ts.map +1 -0
- package/dist/indexer/php-namespace-symbols.js +342 -0
- package/dist/indexer/php-namespace-symbols.js.map +1 -0
- package/dist/indexer/reference-context.d.ts +2 -0
- package/dist/indexer/reference-context.d.ts.map +1 -1
- package/dist/indexer/reference-context.js +4 -0
- package/dist/indexer/reference-context.js.map +1 -1
- package/dist/indexer/scope-nodes.d.ts +92 -13
- package/dist/indexer/scope-nodes.d.ts.map +1 -1
- package/dist/indexer/scope-nodes.js +212 -20
- package/dist/indexer/scope-nodes.js.map +1 -1
- package/dist/indexer/scope-types.d.ts +25 -1
- package/dist/indexer/scope-types.d.ts.map +1 -1
- package/dist/indexer/scope.d.ts.map +1 -1
- package/dist/indexer/scope.js +894 -45
- package/dist/indexer/scope.js.map +1 -1
- package/dist/indexer/shared-owner-identity.d.ts +53 -0
- package/dist/indexer/shared-owner-identity.d.ts.map +1 -0
- package/dist/indexer/shared-owner-identity.js +460 -0
- package/dist/indexer/shared-owner-identity.js.map +1 -0
- package/dist/indexer/shared.d.ts +1 -1
- package/dist/indexer/shared.d.ts.map +1 -1
- package/dist/indexer/shared.js +1 -1
- package/dist/indexer/shared.js.map +1 -1
- package/dist/indexer/star-import-precedence.d.ts +114 -0
- package/dist/indexer/star-import-precedence.d.ts.map +1 -0
- package/dist/indexer/star-import-precedence.js +396 -0
- package/dist/indexer/star-import-precedence.js.map +1 -0
- package/dist/indexer/symbols.d.ts +3 -1
- package/dist/indexer/symbols.d.ts.map +1 -1
- package/dist/indexer/symbols.js +58 -18
- package/dist/indexer/symbols.js.map +1 -1
- package/dist/indexer/ts-callables.d.ts +51 -0
- package/dist/indexer/ts-callables.d.ts.map +1 -0
- package/dist/indexer/ts-callables.js +264 -0
- package/dist/indexer/ts-callables.js.map +1 -0
- package/dist/indexer/types.d.ts +23 -1
- package/dist/indexer/types.d.ts.map +1 -1
- package/dist/indexer/unused-exports.d.ts +13 -0
- package/dist/indexer/unused-exports.d.ts.map +1 -0
- package/dist/indexer/unused-exports.js +159 -0
- package/dist/indexer/unused-exports.js.map +1 -0
- package/dist/indexer/workspace-symbols.d.ts.map +1 -1
- package/dist/indexer/workspace-symbols.js +3 -2
- package/dist/indexer/workspace-symbols.js.map +1 -1
- package/dist/indexer.d.ts +2 -2
- package/dist/indexer.d.ts.map +1 -1
- package/dist/indexer.js +1 -1
- package/dist/indexer.js.map +1 -1
- package/dist/languages/callable-arity.d.ts +202 -0
- package/dist/languages/callable-arity.d.ts.map +1 -0
- package/dist/languages/callable-arity.js +1182 -0
- package/dist/languages/callable-arity.js.map +1 -0
- package/dist/languages/definitions/c-family.d.ts.map +1 -1
- package/dist/languages/definitions/c-family.js +30 -1
- package/dist/languages/definitions/c-family.js.map +1 -1
- package/dist/languages/definitions/c.d.ts +4 -0
- package/dist/languages/definitions/c.d.ts.map +1 -1
- package/dist/languages/definitions/c.js +19 -0
- package/dist/languages/definitions/c.js.map +1 -1
- package/dist/languages/definitions/cpp.d.ts.map +1 -1
- package/dist/languages/definitions/cpp.js +12 -0
- package/dist/languages/definitions/cpp.js.map +1 -1
- package/dist/languages/definitions/csharp.d.ts.map +1 -1
- package/dist/languages/definitions/csharp.js +2 -8
- package/dist/languages/definitions/csharp.js.map +1 -1
- package/dist/languages/definitions/go.d.ts.map +1 -1
- package/dist/languages/definitions/go.js +3 -0
- package/dist/languages/definitions/go.js.map +1 -1
- package/dist/languages/definitions/javascript.d.ts.map +1 -1
- package/dist/languages/definitions/javascript.js +10 -1
- package/dist/languages/definitions/javascript.js.map +1 -1
- package/dist/languages/definitions/js-family.d.ts +1 -1
- package/dist/languages/definitions/js-family.d.ts.map +1 -1
- package/dist/languages/definitions/js-family.js +7 -1
- package/dist/languages/definitions/js-family.js.map +1 -1
- package/dist/languages/definitions/php.d.ts.map +1 -1
- package/dist/languages/definitions/php.js +5 -1
- package/dist/languages/definitions/php.js.map +1 -1
- package/dist/languages/definitions/typescript.d.ts.map +1 -1
- package/dist/languages/definitions/typescript.js +8 -1
- package/dist/languages/definitions/typescript.js.map +1 -1
- package/dist/languages/definitions/zig.d.ts.map +1 -1
- package/dist/languages/definitions/zig.js +2 -0
- package/dist/languages/definitions/zig.js.map +1 -1
- package/dist/mcp/handlers.js +14 -7
- package/dist/mcp/handlers.js.map +1 -1
- package/dist/review/candidates.d.ts.map +1 -1
- package/dist/review/candidates.js +1 -1
- package/dist/review/candidates.js.map +1 -1
- package/dist/review/deleted.d.ts +3 -3
- package/dist/review/deleted.d.ts.map +1 -1
- package/dist/review/deleted.js +82 -32
- package/dist/review/deleted.js.map +1 -1
- package/dist/review/report.d.ts +1 -0
- package/dist/review/report.d.ts.map +1 -1
- package/dist/review/report.js +1 -1
- package/dist/review/report.js.map +1 -1
- package/dist/review.d.ts.map +1 -1
- package/dist/review.js +1 -0
- package/dist/review.js.map +1 -1
- package/dist/sql/navigation.d.ts.map +1 -1
- package/dist/sql/navigation.js +1 -0
- package/dist/sql/navigation.js.map +1 -1
- package/dist/sql/source-graph.d.ts.map +1 -1
- package/dist/sql/source-graph.js +2 -2
- package/dist/sql/source-graph.js.map +1 -1
- package/dist/sqlite/schema.d.ts +1 -1
- package/dist/sqlite/schema.d.ts.map +1 -1
- package/dist/sqlite/schema.js +8 -2
- package/dist/sqlite/schema.js.map +1 -1
- package/dist/sqlite/write.js +2 -2
- package/dist/sqlite/write.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/util/bloom-filter.d.ts +7 -1
- package/dist/util/bloom-filter.d.ts.map +1 -1
- package/dist/util/bloom-filter.js +12 -2
- package/dist/util/bloom-filter.js.map +1 -1
- package/dist/util/graph-edges.d.ts +19 -1
- package/dist/util/graph-edges.d.ts.map +1 -1
- package/dist/util/graph-edges.js +30 -4
- package/dist/util/graph-edges.js.map +1 -1
- package/dist/util/identifiers.d.ts +15 -0
- package/dist/util/identifiers.d.ts.map +1 -1
- package/dist/util/identifiers.js +35 -0
- package/dist/util/identifiers.js.map +1 -1
- package/dist/util/member-access-tables.d.ts +61 -4
- package/dist/util/member-access-tables.d.ts.map +1 -1
- package/dist/util/member-access-tables.js +137 -19
- package/dist/util/member-access-tables.js.map +1 -1
- package/dist/util/member-access.d.ts +17 -0
- package/dist/util/member-access.d.ts.map +1 -1
- package/dist/util/member-access.js +95 -3
- package/dist/util/member-access.js.map +1 -1
- package/dist/util/resolution/cargo-targets.d.ts +11 -0
- package/dist/util/resolution/cargo-targets.d.ts.map +1 -1
- package/dist/util/resolution/cargo-targets.js +174 -13
- package/dist/util/resolution/cargo-targets.js.map +1 -1
- package/dist/util/resolution/csharp.d.ts +33 -1
- package/dist/util/resolution/csharp.d.ts.map +1 -1
- package/dist/util/resolution/csharp.js +145 -30
- package/dist/util/resolution/csharp.js.map +1 -1
- package/dist/util/resolution/php.d.ts.map +1 -1
- package/dist/util/resolution/php.js +35 -8
- package/dist/util/resolution/php.js.map +1 -1
- package/dist/util/resolution/python.d.ts +9 -0
- package/dist/util/resolution/python.d.ts.map +1 -1
- package/dist/util/resolution/python.js +46 -0
- package/dist/util/resolution/python.js.map +1 -1
- package/dist/util/resolution/rust.d.ts.map +1 -1
- package/dist/util/resolution/rust.js +95 -26
- package/dist/util/resolution/rust.js.map +1 -1
- package/dist/util/resolution-candidates.d.ts +5 -0
- package/dist/util/resolution-candidates.d.ts.map +1 -1
- package/dist/util/resolution-candidates.js +16 -3
- package/dist/util/resolution-candidates.js.map +1 -1
- package/dist/util/resolution.d.ts +2 -1
- package/dist/util/resolution.d.ts.map +1 -1
- package/dist/util/resolution.js +96 -5
- package/dist/util/resolution.js.map +1 -1
- package/dist/util/specifiers.d.ts +20 -0
- package/dist/util/specifiers.d.ts.map +1 -1
- package/dist/util/specifiers.js +29 -0
- package/dist/util/specifiers.js.map +1 -1
- package/docs/mcp.md +3 -2
- package/package.json +3 -3
- package/dist/impact/call-compatibility/providers/profiles.d.ts +0 -80
- package/dist/impact/call-compatibility/providers/profiles.d.ts.map +0 -1
- package/dist/impact/call-compatibility/providers/profiles.js +0 -164
- package/dist/impact/call-compatibility/providers/profiles.js.map +0 -1
|
@@ -1,19 +1,108 @@
|
|
|
1
|
+
import { getCallArgumentCount } from "../languages/callable-arity.js";
|
|
1
2
|
import { fileIdentityKey, normalizePath } from "../util/paths.js";
|
|
2
3
|
import { okGoToResult } from "./navigation-provenance.js";
|
|
4
|
+
import { cppBindingCallableShape, cppSelectCallableBinding } from "./cpp-callables.js";
|
|
5
|
+
import { typescriptCallableCandidatesInContainer, typescriptSelectOverloadCandidate } from "./ts-callables.js";
|
|
6
|
+
import { cScopeName, cTagRole } from "../languages/definitions/c.js";
|
|
7
|
+
import { bindingCoversUse, fileScopeDefinitionCoversUse, isExplicitMethodCall, laterLocalBlocksOuterUse, scopeAllowsUse, scopeIdentifierKey, scopeNodesFor, closestContainingScope, } from "./scope-nodes.js";
|
|
3
8
|
import { buildScopeIndexFromSource } from "./scope.js";
|
|
4
|
-
import { resolveExport, resolveImported } from "./navigation-resolve.js";
|
|
5
|
-
import {
|
|
9
|
+
import { cjsRequireValueBinding, resolveExport, resolveImported } from "./navigation-resolve.js";
|
|
10
|
+
import { phpNamedImportRole } from "./import-types.js";
|
|
11
|
+
import { resolvePhpExplicitImport } from "./php-namespace-symbols.js";
|
|
12
|
+
import { AMBIGUOUS_STAR_IMPORT_REASON } from "./ambiguous-resolution.js";
|
|
13
|
+
import { decideStarImportCandidates, effectiveExplicitOrLocalBinding, isExpandedStarBinding, resolveStarImportedDefinition, starImportPrecedence, } from "./star-import-precedence.js";
|
|
14
|
+
import { SymbolKind, } from "./types.js";
|
|
15
|
+
/** Follow a C# name token through generic arguments and qualified-name segments. */
|
|
16
|
+
export function csharpQualifiedNameNode(node) {
|
|
17
|
+
let qualified = node;
|
|
18
|
+
while (qualified.parent) {
|
|
19
|
+
const parent = qualified.parent;
|
|
20
|
+
if (parent.type === "generic_name") {
|
|
21
|
+
const name = parent.childForFieldName("name") ?? parent.namedChildren[0];
|
|
22
|
+
if (name && name.startIndex === qualified.startIndex && name.endIndex === qualified.endIndex) {
|
|
23
|
+
qualified = parent;
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if ((parent.type === "qualified_name" || parent.type === "alias_qualified_name") &&
|
|
28
|
+
parent.endIndex === qualified.endIndex) {
|
|
29
|
+
qualified = parent;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
return qualified.type === "qualified_name" || qualified.type === "alias_qualified_name" ? qualified : null;
|
|
35
|
+
}
|
|
36
|
+
/** Preserve the full C# namespace or alias path, excluding generic type arguments. */
|
|
37
|
+
export function csharpLookupName(node, source, fallback) {
|
|
38
|
+
const qualified = csharpQualifiedNameNode(node);
|
|
39
|
+
if (!qualified)
|
|
40
|
+
return fallback;
|
|
41
|
+
const text = source.slice(qualified.startIndex, qualified.endIndex);
|
|
42
|
+
if (!text.includes("<"))
|
|
43
|
+
return text.replace(/\s+/gu, "");
|
|
44
|
+
const argumentsNodes = [];
|
|
45
|
+
const collect = (current) => {
|
|
46
|
+
if (current.type === "generic_name") {
|
|
47
|
+
const argumentsNode = (current.namedChildren ?? []).find((child) => child.type === "type_argument_list");
|
|
48
|
+
if (argumentsNode)
|
|
49
|
+
argumentsNodes.push(argumentsNode);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
for (const child of current.namedChildren ?? []) {
|
|
53
|
+
if (child.type === "generic_name" || child.type === "qualified_name" || child.type === "alias_qualified_name") {
|
|
54
|
+
collect(child);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
collect(qualified);
|
|
59
|
+
let result = "";
|
|
60
|
+
let from = qualified.startIndex;
|
|
61
|
+
for (const argumentsNode of argumentsNodes) {
|
|
62
|
+
result += source.slice(from, argumentsNode.startIndex);
|
|
63
|
+
from = argumentsNode.endIndex;
|
|
64
|
+
}
|
|
65
|
+
return (result + source.slice(from, qualified.endIndex)).replace(/\s+/gu, "");
|
|
66
|
+
}
|
|
67
|
+
const FALLBACK_DECLARATION_TYPES = new Set([
|
|
68
|
+
"function_declaration",
|
|
69
|
+
"class_declaration",
|
|
70
|
+
"variable_declarator",
|
|
71
|
+
"interface_declaration",
|
|
72
|
+
"type_alias_declaration",
|
|
73
|
+
"function_definition",
|
|
74
|
+
"class_definition",
|
|
75
|
+
"assignment",
|
|
76
|
+
]);
|
|
77
|
+
const FALLBACK_CLASS_TYPES = new Set(["class_declaration", "class_definition"]);
|
|
78
|
+
/** Ordinary JavaScript functions rebind `this`; arrow functions and class methods do not. */
|
|
79
|
+
const DYNAMIC_THIS_FUNCTION_TYPES = new Set([
|
|
80
|
+
"function_declaration",
|
|
81
|
+
"function_expression",
|
|
82
|
+
"function",
|
|
83
|
+
"generator_function",
|
|
84
|
+
"generator_function_declaration",
|
|
85
|
+
]);
|
|
86
|
+
/**
|
|
87
|
+
* The declared name for a position on a declaration's own header (its keywords, name, or the
|
|
88
|
+
* space between them), and the enclosing class name for a JavaScript/TypeScript `this` whose
|
|
89
|
+
* value is lexically that class (not inside an ordinary nested function).
|
|
90
|
+
*
|
|
91
|
+
* A position inside the body or initializer is a use, not the declaration: `trim` in
|
|
92
|
+
* `const handle = value?.trim()` must never resolve to `handle`.
|
|
93
|
+
*/
|
|
6
94
|
export function findDeclarationNameNode(sup, currentNode) {
|
|
95
|
+
if (!currentNode)
|
|
96
|
+
return null;
|
|
97
|
+
const isThis = currentNode.type === "this";
|
|
7
98
|
let current = currentNode;
|
|
8
99
|
while (current) {
|
|
9
|
-
if (current
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
current.type === "class_definition" ||
|
|
16
|
-
current.type === "assignment") {
|
|
100
|
+
if (isThis && current !== currentNode && DYNAMIC_THIS_FUNCTION_TYPES.has(current.type))
|
|
101
|
+
return null;
|
|
102
|
+
// An object-literal method binds `this` to that object, not to the enclosing class.
|
|
103
|
+
if (isThis && current.type === "method_definition" && current.parent?.type !== "class_body")
|
|
104
|
+
return null;
|
|
105
|
+
if (FALLBACK_DECLARATION_TYPES.has(current.type)) {
|
|
17
106
|
let named = current.childForFieldName("name");
|
|
18
107
|
if (!named && current.type === "assignment") {
|
|
19
108
|
const left = current.child(0);
|
|
@@ -21,7 +110,13 @@ export function findDeclarationNameNode(sup, currentNode) {
|
|
|
21
110
|
named = left;
|
|
22
111
|
}
|
|
23
112
|
}
|
|
24
|
-
|
|
113
|
+
const tail = current.childForFieldName("body") ??
|
|
114
|
+
current.childForFieldName("value") ??
|
|
115
|
+
(current.type === "assignment" ? current.childForFieldName("right") : null);
|
|
116
|
+
const headerEnd = tail ? tail.startIndex : current.endIndex;
|
|
117
|
+
const onHeader = currentNode === current || currentNode.endIndex <= headerEnd;
|
|
118
|
+
const ownClass = isThis && FALLBACK_CLASS_TYPES.has(current.type);
|
|
119
|
+
if (named && sup.nodeTypes.identifier.includes(named.type) && (onHeader || ownClass)) {
|
|
25
120
|
return named;
|
|
26
121
|
}
|
|
27
122
|
}
|
|
@@ -38,37 +133,171 @@ export function getOrBuildScopeIndex(index, file, source, sup, mod, tree) {
|
|
|
38
133
|
index.scopeCache.set(fileKey, scopeIndex);
|
|
39
134
|
return scopeIndex;
|
|
40
135
|
}
|
|
136
|
+
/** Python function bodies resolve module names when called, after module initialization. */
|
|
137
|
+
function pythonModuleLookupUsesRuntimeBindings(scope, node) {
|
|
138
|
+
for (let current = scope; current; current = current.parent) {
|
|
139
|
+
if (current.kind !== "function")
|
|
140
|
+
continue;
|
|
141
|
+
const body = current.node.childForFieldName("body");
|
|
142
|
+
if (!body)
|
|
143
|
+
return false;
|
|
144
|
+
return node.startIndex >= body.startIndex && node.endIndex <= body.endIndex;
|
|
145
|
+
}
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
function effectivePythonModuleScopeBinding(binding, useStartIndex, moduleLookupAtRuntime) {
|
|
149
|
+
let importBinding;
|
|
150
|
+
let importSource;
|
|
151
|
+
let localBinding;
|
|
152
|
+
let latestLocalStart = -1;
|
|
153
|
+
for (let candidate = binding; candidate; candidate = candidate.earlierSameScope) {
|
|
154
|
+
const localStart = candidate.def?.start.index;
|
|
155
|
+
if (localStart !== undefined &&
|
|
156
|
+
(moduleLookupAtRuntime || localStart <= useStartIndex) &&
|
|
157
|
+
localStart > latestLocalStart) {
|
|
158
|
+
localBinding = candidate;
|
|
159
|
+
latestLocalStart = localStart;
|
|
160
|
+
}
|
|
161
|
+
if (!importBinding && candidate.import) {
|
|
162
|
+
importBinding = candidate.import;
|
|
163
|
+
importSource = candidate;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const imports = importBinding ? [importBinding] : [];
|
|
167
|
+
const effective = effectiveExplicitOrLocalBinding(imports, "python", () => true, localBinding?.def?.start.index, useStartIndex, moduleLookupAtRuntime);
|
|
168
|
+
if (effective?.kind === "local")
|
|
169
|
+
return localBinding ?? null;
|
|
170
|
+
if (effective?.kind === "explicit")
|
|
171
|
+
return importSource ?? null;
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
41
174
|
export function findClosestScopeBinding(scopeIndex, bindingName, currentNode, support) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
scope.node.endIndex <= best.node.endIndex) {
|
|
55
|
-
best = scope;
|
|
56
|
-
}
|
|
175
|
+
if (support.id === "csharp" && bindingName.includes(".")) {
|
|
176
|
+
const names = bindingName.split(".");
|
|
177
|
+
const first = names.shift();
|
|
178
|
+
let owner = findClosestScopeBinding(scopeIndex, first, currentNode, support);
|
|
179
|
+
for (const name of names) {
|
|
180
|
+
if (owner?.kind !== "class")
|
|
181
|
+
return null;
|
|
182
|
+
const body = owner.node?.parent?.childForFieldName("body");
|
|
183
|
+
if (!body)
|
|
184
|
+
return null;
|
|
185
|
+
const bodyScope = scopeIndex.allScopes.find((scope) => scope.node.id === body.id);
|
|
186
|
+
owner = bodyScope?.map.get(support.normalizeIdentifier(name)) ?? null;
|
|
57
187
|
}
|
|
58
|
-
|
|
188
|
+
return owner;
|
|
59
189
|
}
|
|
190
|
+
const row = scopeNodesFor(support.id);
|
|
191
|
+
const canonicalName = scopeIdentifierKey(row, bindingName, currentNode, support.normalizeIdentifier);
|
|
192
|
+
const normalizedName = support.id === "c" && cTagRole(currentNode) ? cScopeName(canonicalName, "tag") : canonicalName;
|
|
193
|
+
let currentScope = closestContainingScope(scopeIndex, currentNode);
|
|
194
|
+
const methodCall = isExplicitMethodCall(row, currentNode);
|
|
195
|
+
const pythonModuleLookupAtRuntime = !!row.moduleBindingsAtFunctionRuntime && pythonModuleLookupUsesRuntimeBindings(currentScope, currentNode);
|
|
60
196
|
while (currentScope) {
|
|
61
|
-
|
|
197
|
+
if (!scopeAllowsUse(row, currentScope, currentNode)) {
|
|
198
|
+
currentScope = currentScope.parent;
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
let binding = currentScope.map.get(normalizedName);
|
|
202
|
+
if (!pythonModuleLookupAtRuntime || currentScope.kind !== "module" || methodCall) {
|
|
203
|
+
while (binding &&
|
|
204
|
+
((methodCall && binding.kind === "local") ||
|
|
205
|
+
((!pythonModuleLookupAtRuntime || currentScope.kind !== "module") &&
|
|
206
|
+
!bindingCoversUse(row, currentScope.kind, binding, currentNode.startIndex)))) {
|
|
207
|
+
binding = binding.earlierSameScope;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (support.id === "python" && currentScope.kind === "module" && binding) {
|
|
211
|
+
const effectiveBinding = effectivePythonModuleScopeBinding(binding, currentNode.startIndex, pythonModuleLookupAtRuntime);
|
|
212
|
+
if (effectiveBinding)
|
|
213
|
+
return effectiveBinding;
|
|
214
|
+
currentScope = currentScope.parent;
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
62
217
|
if (binding)
|
|
63
218
|
return binding;
|
|
219
|
+
if (laterLocalBlocksOuterUse(row, currentScope, normalizedName, currentNode.startIndex))
|
|
220
|
+
return null;
|
|
64
221
|
currentScope = currentScope.parent;
|
|
65
222
|
}
|
|
66
223
|
return null;
|
|
67
224
|
}
|
|
68
|
-
|
|
225
|
+
/** A later C# local makes an earlier use invalid rather than binding to an outer member. */
|
|
226
|
+
export function laterLocalShadowsUse(scopeIndex, bindingName, currentNode, support) {
|
|
227
|
+
const row = scopeNodesFor(support.id);
|
|
228
|
+
if (!row.laterLocalBlocksOuterKinds)
|
|
229
|
+
return false;
|
|
230
|
+
const canonicalName = scopeIdentifierKey(row, bindingName, currentNode, support.normalizeIdentifier);
|
|
231
|
+
let scope = closestContainingScope(scopeIndex, currentNode);
|
|
232
|
+
while (scope) {
|
|
233
|
+
if (!scopeAllowsUse(row, scope, currentNode)) {
|
|
234
|
+
scope = scope.parent;
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
if (laterLocalBlocksOuterUse(row, scope, canonicalName, currentNode.startIndex))
|
|
238
|
+
return true;
|
|
239
|
+
let binding = scope.map.get(canonicalName);
|
|
240
|
+
while (binding && !bindingCoversUse(row, scope.kind, binding, currentNode.startIndex)) {
|
|
241
|
+
binding = binding.earlierSameScope;
|
|
242
|
+
}
|
|
243
|
+
if (binding)
|
|
244
|
+
return false;
|
|
245
|
+
scope = scope.parent;
|
|
246
|
+
}
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
function selectTypeScriptOverloadBinding(binding, file, currentNode, source, tree, languageId) {
|
|
250
|
+
const call = currentNode.parent;
|
|
251
|
+
if (!call || call.type !== "call_expression")
|
|
252
|
+
return binding;
|
|
253
|
+
const start = binding.def.start.index ?? 0;
|
|
254
|
+
const end = binding.def.end.index ?? start;
|
|
255
|
+
const candidates = typescriptCallableCandidatesInContainer(binding.sameScopeFunctionBindings ?? [binding], tree, (candidate) => candidate.def, start, end);
|
|
256
|
+
const selected = typescriptSelectOverloadCandidate({
|
|
257
|
+
group: candidates,
|
|
258
|
+
tree,
|
|
259
|
+
definitionOf: (candidate) => ({
|
|
260
|
+
file,
|
|
261
|
+
localName: candidate.name,
|
|
262
|
+
kind: SymbolKind.Function,
|
|
263
|
+
range: candidate.def,
|
|
264
|
+
}),
|
|
265
|
+
declarationOf: (candidate) => candidate.node?.parent,
|
|
266
|
+
source,
|
|
267
|
+
languageId,
|
|
268
|
+
argumentCount: getCallArgumentCount({ languageId, source, call }),
|
|
269
|
+
});
|
|
270
|
+
return selected ?? null;
|
|
271
|
+
}
|
|
272
|
+
export function findClosestBinding(scopeIndex, file, bindingName, currentNode, support, source, tree) {
|
|
69
273
|
const binding = findClosestScopeBinding(scopeIndex, bindingName, currentNode, support);
|
|
70
|
-
|
|
274
|
+
return binding ? definitionForBinding(binding, file, currentNode, support, source, tree) : null;
|
|
275
|
+
}
|
|
276
|
+
/** The definition a scope binding names at a use, choosing C++ and TypeScript overloads by arity. */
|
|
277
|
+
export function definitionForBinding(closest, file, currentNode, support, source, tree) {
|
|
278
|
+
let binding = closest;
|
|
279
|
+
if (!binding.def)
|
|
71
280
|
return null;
|
|
281
|
+
if (support.id === "cpp" && binding.kind === "function" && source) {
|
|
282
|
+
const collisions = binding.sameScopeFunctionBindings ?? [binding];
|
|
283
|
+
if (collisions.length > 1 || cppBindingCallableShape(binding)) {
|
|
284
|
+
const selected = cppSelectCallableBinding(collisions, currentNode, source, file, file);
|
|
285
|
+
if (!selected?.def)
|
|
286
|
+
return null;
|
|
287
|
+
return {
|
|
288
|
+
file,
|
|
289
|
+
localName: selected.name,
|
|
290
|
+
kind: SymbolKind.Function,
|
|
291
|
+
range: selected.def,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if ((support.id === "ts" || support.id === "tsx") && binding.kind === "function" && source && tree) {
|
|
296
|
+
const selected = selectTypeScriptOverloadBinding(binding, file, currentNode, source, tree, support.id);
|
|
297
|
+
if (!selected?.def)
|
|
298
|
+
return null;
|
|
299
|
+
binding = selected;
|
|
300
|
+
}
|
|
72
301
|
let kind = SymbolKind.Variable;
|
|
73
302
|
if (binding.kind === "function") {
|
|
74
303
|
kind = SymbolKind.Function;
|
|
@@ -79,11 +308,16 @@ export function findClosestBinding(scopeIndex, file, bindingName, currentNode, s
|
|
|
79
308
|
else if (binding.kind === "type") {
|
|
80
309
|
kind = SymbolKind.TypeAlias;
|
|
81
310
|
}
|
|
311
|
+
const range = binding.def;
|
|
312
|
+
if (!range)
|
|
313
|
+
return null;
|
|
314
|
+
const tagRole = support.id === "c" && binding.node ? cTagRole(binding.node) : undefined;
|
|
82
315
|
return {
|
|
83
316
|
file,
|
|
84
317
|
localName: binding.name,
|
|
85
318
|
kind,
|
|
86
|
-
range
|
|
319
|
+
range,
|
|
320
|
+
...(tagRole ? { cTag: tagRole } : {}),
|
|
87
321
|
};
|
|
88
322
|
}
|
|
89
323
|
export function toModuleRef(resolved) {
|
|
@@ -91,25 +325,95 @@ export function toModuleRef(resolved) {
|
|
|
91
325
|
return undefined;
|
|
92
326
|
return typeof resolved === "string" ? resolved : resolved.external;
|
|
93
327
|
}
|
|
94
|
-
|
|
328
|
+
function importBindingCoversIndex(imp, index) {
|
|
329
|
+
const ranges = [];
|
|
330
|
+
if ((imp.kind === "named" || imp.kind === "default" || imp.kind === "namespace") && imp.localRange) {
|
|
331
|
+
ranges.push(imp.localRange);
|
|
332
|
+
}
|
|
333
|
+
if (imp.kind === "named" && imp.importedRange)
|
|
334
|
+
ranges.push(imp.importedRange);
|
|
335
|
+
return ranges.some((range) => {
|
|
336
|
+
const start = range.start.index;
|
|
337
|
+
const end = range.end.index;
|
|
338
|
+
return start !== undefined && end !== undefined && index >= start && index < end;
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
function starImportGoTo(index, imp, def, name) {
|
|
342
|
+
return okGoToResult(index, def, {
|
|
343
|
+
via: {
|
|
344
|
+
...(toModuleRef(imp.resolved) ? { importedFrom: toModuleRef(imp.resolved) } : {}),
|
|
345
|
+
exportedName: name,
|
|
346
|
+
},
|
|
347
|
+
resolution: "import-star",
|
|
348
|
+
confidence: "medium",
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
export function resolveNamedDefinition(index, mod, file, support, name, cNamespace, referenceIndex) {
|
|
95
352
|
const normalizedName = support.normalizeIdentifier(name);
|
|
96
353
|
const requiresExplicitReceiver = !support.membersAreImplicitlyInScope;
|
|
97
|
-
const directExport = requiresExplicitReceiver
|
|
354
|
+
const directExport = requiresExplicitReceiver && support.id !== "c"
|
|
98
355
|
? mod.exports.find((entry) => entry.type === "local" &&
|
|
99
356
|
support.normalizeIdentifier(entry.exportedAs) === normalizedName &&
|
|
100
357
|
!entry.target.isMember)
|
|
101
358
|
: undefined;
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
359
|
+
const suppressCppUnqualifiedLocalExport = support.id === "cpp" && !name.includes("::");
|
|
360
|
+
let hit = null;
|
|
361
|
+
const precedence = starImportPrecedence(support.id);
|
|
362
|
+
const matchesExplicitBinding = (imp) => {
|
|
363
|
+
if (isExpandedStarBinding(imp, mod.imports))
|
|
364
|
+
return false;
|
|
365
|
+
if (imp.kind === "default")
|
|
366
|
+
return support.normalizeIdentifier(imp.local) === normalizedName;
|
|
367
|
+
if (imp.kind === "named")
|
|
368
|
+
return !imp.cNamespace && support.normalizeIdentifier(imp.local) === normalizedName;
|
|
369
|
+
return imp.kind === "namespace" && support.normalizeIdentifier(imp.localNS) === normalizedName;
|
|
370
|
+
};
|
|
371
|
+
// Explicit-beats-star languages: an explicit import, then the compilation unit (Java and
|
|
372
|
+
// Kotlin same-package peers), then a wildcard. resolveExport's compilation-unit hit must wait
|
|
373
|
+
// until explicit imports have had a chance to win and must still beat star imports. In Rust a
|
|
374
|
+
// `use` and a same-named local item are a compile error, so the order changes nothing there.
|
|
375
|
+
const deferCompilationUnitPeers = precedence === "explicit-beats-star";
|
|
376
|
+
if (!suppressCppUnqualifiedLocalExport) {
|
|
377
|
+
if (directExport && directExport.type === "local") {
|
|
378
|
+
hit = { kind: "resolved", def: directExport.target };
|
|
379
|
+
}
|
|
380
|
+
else if (!deferCompilationUnitPeers) {
|
|
381
|
+
hit = resolveExport(index, file, name, {
|
|
382
|
+
allowLocalFallback: support.membersAreImplicitlyInScope,
|
|
383
|
+
...(cNamespace ? { cNamespace } : {}),
|
|
384
|
+
...(support.id === "csharp" && referenceIndex !== undefined ? { referenceIndex } : {}),
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
const row = scopeNodesFor(support.id);
|
|
389
|
+
const moduleLookupAtRuntime = !!row.moduleBindingsAtFunctionRuntime &&
|
|
390
|
+
hit?.kind === "resolved" &&
|
|
391
|
+
referenceIndex !== undefined &&
|
|
392
|
+
fileIdentityKey(file) === fileIdentityKey(hit.def.file) &&
|
|
393
|
+
!!index.scopeCache.get(fileIdentityKey(file))?.allScopes.some((scope) => {
|
|
394
|
+
if (scope.kind !== "function")
|
|
395
|
+
return false;
|
|
396
|
+
const body = scope.node.childForFieldName("body");
|
|
397
|
+
return !!body && referenceIndex >= body.startIndex && referenceIndex < body.endIndex;
|
|
110
398
|
});
|
|
399
|
+
const effectiveBinding = effectiveExplicitOrLocalBinding(mod.imports, support.id, matchesExplicitBinding, hit?.kind === "resolved" ? hit.def.range.start.index : undefined, referenceIndex, moduleLookupAtRuntime);
|
|
400
|
+
const effectiveExplicitImport = effectiveBinding?.kind === "explicit" ? effectiveBinding.binding : undefined;
|
|
401
|
+
if (hit?.kind === "resolved" && (!requiresExplicitReceiver || !hit.def.isMember)) {
|
|
402
|
+
const sameFileFallback = referenceIndex !== undefined && fileIdentityKey(file) === fileIdentityKey(hit.def.file);
|
|
403
|
+
if (sameFileFallback &&
|
|
404
|
+
!fileScopeDefinitionCoversUse(support.id, hit.def.range, referenceIndex, hit.def.kind, moduleLookupAtRuntime)) {
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
if (support.id !== "python" || effectiveBinding?.kind === "local") {
|
|
408
|
+
const importedFrom = support.id === "c" && fileIdentityKey(file) !== fileIdentityKey(hit.def.file) ? hit.def.file : undefined;
|
|
409
|
+
return okGoToResult(index, hit.def, {
|
|
410
|
+
via: { exportedName: name, ...(importedFrom ? { importedFrom } : {}) },
|
|
411
|
+
resolution: importedFrom ? "import" : "exact",
|
|
412
|
+
confidence: "high",
|
|
413
|
+
});
|
|
414
|
+
}
|
|
111
415
|
}
|
|
112
|
-
if (hit?.kind === "namespace") {
|
|
416
|
+
if (hit?.kind === "namespace" && effectiveBinding?.kind !== "explicit") {
|
|
113
417
|
const targetMod = index.byFile.get(fileIdentityKey(hit.file));
|
|
114
418
|
const firstExport = targetMod?.exports.find((entry) => entry.type === "local");
|
|
115
419
|
if (firstExport) {
|
|
@@ -120,11 +424,32 @@ export function resolveNamedDefinition(index, mod, file, support, name) {
|
|
|
120
424
|
});
|
|
121
425
|
}
|
|
122
426
|
}
|
|
427
|
+
const starCandidates = [];
|
|
428
|
+
let lastWinsResult = null;
|
|
429
|
+
const acceptBinding = (result, imp) => {
|
|
430
|
+
// A click on the binding's own token names that import, not a later rebinding.
|
|
431
|
+
if (precedence === "last-wins" && referenceIndex !== undefined && importBindingCoversIndex(imp, referenceIndex)) {
|
|
432
|
+
return result;
|
|
433
|
+
}
|
|
434
|
+
if (precedence === "last-wins") {
|
|
435
|
+
lastWinsResult = result;
|
|
436
|
+
return null;
|
|
437
|
+
}
|
|
438
|
+
return result;
|
|
439
|
+
};
|
|
123
440
|
for (const imp of mod.imports) {
|
|
441
|
+
// Star expansion republishes the same names. Judging those copies as explicit
|
|
442
|
+
// imports would hide a second star import behind the first expanded binding.
|
|
443
|
+
if (isExpandedStarBinding(imp, mod.imports))
|
|
444
|
+
continue;
|
|
445
|
+
const matchesExplicit = matchesExplicitBinding(imp);
|
|
446
|
+
if (matchesExplicit && effectiveExplicitImport !== imp)
|
|
447
|
+
continue;
|
|
448
|
+
let matched = null;
|
|
124
449
|
if (imp.kind === "default" && support.normalizeIdentifier(imp.local) === normalizedName) {
|
|
125
450
|
const result = resolveImported(index, imp, "default");
|
|
126
451
|
if (result && !("namespace" in result)) {
|
|
127
|
-
|
|
452
|
+
matched = okGoToResult(index, result, {
|
|
128
453
|
via: {
|
|
129
454
|
...(toModuleRef(imp.resolved) ? { importedFrom: toModuleRef(imp.resolved) } : {}),
|
|
130
455
|
exportedName: "default",
|
|
@@ -135,9 +460,26 @@ export function resolveNamedDefinition(index, mod, file, support, name) {
|
|
|
135
460
|
}
|
|
136
461
|
}
|
|
137
462
|
else if (imp.kind === "named" && support.normalizeIdentifier(imp.local) === normalizedName) {
|
|
138
|
-
const
|
|
463
|
+
const phpRole = phpNamedImportRole(imp);
|
|
464
|
+
let result;
|
|
465
|
+
if (phpRole) {
|
|
466
|
+
// This role-blind fallback cannot choose between PHP class, function, and constant aliases.
|
|
467
|
+
const hasPhpRoleCollision = mod.imports.some((candidate) => candidate !== imp &&
|
|
468
|
+
candidate.kind === "named" &&
|
|
469
|
+
phpNamedImportRole(candidate) !== undefined &&
|
|
470
|
+
support.normalizeIdentifier(candidate.local) === normalizedName);
|
|
471
|
+
if (hasPhpRoleCollision) {
|
|
472
|
+
result = null;
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
result = resolvePhpExplicitImport(index, imp, phpRole);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
result = resolveImported(index, imp, imp.imported, cNamespace ? { cNamespace } : undefined);
|
|
480
|
+
}
|
|
139
481
|
if (result && !("namespace" in result)) {
|
|
140
|
-
|
|
482
|
+
matched = okGoToResult(index, result, {
|
|
141
483
|
via: {
|
|
142
484
|
...(toModuleRef(imp.resolved) ? { importedFrom: toModuleRef(imp.resolved) } : {}),
|
|
143
485
|
exportedName: imp.imported,
|
|
@@ -148,32 +490,127 @@ export function resolveNamedDefinition(index, mod, file, support, name) {
|
|
|
148
490
|
}
|
|
149
491
|
}
|
|
150
492
|
else if (imp.kind === "star") {
|
|
151
|
-
const
|
|
493
|
+
const def = resolveStarImportedDefinition(index, imp, name, support.id, cNamespace);
|
|
494
|
+
if (def) {
|
|
495
|
+
const starResult = starImportGoTo(index, imp, def, name);
|
|
496
|
+
if (precedence === "last-wins") {
|
|
497
|
+
const taken = acceptBinding(starResult, imp);
|
|
498
|
+
if (taken)
|
|
499
|
+
return taken;
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
starCandidates.push({ imp, def });
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
else if (imp.kind === "namespace" && support.normalizeIdentifier(imp.localNS) === normalizedName) {
|
|
507
|
+
const targetFile = typeof imp.resolved === "string" ? normalizePath(imp.resolved) : undefined;
|
|
508
|
+
if (imp.mechanism === "cjs" && targetFile) {
|
|
509
|
+
const classValue = cjsRequireValueBinding(index, targetFile);
|
|
510
|
+
if (classValue) {
|
|
511
|
+
matched = okGoToResult(index, classValue, {
|
|
512
|
+
via: {
|
|
513
|
+
...(toModuleRef(imp.resolved) ? { importedFrom: toModuleRef(imp.resolved) } : {}),
|
|
514
|
+
exportedName: classValue.localName,
|
|
515
|
+
},
|
|
516
|
+
resolution: "import",
|
|
517
|
+
confidence: "high",
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
if (!matched) {
|
|
522
|
+
const targetMod = targetFile ? index.byFile.get(fileIdentityKey(targetFile)) : undefined;
|
|
523
|
+
const firstExport = targetMod?.exports.find((entry) => entry.type === "local");
|
|
524
|
+
if (firstExport) {
|
|
525
|
+
matched = okGoToResult(index, firstExport.target, {
|
|
526
|
+
via: {
|
|
527
|
+
...(toModuleRef(imp.resolved) ? { importedFrom: toModuleRef(imp.resolved) } : {}),
|
|
528
|
+
exportedName: firstExport.exportedAs,
|
|
529
|
+
},
|
|
530
|
+
resolution: "namespace",
|
|
531
|
+
confidence: "medium",
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
if (!matched) {
|
|
537
|
+
if (matchesExplicit && effectiveExplicitImport === imp) {
|
|
538
|
+
if (precedence !== "last-wins")
|
|
539
|
+
return null;
|
|
540
|
+
lastWinsResult = null;
|
|
541
|
+
}
|
|
542
|
+
continue;
|
|
543
|
+
}
|
|
544
|
+
const taken = acceptBinding(matched, imp);
|
|
545
|
+
if (taken)
|
|
546
|
+
return taken;
|
|
547
|
+
}
|
|
548
|
+
// A local binding name always wins above so a grouped import's own aliases never collide with
|
|
549
|
+
// each other. An aliased import's source spelling is not itself a bound name anywhere in the
|
|
550
|
+
// file (Python: `from a import helper as h` binds only `h`; a bare `helper()` elsewhere is
|
|
551
|
+
// unbound and must stay not_found), so only resolve it when the click falls inside that exact
|
|
552
|
+
// import statement's own source-name token, never by re-matching the spelling anywhere else.
|
|
553
|
+
if (referenceIndex !== undefined) {
|
|
554
|
+
for (const imp of mod.imports) {
|
|
555
|
+
if (imp.kind !== "named" ||
|
|
556
|
+
imp.local === imp.imported ||
|
|
557
|
+
support.normalizeIdentifier(imp.imported) !== normalizedName ||
|
|
558
|
+
!imp.importedRange ||
|
|
559
|
+
imp.importedRange.start.index === undefined ||
|
|
560
|
+
imp.importedRange.end.index === undefined ||
|
|
561
|
+
referenceIndex < imp.importedRange.start.index ||
|
|
562
|
+
referenceIndex >= imp.importedRange.end.index) {
|
|
563
|
+
continue;
|
|
564
|
+
}
|
|
565
|
+
const result = resolveImported(index, imp, imp.imported, cNamespace ? { cNamespace } : undefined);
|
|
152
566
|
if (result && !("namespace" in result)) {
|
|
153
567
|
return okGoToResult(index, result, {
|
|
154
568
|
via: {
|
|
155
569
|
...(toModuleRef(imp.resolved) ? { importedFrom: toModuleRef(imp.resolved) } : {}),
|
|
156
|
-
exportedName:
|
|
570
|
+
exportedName: imp.imported,
|
|
157
571
|
},
|
|
158
|
-
resolution: "import
|
|
159
|
-
confidence: "
|
|
572
|
+
resolution: "import",
|
|
573
|
+
confidence: "high",
|
|
160
574
|
});
|
|
161
575
|
}
|
|
162
576
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
577
|
+
}
|
|
578
|
+
if (precedence === "last-wins") {
|
|
579
|
+
if (lastWinsResult)
|
|
580
|
+
return lastWinsResult;
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
if (deferCompilationUnitPeers) {
|
|
584
|
+
const unitHit = resolveExport(index, file, name, {
|
|
585
|
+
allowLocalFallback: support.membersAreImplicitlyInScope,
|
|
586
|
+
});
|
|
587
|
+
if (unitHit?.kind === "resolved" && (!requiresExplicitReceiver || !unitHit.def.isMember)) {
|
|
588
|
+
return okGoToResult(index, unitHit.def, {
|
|
589
|
+
via: { exportedName: name },
|
|
590
|
+
resolution: "exact",
|
|
591
|
+
confidence: "high",
|
|
175
592
|
});
|
|
176
593
|
}
|
|
594
|
+
if (unitHit?.kind === "namespace") {
|
|
595
|
+
const targetMod = index.byFile.get(fileIdentityKey(unitHit.file));
|
|
596
|
+
const firstExport = targetMod?.exports.find((entry) => entry.type === "local");
|
|
597
|
+
if (firstExport) {
|
|
598
|
+
return okGoToResult(index, firstExport.target, {
|
|
599
|
+
via: { exportedName: name },
|
|
600
|
+
resolution: "namespace",
|
|
601
|
+
confidence: "medium",
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
if (!starCandidates.length)
|
|
607
|
+
return null;
|
|
608
|
+
const decision = decideStarImportCandidates(index, support.id, starCandidates, file);
|
|
609
|
+
if (decision.status === "ambiguous") {
|
|
610
|
+
return { status: "not_found", reason: AMBIGUOUS_STAR_IMPORT_REASON };
|
|
611
|
+
}
|
|
612
|
+
if (decision.status === "resolved") {
|
|
613
|
+
return starImportGoTo(index, decision.imp, decision.definition, name);
|
|
177
614
|
}
|
|
178
615
|
}
|
|
179
616
|
return null;
|