@lzehrung/codegraph 2.3.31 → 3.0.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 +33 -141
- package/codegraph-skill/codegraph/SKILL.md +8 -6
- 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/call-hierarchy.js +2 -4
- package/dist/agent/call-hierarchy.js.map +1 -1
- package/dist/agent/explore.d.ts +1 -1
- package/dist/agent/explore.d.ts.map +1 -1
- package/dist/agent/explore.js +3 -2
- package/dist/agent/explore.js.map +1 -1
- package/dist/agent/refactor-plan.js +2 -4
- package/dist/agent/refactor-plan.js.map +1 -1
- package/dist/agent/rename-preview.d.ts.map +1 -1
- package/dist/agent/rename-preview.js +4 -3
- package/dist/agent/rename-preview.js.map +1 -1
- package/dist/agent/search.d.ts.map +1 -1
- package/dist/agent/search.js +5 -3
- package/dist/agent/search.js.map +1 -1
- package/dist/agent/semantic-symbols.d.ts.map +1 -1
- package/dist/agent/semantic-symbols.js +2 -3
- package/dist/agent/semantic-symbols.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/agent/type-hierarchy.js +2 -4
- package/dist/agent/type-hierarchy.js.map +1 -1
- package/dist/agent/workspace-symbols.d.ts.map +1 -1
- package/dist/agent/workspace-symbols.js +2 -3
- package/dist/agent/workspace-symbols.js.map +1 -1
- package/dist/agent-tools.d.ts +0 -4
- package/dist/agent-tools.d.ts.map +1 -1
- package/dist/agent-tools.js +3 -6
- package/dist/agent-tools.js.map +1 -1
- package/dist/analysis-summary.d.ts +8 -4
- package/dist/analysis-summary.d.ts.map +1 -1
- package/dist/analysis-summary.js +15 -66
- package/dist/analysis-summary.js.map +1 -1
- package/dist/bin/cli.js +51145 -41770
- package/dist/bin/query-index-worker.js +122 -82
- 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/command-table.d.ts.map +1 -1
- package/dist/cli/command-table.js +9 -17
- package/dist/cli/command-table.js.map +1 -1
- package/dist/cli/context.js +10 -10
- package/dist/cli/context.js.map +1 -1
- package/dist/cli/drift.d.ts +0 -2
- package/dist/cli/drift.d.ts.map +1 -1
- package/dist/cli/drift.js +0 -1
- package/dist/cli/drift.js.map +1 -1
- package/dist/cli/graph-delta.d.ts +0 -2
- package/dist/cli/graph-delta.d.ts.map +1 -1
- package/dist/cli/graph-delta.js +0 -4
- package/dist/cli/graph-delta.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/graph.d.ts +0 -3
- package/dist/cli/graph.d.ts.map +1 -1
- package/dist/cli/graph.js +4 -14
- package/dist/cli/graph.js.map +1 -1
- package/dist/cli/help.d.ts +34 -34
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +9 -14
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/impact.d.ts +0 -2
- package/dist/cli/impact.d.ts.map +1 -1
- package/dist/cli/impact.js +0 -1
- package/dist/cli/impact.js.map +1 -1
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +5 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/inspect.d.ts +0 -2
- package/dist/cli/inspect.d.ts.map +1 -1
- package/dist/cli/inspect.js +5 -8
- package/dist/cli/inspect.js.map +1 -1
- package/dist/cli/invocation-context.d.ts +0 -3
- package/dist/cli/invocation-context.d.ts.map +1 -1
- package/dist/cli/invocation-context.js +4 -16
- package/dist/cli/invocation-context.js.map +1 -1
- package/dist/cli/navigation.d.ts +0 -2
- package/dist/cli/navigation.d.ts.map +1 -1
- package/dist/cli/navigation.js +0 -1
- package/dist/cli/navigation.js.map +1 -1
- package/dist/cli/options.d.ts.map +1 -1
- package/dist/cli/options.js +4 -14
- package/dist/cli/options.js.map +1 -1
- package/dist/cli/review.d.ts +0 -2
- package/dist/cli/review.d.ts.map +1 -1
- package/dist/cli/review.js +0 -5
- package/dist/cli/review.js.map +1 -1
- package/dist/cli/root-policy.d.ts +0 -2
- package/dist/cli/root-policy.d.ts.map +1 -1
- package/dist/cli/root-policy.js +0 -8
- package/dist/cli/root-policy.js.map +1 -1
- package/dist/cli/server.d.ts.map +1 -1
- package/dist/cli/server.js +0 -2
- package/dist/cli/server.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/git.d.ts.map +1 -1
- package/dist/drift/git.js +0 -1
- package/dist/drift/git.js.map +1 -1
- package/dist/drift/snapshot.d.ts.map +1 -1
- package/dist/drift/snapshot.js +5 -7
- package/dist/drift/snapshot.js.map +1 -1
- package/dist/drift/types.d.ts +2 -2
- package/dist/drift/types.d.ts.map +1 -1
- package/dist/drift/types.js.map +1 -1
- package/dist/duplicates/unit-cache.d.ts +0 -1
- package/dist/duplicates/unit-cache.d.ts.map +1 -1
- package/dist/duplicates/unit-cache.js +3 -11
- package/dist/duplicates/unit-cache.js.map +1 -1
- package/dist/duplicates/units.d.ts +5 -5
- package/dist/duplicates/units.d.ts.map +1 -1
- package/dist/duplicates/units.js +25 -88
- package/dist/duplicates/units.js.map +1 -1
- package/dist/graph-builder.d.ts +0 -6
- package/dist/graph-builder.d.ts.map +1 -1
- package/dist/graph-builder.js +6 -11
- package/dist/graph-builder.js.map +1 -1
- package/dist/graph-edge-collector.d.ts +4 -6
- package/dist/graph-edge-collector.d.ts.map +1 -1
- package/dist/graph-edge-collector.js +31 -26
- 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 +24 -76
- package/dist/graphs/edge-resolution.js.map +1 -1
- package/dist/graphs/specifiers.d.ts +4 -13
- package/dist/graphs/specifiers.d.ts.map +1 -1
- package/dist/graphs/specifiers.js +80 -173
- 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 +60 -8
- package/dist/graphs/symbol-graph-detailed/edge-passes.d.ts.map +1 -1
- package/dist/graphs/symbol-graph-detailed/edge-passes.js +997 -168
- 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 +150 -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 +141 -25
- package/dist/graphs/symbol-graph-detailed/receiver-calls.d.ts.map +1 -1
- package/dist/graphs/symbol-graph-detailed/receiver-calls.js +1015 -166
- 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 +449 -46
- 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/graphs/types.d.ts +0 -4
- package/dist/graphs/types.d.ts.map +1 -1
- package/dist/graphs.d.ts +1 -1
- package/dist/graphs.d.ts.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 +316 -526
- 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 +2 -2
- 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 +39 -1
- package/dist/indexer/build-cache/module-cache.d.ts.map +1 -1
- package/dist/indexer/build-cache/module-cache.js +218 -21
- package/dist/indexer/build-cache/module-cache.js.map +1 -1
- package/dist/indexer/build-cache/options.d.ts +30 -44
- package/dist/indexer/build-cache/options.d.ts.map +1 -1
- package/dist/indexer/build-cache/options.js +32 -71
- package/dist/indexer/build-cache/options.js.map +1 -1
- package/dist/indexer/build-cache/project-snapshot.d.ts +3 -3
- package/dist/indexer/build-cache/project-snapshot.d.ts.map +1 -1
- package/dist/indexer/build-cache/project-snapshot.js +164 -84
- package/dist/indexer/build-cache/project-snapshot.js.map +1 -1
- package/dist/indexer/build-cache/reports.d.ts +0 -2
- package/dist/indexer/build-cache/reports.d.ts.map +1 -1
- package/dist/indexer/build-cache/reports.js +0 -97
- package/dist/indexer/build-cache/reports.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 +2 -2
- package/dist/indexer/build-cache.d.ts.map +1 -1
- package/dist/indexer/build-cache.js +2 -2
- 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 +656 -71
- package/dist/indexer/build-index.js.map +1 -1
- package/dist/indexer/build-workers.d.ts.map +1 -1
- package/dist/indexer/build-workers.js +9 -9
- package/dist/indexer/build-workers.js.map +1 -1
- package/dist/indexer/call-hierarchy.js +1 -1
- package/dist/indexer/call-hierarchy.js.map +1 -1
- package/dist/indexer/callable-identity.d.ts +24 -0
- package/dist/indexer/callable-identity.d.ts.map +1 -0
- package/dist/indexer/callable-identity.js +111 -0
- package/dist/indexer/callable-identity.js.map +1 -0
- package/dist/indexer/compilation-units.d.ts +103 -0
- package/dist/indexer/compilation-units.d.ts.map +1 -0
- package/dist/indexer/compilation-units.js +607 -0
- package/dist/indexer/compilation-units.js.map +1 -0
- package/dist/indexer/cpp-callables.d.ts +25 -0
- package/dist/indexer/cpp-callables.d.ts.map +1 -0
- package/dist/indexer/cpp-callables.js +562 -0
- package/dist/indexer/cpp-callables.js.map +1 -0
- package/dist/indexer/declaration-visibility.d.ts +43 -2
- package/dist/indexer/declaration-visibility.d.ts.map +1 -1
- package/dist/indexer/declaration-visibility.js +158 -2
- package/dist/indexer/declaration-visibility.js.map +1 -1
- package/dist/indexer/expand-star-imports.d.ts +6 -1
- package/dist/indexer/expand-star-imports.d.ts.map +1 -1
- package/dist/indexer/expand-star-imports.js +131 -37
- package/dist/indexer/expand-star-imports.js.map +1 -1
- package/dist/indexer/finalize.d.ts.map +1 -1
- package/dist/indexer/finalize.js +0 -1
- package/dist/indexer/finalize.js.map +1 -1
- package/dist/indexer/import-resolution-tables.d.ts +72 -0
- package/dist/indexer/import-resolution-tables.d.ts.map +1 -0
- package/dist/indexer/import-resolution-tables.js +137 -0
- package/dist/indexer/import-resolution-tables.js.map +1 -0
- package/dist/indexer/import-types.d.ts +54 -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 +16 -1
- package/dist/indexer/imports/context.d.ts.map +1 -1
- package/dist/indexer/imports/import-binding-tables.d.ts +13 -1
- package/dist/indexer/imports/import-binding-tables.d.ts.map +1 -1
- package/dist/indexer/imports/import-binding-tables.js +149 -30
- 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 +24 -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 +128 -112
- 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 +68 -19
- package/dist/indexer/imports/text-import-extractors.js.map +1 -1
- package/dist/indexer/imports.d.ts +3 -4
- package/dist/indexer/imports.d.ts.map +1 -1
- package/dist/indexer/imports.js +116 -72
- 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 +203 -1
- package/dist/indexer/incremental-plan.js.map +1 -1
- package/dist/indexer/locals-and-exports.d.ts +3 -2
- package/dist/indexer/locals-and-exports.d.ts.map +1 -1
- package/dist/indexer/locals-and-exports.js +659 -78
- package/dist/indexer/locals-and-exports.js.map +1 -1
- package/dist/indexer/member-selection.d.ts +46 -0
- package/dist/indexer/member-selection.d.ts.map +1 -0
- package/dist/indexer/member-selection.js +169 -0
- package/dist/indexer/member-selection.js.map +1 -0
- 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 +137 -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 +119 -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 +132 -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 +82 -0
- package/dist/indexer/name-lookup-policies/php.js.map +1 -0
- package/dist/indexer/name-resolution-types.d.ts +101 -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 +57 -0
- package/dist/indexer/name-resolution.d.ts.map +1 -0
- package/dist/indexer/name-resolution.js +204 -0
- package/dist/indexer/name-resolution.js.map +1 -0
- package/dist/indexer/navigation-cpp.d.ts +58 -0
- package/dist/indexer/navigation-cpp.d.ts.map +1 -0
- package/dist/indexer/navigation-cpp.js +935 -0
- package/dist/indexer/navigation-cpp.js.map +1 -0
- package/dist/indexer/navigation-goto.d.ts +115 -3
- package/dist/indexer/navigation-goto.d.ts.map +1 -1
- package/dist/indexer/navigation-goto.js +2469 -190
- package/dist/indexer/navigation-goto.js.map +1 -1
- package/dist/indexer/navigation-local.d.ts +21 -2
- package/dist/indexer/navigation-local.d.ts.map +1 -1
- package/dist/indexer/navigation-local.js +520 -63
- 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-provenance.d.ts +1 -1
- package/dist/indexer/navigation-provenance.d.ts.map +1 -1
- package/dist/indexer/navigation-provenance.js +4 -13
- package/dist/indexer/navigation-provenance.js.map +1 -1
- package/dist/indexer/navigation-references.d.ts +73 -6
- package/dist/indexer/navigation-references.d.ts.map +1 -1
- package/dist/indexer/navigation-references.js +661 -67
- package/dist/indexer/navigation-references.js.map +1 -1
- package/dist/indexer/navigation-resolve.d.ts +46 -2
- package/dist/indexer/navigation-resolve.d.ts.map +1 -1
- package/dist/indexer/navigation-resolve.js +599 -193
- package/dist/indexer/navigation-resolve.js.map +1 -1
- package/dist/indexer/navigation.d.ts +29 -2
- package/dist/indexer/navigation.d.ts.map +1 -1
- package/dist/indexer/navigation.js +1092 -153
- package/dist/indexer/navigation.js.map +1 -1
- package/dist/indexer/parse-context.d.ts +2 -3
- package/dist/indexer/parse-context.d.ts.map +1 -1
- package/dist/indexer/parse-context.js +8 -21
- package/dist/indexer/parse-context.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-candidates.d.ts.map +1 -1
- package/dist/indexer/reference-candidates.js +13 -7
- package/dist/indexer/reference-candidates.js.map +1 -1
- 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 +29 -1
- package/dist/indexer/scope-types.d.ts.map +1 -1
- package/dist/indexer/scope.d.ts +2 -3
- package/dist/indexer/scope.d.ts.map +1 -1
- package/dist/indexer/scope.js +968 -47
- 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 +113 -0
- package/dist/indexer/star-import-precedence.d.ts.map +1 -0
- package/dist/indexer/star-import-precedence.js +402 -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 +42 -0
- package/dist/indexer/ts-callables.d.ts.map +1 -0
- package/dist/indexer/ts-callables.js +233 -0
- package/dist/indexer/ts-callables.js.map +1 -0
- package/dist/indexer/types.d.ts +41 -26
- 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 +3 -8
- 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 +223 -0
- package/dist/languages/callable-arity.d.ts.map +1 -0
- package/dist/languages/callable-arity.js +1199 -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 +8 -0
- package/dist/languages/definitions/zig.js.map +1 -1
- package/dist/lifecycle/manifest.d.ts.map +1 -1
- package/dist/lifecycle/manifest.js +0 -1
- package/dist/lifecycle/manifest.js.map +1 -1
- package/dist/mcp/handlers.js +14 -7
- package/dist/mcp/handlers.js.map +1 -1
- package/dist/native/byte-index.d.ts +6 -0
- package/dist/native/byte-index.d.ts.map +1 -1
- package/dist/native/byte-index.js +11 -6
- package/dist/native/byte-index.js.map +1 -1
- package/dist/native/contracts.d.ts +2 -3
- package/dist/native/contracts.d.ts.map +1 -1
- package/dist/native/execution.d.ts +9 -9
- package/dist/native/execution.d.ts.map +1 -1
- package/dist/native/execution.js +37 -77
- package/dist/native/execution.js.map +1 -1
- package/dist/native/js-bridge.d.ts +2 -15
- package/dist/native/js-bridge.d.ts.map +1 -1
- package/dist/native/js-bridge.js +2 -15
- package/dist/native/js-bridge.js.map +1 -1
- package/dist/native/query-results.js +2 -2
- package/dist/native/query-results.js.map +1 -1
- package/dist/native/runtime.d.ts +12 -12
- package/dist/native/runtime.d.ts.map +1 -1
- package/dist/native/runtime.js +24 -69
- package/dist/native/runtime.js.map +1 -1
- package/dist/native/tree-sitter-native.d.ts +3 -3
- package/dist/native/tree-sitter-native.d.ts.map +1 -1
- package/dist/native/tree-sitter-native.js +2 -2
- package/dist/native/tree-sitter-native.js.map +1 -1
- package/dist/presets.d.ts.map +1 -1
- package/dist/presets.js +0 -4
- package/dist/presets.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 +3 -20
- package/dist/review.js.map +1 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +0 -5
- package/dist/session.js.map +1 -1
- package/dist/sql/navigation.d.ts.map +1 -1
- package/dist/sql/navigation.js +2 -1
- 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 +8 -1
- package/dist/util/bloom-filter.d.ts.map +1 -1
- package/dist/util/bloom-filter.js +15 -2
- package/dist/util/bloom-filter.js.map +1 -1
- package/dist/util/glob.d.ts +32 -0
- package/dist/util/glob.d.ts.map +1 -0
- package/dist/util/glob.js +137 -0
- package/dist/util/glob.js.map +1 -0
- 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 +139 -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 +98 -3
- package/dist/util/member-access.js.map +1 -1
- package/dist/util/project-files.d.ts +2 -10
- package/dist/util/project-files.d.ts.map +1 -1
- package/dist/util/project-files.js +29 -51
- package/dist/util/project-files.js.map +1 -1
- package/dist/util/python-type-checking.d.ts +18 -0
- package/dist/util/python-type-checking.d.ts.map +1 -0
- package/dist/util/python-type-checking.js +160 -0
- package/dist/util/python-type-checking.js.map +1 -0
- 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/jvm.d.ts +7 -3
- package/dist/util/resolution/jvm.d.ts.map +1 -1
- package/dist/util/resolution/jvm.js +56 -38
- package/dist/util/resolution/jvm.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 +0 -1
- package/dist/util/resolution/rust.d.ts.map +1 -1
- package/dist/util/resolution/rust.js +95 -35
- package/dist/util/resolution/rust.js.map +1 -1
- package/dist/util/resolution/specifier-targets.d.ts +44 -0
- package/dist/util/resolution/specifier-targets.d.ts.map +1 -0
- package/dist/util/resolution/specifier-targets.js +152 -0
- package/dist/util/resolution/specifier-targets.js.map +1 -0
- 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 +101 -15
- package/dist/util/resolution.js.map +1 -1
- package/dist/util/specifiers.d.ts +29 -1
- package/dist/util/specifiers.d.ts.map +1 -1
- package/dist/util/specifiers.js +56 -8
- package/dist/util/specifiers.js.map +1 -1
- package/dist/util/trivia.d.ts.map +1 -1
- package/dist/util/trivia.js +49 -30
- package/dist/util/trivia.js.map +1 -1
- package/dist/util/workspace.d.ts.map +1 -1
- package/dist/util/workspace.js +32 -4
- package/dist/util/workspace.js.map +1 -1
- package/docs/mcp.md +3 -2
- package/package.json +5 -7
- 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,14 +1,17 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { findUsageReferences, goToDefinition } from "../indexer/navigation.js";
|
|
2
|
+
import { findUsageReferences, getCppEquivalentCallableDefinitions, goToDefinition } from "../indexer/navigation.js";
|
|
3
3
|
import { ensureParsedContext } from "../indexer/parse-context.js";
|
|
4
|
+
import { findClosestScopeBinding, getOrBuildScopeIndex, resolveNamedDefinition } from "../indexer/navigation-local.js";
|
|
5
|
+
import { cppEquivalentCallableBindings } from "../indexer/cpp-callables.js";
|
|
6
|
+
import { getCachedReferenceCandidateFiles } from "../indexer/navigation-references.js";
|
|
4
7
|
import { SymbolKind } from "../indexer/types.js";
|
|
5
8
|
import { supportForFileWithoutHeaderSample } from "../languages.js";
|
|
9
|
+
import { CALLABLE_DECLARATION_NODE_TYPES, CALLABLE_VARIABLE_VALUE_NODE_TYPES, getCallableArity, getCallableArityFromParameterText, getCallableDeclarationKind, getCallArgumentCount, getCallArgumentCountFromArgumentText, memberLookupBinding, } from "../languages/callable-arity.js";
|
|
6
10
|
import { sliceText, toRange } from "../util/ast.js";
|
|
7
11
|
import { fileIdentityKey } from "../util/paths.js";
|
|
8
12
|
import { getCallCompatibilityLanguageProfile, getCallCompatibilityProvider, getCallCompatibilitySupportedLanguages, registerCallCompatibilityExtractors, } from "./call-compatibility/providers/index.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { directSignatureParameterNode, findAncestorOfTypes, findFirstDescendantOfTypes, } from "./signature-node-utils.js";
|
|
13
|
+
import { findSignatureOpeningParen, findCallOpeningParen, findBalancedParentheses, } from "./call-compatibility/text-scanner.js";
|
|
14
|
+
import { findAncestorOfTypes } from "./signature-node-utils.js";
|
|
12
15
|
import { canStartReferenceLookup, recordReferenceLookupOmitted, recordReferenceLookupStarted, } from "./budgets.js";
|
|
13
16
|
function supportsCallCompatibilityLanguage(languageId) {
|
|
14
17
|
return getCallCompatibilityProvider(languageId) !== null;
|
|
@@ -16,365 +19,31 @@ function supportsCallCompatibilityLanguage(languageId) {
|
|
|
16
19
|
function referenceScanLimitForCallsites(maxRefs) {
|
|
17
20
|
return Math.max(maxRefs + 50, maxRefs * 4);
|
|
18
21
|
}
|
|
19
|
-
|
|
20
|
-
let parenDepth = 0;
|
|
21
|
-
let bracketDepth = 0;
|
|
22
|
-
let braceDepth = 0;
|
|
23
|
-
let angleDepth = 0;
|
|
24
|
-
let quote = null;
|
|
25
|
-
let escaped = false;
|
|
26
|
-
for (let index = 0; index < text.length; index += 1) {
|
|
27
|
-
const char = text[index];
|
|
28
|
-
if (quote) {
|
|
29
|
-
if (escaped) {
|
|
30
|
-
escaped = false;
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
if (char === "\\") {
|
|
34
|
-
escaped = true;
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
if (char === quote) {
|
|
38
|
-
quote = null;
|
|
39
|
-
}
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
const commentEnd = findCommentEnd(text, index);
|
|
43
|
-
if (commentEnd !== null) {
|
|
44
|
-
if (commentEnd < 0) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
index = commentEnd - 1;
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
if (char === '"' || char === "'" || char === "`") {
|
|
51
|
-
quote = char;
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
if (char === "(") {
|
|
55
|
-
parenDepth += 1;
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
if (char === ")") {
|
|
59
|
-
parenDepth -= 1;
|
|
60
|
-
if (parenDepth < 0) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
if (char === "[") {
|
|
66
|
-
bracketDepth += 1;
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
if (char === "]") {
|
|
70
|
-
bracketDepth -= 1;
|
|
71
|
-
if (bracketDepth < 0) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
if (char === "{") {
|
|
77
|
-
braceDepth += 1;
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
if (char === "}") {
|
|
81
|
-
braceDepth -= 1;
|
|
82
|
-
if (braceDepth < 0) {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
const atTopLevel = !parenDepth && !bracketDepth && !braceDepth;
|
|
88
|
-
if (char === "<" && atTopLevel) {
|
|
89
|
-
angleDepth += 1;
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
if (char === ">" && text[index - 1] !== "=" && atTopLevel && angleDepth) {
|
|
93
|
-
angleDepth -= 1;
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
if (char === "=" && text[index + 1] !== ">" && atTopLevel && !angleDepth) {
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
const callableDeclarationTypes = new Set([
|
|
103
|
-
"function_declaration",
|
|
104
|
-
"function_definition",
|
|
105
|
-
"function_item",
|
|
106
|
-
"method",
|
|
107
|
-
"singleton_method",
|
|
108
|
-
"method_declaration",
|
|
109
|
-
"constructor_declaration",
|
|
110
|
-
"init_declaration",
|
|
111
|
-
"protocol_function_declaration",
|
|
112
|
-
"arrow_function",
|
|
113
|
-
"function",
|
|
114
|
-
"function_expression",
|
|
115
|
-
"variable_declarator",
|
|
116
|
-
"declaration",
|
|
117
|
-
]);
|
|
118
|
-
const callableVariableValueTypes = new Set(["arrow_function", "function_expression", "function"]);
|
|
119
|
-
const parameterListTypes = new Set(Object.keys(PARAMETER_LIST_NODE_TYPES));
|
|
120
|
-
function shouldSkipFirstReceiverParameter(profile, declaration) {
|
|
121
|
-
if (profile.receiver.skipFirst !== "class-methods") {
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
let current = declaration.parent;
|
|
125
|
-
while (current) {
|
|
126
|
-
if (profile.receiver.methodScopeTypes.includes(current.type)) {
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
if (profile.receiver.nonMethodScopeTypes.includes(current.type)) {
|
|
130
|
-
return false;
|
|
131
|
-
}
|
|
132
|
-
current = current.parent;
|
|
133
|
-
}
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
function findSignatureParameterText(request, profile) {
|
|
137
|
-
if (!request.tree) {
|
|
138
|
-
return null;
|
|
139
|
-
}
|
|
140
|
-
const node = request.tree.rootNode.descendantForIndex(request.symbolStartIndex, request.symbolStartIndex);
|
|
141
|
-
const declaration = findAncestorOfTypes(node, callableDeclarationTypes);
|
|
142
|
-
if (!declaration) {
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
const skipFirstReceiver = shouldSkipFirstReceiverParameter(profile, declaration);
|
|
146
|
-
let params = directSignatureParameterNode(declaration);
|
|
147
|
-
if (!params && declaration.type === "variable_declarator") {
|
|
148
|
-
const valueNode = declaration.childForFieldName("value");
|
|
149
|
-
if (!valueNode || !callableVariableValueTypes.has(valueNode.type)) {
|
|
150
|
-
return null;
|
|
151
|
-
}
|
|
152
|
-
params = directSignatureParameterNode(valueNode) ?? findFirstDescendantOfTypes(valueNode, parameterListTypes);
|
|
153
|
-
}
|
|
154
|
-
if (!params) {
|
|
155
|
-
params = findFirstDescendantOfTypes(declaration, parameterListTypes);
|
|
156
|
-
}
|
|
157
|
-
if (!params) {
|
|
158
|
-
const directParameterChildType = profile.directParameterChildType;
|
|
159
|
-
if (directParameterChildType !== null) {
|
|
160
|
-
const parameterNodes = declaration.namedChildren.filter((child) => child.type === directParameterChildType);
|
|
161
|
-
const first = parameterNodes[0];
|
|
162
|
-
const last = parameterNodes[parameterNodes.length - 1];
|
|
163
|
-
if (first && last) {
|
|
164
|
-
return {
|
|
165
|
-
text: request.source.slice(first.startIndex, last.endIndex),
|
|
166
|
-
skipFirstReceiver,
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return { text: "", skipFirstReceiver };
|
|
171
|
-
}
|
|
172
|
-
const text = request.source.slice(params.startIndex, params.endIndex).trim();
|
|
173
|
-
if (text.startsWith("(") && text.endsWith(")")) {
|
|
174
|
-
return { text: text.slice(1, -1), skipFirstReceiver };
|
|
175
|
-
}
|
|
176
|
-
return { text, skipFirstReceiver };
|
|
177
|
-
}
|
|
178
|
-
function isReceiverParameter(profile, parameter, index, skipFirstReceiver) {
|
|
179
|
-
if (!skipFirstReceiver) {
|
|
180
|
-
return false;
|
|
181
|
-
}
|
|
182
|
-
const trimmed = parameter.trim();
|
|
183
|
-
if (!index) {
|
|
184
|
-
if (profile.receiver.firstPositionExact.includes(trimmed)) {
|
|
185
|
-
return true;
|
|
186
|
-
}
|
|
187
|
-
if (profile.receiver.firstPositionTypedPrefixes.some((prefix) => trimmed.startsWith(prefix))) {
|
|
188
|
-
return true;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
const thisKeyword = profile.receiver.thisKeyword;
|
|
192
|
-
if (thisKeyword !== null) {
|
|
193
|
-
const colonIndex = trimmed.indexOf(":");
|
|
194
|
-
const namePortion = colonIndex >= 0 ? trimmed.slice(0, colonIndex).trim() : trimmed;
|
|
195
|
-
return namePortion === thisKeyword;
|
|
196
|
-
}
|
|
197
|
-
return false;
|
|
198
|
-
}
|
|
199
|
-
function hasTopLevelEllipsis(text) {
|
|
200
|
-
let parenDepth = 0;
|
|
201
|
-
let bracketDepth = 0;
|
|
202
|
-
let braceDepth = 0;
|
|
203
|
-
let angleDepth = 0;
|
|
204
|
-
let quote = null;
|
|
205
|
-
let escaped = false;
|
|
206
|
-
for (let index = 0; index < text.length; index += 1) {
|
|
207
|
-
const char = text[index];
|
|
208
|
-
if (quote) {
|
|
209
|
-
if (escaped) {
|
|
210
|
-
escaped = false;
|
|
211
|
-
continue;
|
|
212
|
-
}
|
|
213
|
-
if (char === "\\") {
|
|
214
|
-
escaped = true;
|
|
215
|
-
continue;
|
|
216
|
-
}
|
|
217
|
-
if (char === quote) {
|
|
218
|
-
quote = null;
|
|
219
|
-
}
|
|
220
|
-
continue;
|
|
221
|
-
}
|
|
222
|
-
const commentEnd = findCommentEnd(text, index);
|
|
223
|
-
if (commentEnd !== null) {
|
|
224
|
-
if (commentEnd < 0) {
|
|
225
|
-
return false;
|
|
226
|
-
}
|
|
227
|
-
index = commentEnd - 1;
|
|
228
|
-
continue;
|
|
229
|
-
}
|
|
230
|
-
if (canStartRegexLiteral(text, index, 0)) {
|
|
231
|
-
const regexEnd = findRegexLiteralEnd(text, index);
|
|
232
|
-
if (regexEnd === null || regexEnd < 0) {
|
|
233
|
-
return false;
|
|
234
|
-
}
|
|
235
|
-
index = regexEnd - 1;
|
|
236
|
-
continue;
|
|
237
|
-
}
|
|
238
|
-
if (char === '"' || char === "'" || char === "`") {
|
|
239
|
-
quote = char;
|
|
240
|
-
continue;
|
|
241
|
-
}
|
|
242
|
-
if (char === "(") {
|
|
243
|
-
parenDepth += 1;
|
|
244
|
-
continue;
|
|
245
|
-
}
|
|
246
|
-
if (char === ")") {
|
|
247
|
-
parenDepth -= 1;
|
|
248
|
-
if (parenDepth < 0) {
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
continue;
|
|
252
|
-
}
|
|
253
|
-
if (char === "[") {
|
|
254
|
-
bracketDepth += 1;
|
|
255
|
-
continue;
|
|
256
|
-
}
|
|
257
|
-
if (char === "]") {
|
|
258
|
-
bracketDepth -= 1;
|
|
259
|
-
if (bracketDepth < 0) {
|
|
260
|
-
return false;
|
|
261
|
-
}
|
|
262
|
-
continue;
|
|
263
|
-
}
|
|
264
|
-
if (char === "{") {
|
|
265
|
-
braceDepth += 1;
|
|
266
|
-
continue;
|
|
267
|
-
}
|
|
268
|
-
if (char === "}") {
|
|
269
|
-
braceDepth -= 1;
|
|
270
|
-
if (braceDepth < 0) {
|
|
271
|
-
return false;
|
|
272
|
-
}
|
|
273
|
-
continue;
|
|
274
|
-
}
|
|
275
|
-
const atDelimiterTopLevel = !parenDepth && !bracketDepth && !braceDepth;
|
|
276
|
-
if (char === "<" && atDelimiterTopLevel) {
|
|
277
|
-
angleDepth += 1;
|
|
278
|
-
continue;
|
|
279
|
-
}
|
|
280
|
-
if (char === ">" && angleDepth && atDelimiterTopLevel && text[index - 1] !== "=") {
|
|
281
|
-
angleDepth -= 1;
|
|
282
|
-
continue;
|
|
283
|
-
}
|
|
284
|
-
if (!angleDepth && atDelimiterTopLevel && text.startsWith("...", index)) {
|
|
285
|
-
return true;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
return false;
|
|
289
|
-
}
|
|
290
|
-
function isRestParameter(profile, parameter) {
|
|
291
|
-
const trimmed = parameter.trim();
|
|
292
|
-
if (!trimmed) {
|
|
293
|
-
return false;
|
|
294
|
-
}
|
|
295
|
-
if (hasTopLevelEllipsis(trimmed)) {
|
|
296
|
-
return true;
|
|
297
|
-
}
|
|
298
|
-
if (profile.restPrefixes.some((prefix) => trimmed.startsWith(prefix))) {
|
|
299
|
-
return true;
|
|
300
|
-
}
|
|
301
|
-
return profile.restWordPatterns.some((pattern) => pattern.test(trimmed));
|
|
302
|
-
}
|
|
303
|
-
function isOptionalParameter(profile, parameter) {
|
|
304
|
-
const trimmed = parameter.trim();
|
|
305
|
-
if (!trimmed) {
|
|
306
|
-
return false;
|
|
307
|
-
}
|
|
308
|
-
const nameMarker = profile.optionalNameMarker;
|
|
309
|
-
if (nameMarker !== null) {
|
|
310
|
-
const colonIndex = trimmed.indexOf(":");
|
|
311
|
-
const namePortion = colonIndex >= 0 ? trimmed.slice(0, colonIndex) : trimmed;
|
|
312
|
-
if (namePortion.includes(nameMarker)) {
|
|
313
|
-
return true;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
if (profile.keywordParameterValuePattern?.test(trimmed)) {
|
|
317
|
-
return true;
|
|
318
|
-
}
|
|
319
|
-
return hasTopLevelEquals(trimmed);
|
|
320
|
-
}
|
|
321
|
-
function parameterSlotCount(profile, parameter) {
|
|
322
|
-
const trimmed = parameter.trim();
|
|
323
|
-
if (!trimmed) {
|
|
324
|
-
return 0;
|
|
325
|
-
}
|
|
326
|
-
if (profile.zeroSlotParameters.includes(trimmed)) {
|
|
327
|
-
return 0;
|
|
328
|
-
}
|
|
329
|
-
return 1;
|
|
330
|
-
}
|
|
331
|
-
function signatureFromParameterText(profile, parameterText, angleMode, skipFirstReceiver = true) {
|
|
332
|
-
const parameters = splitTopLevelCommaGroups(parameterText, angleMode, profile.signatureCommaScanDetectsRegexLiterals);
|
|
333
|
-
if (!parameters) {
|
|
334
|
-
return null;
|
|
335
|
-
}
|
|
336
|
-
let minArgs = 0;
|
|
337
|
-
let maxArgs = 0;
|
|
338
|
-
let positionalArgCount = 0;
|
|
339
|
-
let hasRest = false;
|
|
340
|
-
parameters.forEach((parameter, index) => {
|
|
341
|
-
const trimmed = parameter.trim();
|
|
342
|
-
if (!trimmed ||
|
|
343
|
-
profile.parameterSeparators.includes(trimmed) ||
|
|
344
|
-
isReceiverParameter(profile, trimmed, index, skipFirstReceiver)) {
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
if (isRestParameter(profile, trimmed)) {
|
|
348
|
-
hasRest = true;
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
if (profile.keywordParameterPattern?.test(trimmed)) {
|
|
352
|
-
maxArgs += 1;
|
|
353
|
-
if (!isOptionalParameter(profile, trimmed)) {
|
|
354
|
-
minArgs += 1;
|
|
355
|
-
}
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
const slotCount = parameterSlotCount(profile, trimmed);
|
|
359
|
-
if (!slotCount) {
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
positionalArgCount += slotCount;
|
|
363
|
-
maxArgs += slotCount;
|
|
364
|
-
if (!isOptionalParameter(profile, trimmed)) {
|
|
365
|
-
minArgs = positionalArgCount;
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
|
-
return { minArgs, maxArgs: hasRest ? null : maxArgs, confidence: "high" };
|
|
369
|
-
}
|
|
22
|
+
const callableDeclarationTypes = new Set(Object.keys(CALLABLE_DECLARATION_NODE_TYPES));
|
|
370
23
|
function extractCallableSignatureFromProvider(request) {
|
|
371
24
|
const profile = getCallCompatibilityLanguageProfile(request.languageId);
|
|
372
25
|
if (!profile) {
|
|
373
26
|
return null;
|
|
374
27
|
}
|
|
375
|
-
const
|
|
376
|
-
if (
|
|
377
|
-
|
|
28
|
+
const binding = request.binding ?? "bound";
|
|
29
|
+
if (request.tree) {
|
|
30
|
+
const node = request.tree.rootNode.descendantForIndex(request.symbolStartIndex, request.symbolStartIndex);
|
|
31
|
+
const declaration = findAncestorOfTypes(node, callableDeclarationTypes);
|
|
32
|
+
if (declaration) {
|
|
33
|
+
const arity = getCallableArity({ languageId: request.languageId, source: request.source, declaration, binding });
|
|
34
|
+
if (arity) {
|
|
35
|
+
return { ...arity, confidence: "high" };
|
|
36
|
+
}
|
|
37
|
+
// A tree-proven declaration with no provable parameter structure is unknown, except a
|
|
38
|
+
// variable declarator whose value is not callable: that shape always fell back to the
|
|
39
|
+
// source scan, and the fallback must not change for it.
|
|
40
|
+
const valueNode = declaration.type === "variable_declarator" ? declaration.childForFieldName("value") : null;
|
|
41
|
+
const fallsThroughToSource = declaration.type === "variable_declarator" &&
|
|
42
|
+
(!valueNode || !CALLABLE_VARIABLE_VALUE_NODE_TYPES[valueNode.type]);
|
|
43
|
+
if (!fallsThroughToSource) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
378
47
|
}
|
|
379
48
|
if (!profile.sourceFallback) {
|
|
380
49
|
return null;
|
|
@@ -384,16 +53,22 @@ function extractCallableSignatureFromProvider(request) {
|
|
|
384
53
|
if (!balanced) {
|
|
385
54
|
return null;
|
|
386
55
|
}
|
|
387
|
-
|
|
56
|
+
const arity = getCallableArityFromParameterText({
|
|
57
|
+
languageId: request.languageId,
|
|
58
|
+
parameterText: balanced.inner,
|
|
59
|
+
binding,
|
|
60
|
+
});
|
|
61
|
+
return arity ? { ...arity, confidence: "high" } : null;
|
|
388
62
|
}
|
|
389
63
|
function extractCallsiteArgumentsFromProvider(request) {
|
|
390
64
|
const profile = getCallCompatibilityLanguageProfile(request.languageId);
|
|
391
65
|
if (!profile) {
|
|
392
66
|
return null;
|
|
393
67
|
}
|
|
394
|
-
const
|
|
395
|
-
if (
|
|
396
|
-
|
|
68
|
+
const callNode = request.tree ? locateCallsiteCallNode(request) : null;
|
|
69
|
+
if (callNode) {
|
|
70
|
+
const argCount = getCallArgumentCount({ languageId: request.languageId, source: request.source, call: callNode });
|
|
71
|
+
return argCount === null ? null : { argCount, confidence: "high" };
|
|
397
72
|
}
|
|
398
73
|
if (!profile.sourceFallback) {
|
|
399
74
|
return null;
|
|
@@ -403,7 +78,11 @@ function extractCallsiteArgumentsFromProvider(request) {
|
|
|
403
78
|
if (!balanced) {
|
|
404
79
|
return null;
|
|
405
80
|
}
|
|
406
|
-
|
|
81
|
+
const argCount = getCallArgumentCountFromArgumentText({
|
|
82
|
+
languageId: request.languageId,
|
|
83
|
+
argumentText: balanced.inner,
|
|
84
|
+
});
|
|
85
|
+
return argCount === null ? null : { argCount, confidence: "high" };
|
|
407
86
|
}
|
|
408
87
|
registerCallCompatibilityExtractors({
|
|
409
88
|
extractSignature: extractCallableSignatureFromProvider,
|
|
@@ -423,84 +102,26 @@ export function extractCallsiteArguments(request) {
|
|
|
423
102
|
}
|
|
424
103
|
return provider.extractCallsite(request);
|
|
425
104
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
return null;
|
|
447
|
-
}
|
|
448
|
-
let braceDepth = 0;
|
|
449
|
-
let quote = null;
|
|
450
|
-
let escaped = false;
|
|
451
|
-
let closed = false;
|
|
452
|
-
for (let index = startIndex; index < text.length; index += 1) {
|
|
453
|
-
const char = text[index];
|
|
454
|
-
if (quote) {
|
|
455
|
-
if (escaped) {
|
|
456
|
-
escaped = false;
|
|
457
|
-
continue;
|
|
458
|
-
}
|
|
459
|
-
if (char === "\\") {
|
|
460
|
-
escaped = true;
|
|
461
|
-
continue;
|
|
462
|
-
}
|
|
463
|
-
if (char === quote) {
|
|
464
|
-
quote = null;
|
|
465
|
-
}
|
|
466
|
-
continue;
|
|
467
|
-
}
|
|
468
|
-
const commentEnd = findCommentEnd(text, index);
|
|
469
|
-
if (commentEnd !== null) {
|
|
470
|
-
if (commentEnd < 0) {
|
|
471
|
-
return null;
|
|
472
|
-
}
|
|
473
|
-
index = commentEnd - 1;
|
|
474
|
-
continue;
|
|
475
|
-
}
|
|
476
|
-
if (char === '"' || char === "'" || char === "`") {
|
|
477
|
-
quote = char;
|
|
478
|
-
continue;
|
|
479
|
-
}
|
|
480
|
-
if (char === "{") {
|
|
481
|
-
braceDepth += 1;
|
|
482
|
-
continue;
|
|
483
|
-
}
|
|
484
|
-
if (char === "}") {
|
|
485
|
-
braceDepth -= 1;
|
|
486
|
-
if (braceDepth < 0) {
|
|
487
|
-
return null;
|
|
488
|
-
}
|
|
489
|
-
if (!braceDepth) {
|
|
490
|
-
startIndex = index + 1;
|
|
491
|
-
count += 1;
|
|
492
|
-
closed = true;
|
|
493
|
-
break;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
if (!closed) {
|
|
498
|
-
return null;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
return count;
|
|
502
|
-
}
|
|
503
|
-
function findCallsiteArgumentText(request, profile) {
|
|
105
|
+
/**
|
|
106
|
+
* Call node types recognized at a callee range. PHP member and scoped call forms stay excluded:
|
|
107
|
+
* callsite extraction for them remains the documented limitation it was before the shared arity
|
|
108
|
+
* facts existed, so no caller sees a newly counted or newly dropped callsite here.
|
|
109
|
+
*/
|
|
110
|
+
const CALL_EXPRESSION_NODE_TYPES = {
|
|
111
|
+
call: true,
|
|
112
|
+
call_expression: true,
|
|
113
|
+
function_call_expression: true,
|
|
114
|
+
invocation_expression: true,
|
|
115
|
+
method_invocation: true,
|
|
116
|
+
object_creation_expression: true,
|
|
117
|
+
};
|
|
118
|
+
const callExpressionTypes = new Set(Object.keys(CALL_EXPRESSION_NODE_TYPES));
|
|
119
|
+
/**
|
|
120
|
+
* Locate and validate the call node for a callee range. The callee must sit inside the call's
|
|
121
|
+
* target expression, so a non-callee reference inside a call (an argument, for example) is not a
|
|
122
|
+
* callsite, and a trailing-closure wrapper call counts as the callsite.
|
|
123
|
+
*/
|
|
124
|
+
function locateCallsiteCallNode(request) {
|
|
504
125
|
if (!request.tree) {
|
|
505
126
|
return null;
|
|
506
127
|
}
|
|
@@ -526,58 +147,7 @@ function findCallsiteArgumentText(request, profile) {
|
|
|
526
147
|
if (!targetNode || request.calleeStartIndex < targetNode.startIndex || endIndex > targetNode.endIndex) {
|
|
527
148
|
return null;
|
|
528
149
|
}
|
|
529
|
-
|
|
530
|
-
callNode.namedChildren.find((child) => argumentListTypes.has(child.type)) ??
|
|
531
|
-
findFirstDescendantOfTypes(callNode, argumentListTypes);
|
|
532
|
-
if (argumentNode) {
|
|
533
|
-
let text = request.source.slice(argumentNode.startIndex, argumentNode.endIndex).trim();
|
|
534
|
-
let trailingArgumentCount = 0;
|
|
535
|
-
const callSuffix = argumentNode.type === "call_suffix"
|
|
536
|
-
? argumentNode
|
|
537
|
-
: findFirstDescendantOfTypes(callNode, new Set(["call_suffix"]));
|
|
538
|
-
const valueArguments = argumentNode.type === "value_arguments"
|
|
539
|
-
? argumentNode
|
|
540
|
-
: findFirstDescendantOfTypes(callSuffix ?? argumentNode, new Set(["value_arguments"]));
|
|
541
|
-
if (valueArguments) {
|
|
542
|
-
const trailingEndIndex = callSuffix?.endIndex ?? callNode.endIndex;
|
|
543
|
-
const trailingText = request.source.slice(valueArguments.endIndex, trailingEndIndex).trim();
|
|
544
|
-
const count = countTrailingClosureArguments(trailingText);
|
|
545
|
-
if (count === null) {
|
|
546
|
-
return null;
|
|
547
|
-
}
|
|
548
|
-
text = request.source.slice(valueArguments.startIndex, valueArguments.endIndex).trim();
|
|
549
|
-
trailingArgumentCount = count;
|
|
550
|
-
}
|
|
551
|
-
if (text.startsWith("(") && text.endsWith(")")) {
|
|
552
|
-
return { text: text.slice(1, -1), trailingArgumentCount };
|
|
553
|
-
}
|
|
554
|
-
return { text, trailingArgumentCount };
|
|
555
|
-
}
|
|
556
|
-
if (profile.callsiteParenthesesFallback) {
|
|
557
|
-
const openIndex = findOpeningParen(request.source, callNode.startIndex);
|
|
558
|
-
const balanced = findBalancedParentheses(request.source, openIndex);
|
|
559
|
-
return balanced ? { text: balanced.inner, trailingArgumentCount: 0 } : null;
|
|
560
|
-
}
|
|
561
|
-
return null;
|
|
562
|
-
}
|
|
563
|
-
function hasUncountableSpreadArgument(profile, arg) {
|
|
564
|
-
const trimmed = arg.trim();
|
|
565
|
-
if (trimmed.startsWith("...")) {
|
|
566
|
-
return true;
|
|
567
|
-
}
|
|
568
|
-
return profile.spreadPrefixes.some((prefix) => trimmed.startsWith(prefix));
|
|
569
|
-
}
|
|
570
|
-
function callsiteFromArgumentText(profile, argumentText, trailingArgumentCount = 0) {
|
|
571
|
-
const args = splitTopLevelCommaGroups(argumentText, "type-context");
|
|
572
|
-
if (!args) {
|
|
573
|
-
return null;
|
|
574
|
-
}
|
|
575
|
-
for (const arg of args) {
|
|
576
|
-
if (hasUncountableSpreadArgument(profile, arg)) {
|
|
577
|
-
return null;
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
return { argCount: args.length + trailingArgumentCount, confidence: "high" };
|
|
150
|
+
return callNode;
|
|
581
151
|
}
|
|
582
152
|
function isCallableChangedSymbol(symbol) {
|
|
583
153
|
return (symbol.kind === SymbolKind.Function ||
|
|
@@ -606,7 +176,18 @@ function sameOverloadContainer(left, right) {
|
|
|
606
176
|
}
|
|
607
177
|
return left.parent.id === right.parent.id;
|
|
608
178
|
}
|
|
609
|
-
function
|
|
179
|
+
function changedCppCallableBinding(index, changedSymbol, parsed) {
|
|
180
|
+
if (parsed.sup.id !== "cpp")
|
|
181
|
+
return undefined;
|
|
182
|
+
const module = index.byFile.get(fileIdentityKey(changedSymbol.file));
|
|
183
|
+
if (!module)
|
|
184
|
+
return undefined;
|
|
185
|
+
const scope = getOrBuildScopeIndex(index, module.file, parsed.source, parsed.sup, module, parsed.tree);
|
|
186
|
+
return scope.bindings
|
|
187
|
+
.get(parsed.sup.normalizeIdentifier(changedSymbol.name))
|
|
188
|
+
?.find((binding) => binding.kind === "function" && binding.def && sameRangeStart(binding.def, changedSymbol.range));
|
|
189
|
+
}
|
|
190
|
+
function hasSameFileOverloadCandidates(index, changedSymbol, parsed) {
|
|
610
191
|
const module = index.byFile.get(fileIdentityKey(changedSymbol.file));
|
|
611
192
|
if (!module) {
|
|
612
193
|
return false;
|
|
@@ -615,6 +196,7 @@ function hasSameFileOverloadCandidates(index, changedSymbol, languageId, source,
|
|
|
615
196
|
if (changedStartIndex === undefined) {
|
|
616
197
|
return false;
|
|
617
198
|
}
|
|
199
|
+
const { source, tree, sup } = parsed;
|
|
618
200
|
const changedDeclaration = callableDeclarationAt(tree, changedStartIndex);
|
|
619
201
|
for (const local of module.locals) {
|
|
620
202
|
if (local.localName !== changedSymbol.name || sameRangeStart(local.range, changedSymbol.range)) {
|
|
@@ -629,7 +211,7 @@ function hasSameFileOverloadCandidates(index, changedSymbol, languageId, source,
|
|
|
629
211
|
continue;
|
|
630
212
|
}
|
|
631
213
|
const signature = extractCallableSignature({
|
|
632
|
-
languageId,
|
|
214
|
+
languageId: sup.id,
|
|
633
215
|
source,
|
|
634
216
|
symbolStartIndex,
|
|
635
217
|
tree,
|
|
@@ -740,11 +322,62 @@ function bestGotoNode(target, symbolName, source) {
|
|
|
740
322
|
walk(target);
|
|
741
323
|
return best;
|
|
742
324
|
}
|
|
743
|
-
|
|
325
|
+
function cppUnqualifiedCallTarget(index, file, parsed, target) {
|
|
326
|
+
if (parsed.sup.id !== "cpp" || target.type !== "identifier")
|
|
327
|
+
return null;
|
|
328
|
+
const module = index.byFile.get(fileIdentityKey(file));
|
|
329
|
+
if (!module)
|
|
330
|
+
return null;
|
|
331
|
+
const name = sliceText(target, parsed.source);
|
|
332
|
+
const scope = getOrBuildScopeIndex(index, file, parsed.source, parsed.sup, module, parsed.tree);
|
|
333
|
+
const binding = findClosestScopeBinding(scope, name, target, parsed.sup);
|
|
334
|
+
if (binding?.kind === "function") {
|
|
335
|
+
const equivalents = cppEquivalentCallableBindings(binding);
|
|
336
|
+
if (equivalents.length !== (binding.sameScopeFunctionBindings?.length ?? 1))
|
|
337
|
+
return null;
|
|
338
|
+
const canonical = equivalents.find((candidate) => candidate.callable?.definition) ?? equivalents[0];
|
|
339
|
+
const range = canonical?.def;
|
|
340
|
+
if (!range)
|
|
341
|
+
return null;
|
|
342
|
+
return module.locals.find((local) => sameRangeStart(local.range, range)) ?? null;
|
|
343
|
+
}
|
|
344
|
+
// A local variable or parameter shadows the function; member expressions and
|
|
345
|
+
// ambiguous overload sets cannot be recovered as unqualified calls.
|
|
346
|
+
if (binding && !binding.import)
|
|
347
|
+
return null;
|
|
348
|
+
const resolved = resolveNamedDefinition(index, module, file, parsed.sup, name);
|
|
349
|
+
if (resolved?.status !== "ok" || resolved.definition.kind !== SymbolKind.Function)
|
|
350
|
+
return null;
|
|
351
|
+
return resolved.definition;
|
|
352
|
+
}
|
|
353
|
+
async function collectVerifiedCallsiteReferences(index, changedSymbol, maxRefs, shouldIncludeReference, diagnostics, parsedDefinition, equivalentDefinitions, excludedReferences) {
|
|
744
354
|
const refs = [];
|
|
745
355
|
const seen = new Set();
|
|
356
|
+
const languageId = parsedDefinition.sup.id;
|
|
357
|
+
const def = {
|
|
358
|
+
file: changedSymbol.file,
|
|
359
|
+
localName: changedSymbol.name,
|
|
360
|
+
kind: changedSymbol.kind,
|
|
361
|
+
range: changedSymbol.range,
|
|
362
|
+
};
|
|
363
|
+
let candidateFiles;
|
|
364
|
+
if ((languageId === "c" || languageId === "cpp") && changedSymbol.kind === SymbolKind.Function) {
|
|
365
|
+
candidateFiles = new Set();
|
|
366
|
+
for (const definition of equivalentDefinitions ?? [def]) {
|
|
367
|
+
const module = index.byFile.get(fileIdentityKey(definition.file));
|
|
368
|
+
const exportedNames = module?.exports.flatMap((entry) => entry.type === "local" && sameDefinition(entry.target, definition) ? [entry.exportedAs] : []) ?? [];
|
|
369
|
+
if (!exportedNames.length)
|
|
370
|
+
exportedNames.push(definition.localName);
|
|
371
|
+
candidateFiles.add(fileIdentityKey(definition.file));
|
|
372
|
+
for (const file of getCachedReferenceCandidateFiles(index, definition, exportedNames, false, languageId)) {
|
|
373
|
+
candidateFiles.add(fileIdentityKey(file));
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
746
377
|
for (const module of index.byFile.values()) {
|
|
747
378
|
const file = module.file;
|
|
379
|
+
if (candidateFiles && !candidateFiles.has(fileIdentityKey(file)))
|
|
380
|
+
continue;
|
|
748
381
|
if (refs.length >= maxRefs) {
|
|
749
382
|
break;
|
|
750
383
|
}
|
|
@@ -772,18 +405,16 @@ async function collectVerifiedCallsiteReferences(index, changedSymbol, maxRefs,
|
|
|
772
405
|
file,
|
|
773
406
|
line: gotoNode.startPosition.row + 1,
|
|
774
407
|
column: gotoNode.startPosition.column + 1,
|
|
775
|
-
});
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
};
|
|
783
|
-
if (sameDefinition(result.definition, def)) {
|
|
408
|
+
}, parsed);
|
|
409
|
+
// Navigation rejects invalid C++ arity. Compatibility diagnostics need
|
|
410
|
+
// the unique lexical/import binding before judging the argument count.
|
|
411
|
+
const definition = result.status === "ok" ? result.definition : cppUnqualifiedCallTarget(index, file, parsed, target);
|
|
412
|
+
if (definition) {
|
|
413
|
+
if (sameDefinition(definition, def) ||
|
|
414
|
+
equivalentDefinitions?.some((candidate) => sameDefinition(definition, candidate))) {
|
|
784
415
|
const range = toRange(gotoNode);
|
|
785
416
|
const key = `${fileIdentityKey(file)}:${range.start.line}:${range.start.column}`;
|
|
786
|
-
if (!seen.has(key)) {
|
|
417
|
+
if (!seen.has(key) && !excludedReferences.has(key)) {
|
|
787
418
|
seen.add(key);
|
|
788
419
|
refs.push({ file, range });
|
|
789
420
|
}
|
|
@@ -821,8 +452,82 @@ function incrementSkippedReason(diagnostics, reason) {
|
|
|
821
452
|
}
|
|
822
453
|
diagnostics.skippedByReason[reason] = (diagnostics.skippedByReason[reason] ?? 0) + 1;
|
|
823
454
|
}
|
|
455
|
+
/** Declaration containers whose `name` field names the receiver type at a member call. */
|
|
456
|
+
const OWNER_CONTAINER_TYPES = {
|
|
457
|
+
class_declaration: true,
|
|
458
|
+
class_definition: true,
|
|
459
|
+
class_specifier: true,
|
|
460
|
+
impl_item: true,
|
|
461
|
+
interface_declaration: true,
|
|
462
|
+
object_declaration: true,
|
|
463
|
+
struct_specifier: true,
|
|
464
|
+
trait_item: true,
|
|
465
|
+
};
|
|
466
|
+
function ownerTypeNameOf(declaration, source) {
|
|
467
|
+
let current = declaration.parent;
|
|
468
|
+
while (current) {
|
|
469
|
+
if (OWNER_CONTAINER_TYPES[current.type]) {
|
|
470
|
+
const name = current.childForFieldName("name");
|
|
471
|
+
return name ? sliceText(name, source) : null;
|
|
472
|
+
}
|
|
473
|
+
current = current.parent;
|
|
474
|
+
}
|
|
475
|
+
return null;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Resolve which receiver binding form a callsite uses. Python bare calls reach the plain function
|
|
479
|
+
* and pass the receiver explicitly; Python member calls on a provably class-valued receiver do the
|
|
480
|
+
* same only for instance methods, because class and static methods bind (or declare) no instance
|
|
481
|
+
* receiver. Rust `Type::target(...)` calls are unbound UFCS forms. C# follows the shared member
|
|
482
|
+
* lookup rule: resolved extension callsites are static-class (`Ext.M(value)`, `Alias.Ext.M(value)`)
|
|
483
|
+
* or bare calls inside the class, all of which pass the `this` receiver explicitly.
|
|
484
|
+
* Everything else supplies the receiver through the call form.
|
|
485
|
+
*/
|
|
486
|
+
function callBindingForm(input) {
|
|
487
|
+
const { languageId, callNode, source, parsedCallsite, file, index, declarationKind, ownerTypeName } = input;
|
|
488
|
+
const callee = callTargetNode(callNode);
|
|
489
|
+
if (languageId === "rust") {
|
|
490
|
+
return callee?.type === "scoped_identifier" ? "unbound" : "bound";
|
|
491
|
+
}
|
|
492
|
+
if (languageId === "csharp") {
|
|
493
|
+
return memberLookupBinding(languageId);
|
|
494
|
+
}
|
|
495
|
+
if (languageId !== "python" || !callee) {
|
|
496
|
+
return "bound";
|
|
497
|
+
}
|
|
498
|
+
if (callee.type === "identifier") {
|
|
499
|
+
return "unbound";
|
|
500
|
+
}
|
|
501
|
+
if (callee.type !== "attribute") {
|
|
502
|
+
return "bound";
|
|
503
|
+
}
|
|
504
|
+
const receiver = callee.namedChildren[0] ?? null;
|
|
505
|
+
if (!receiver) {
|
|
506
|
+
return "bound";
|
|
507
|
+
}
|
|
508
|
+
const receiverText = sliceText(receiver, source).trim();
|
|
509
|
+
if (receiverText === "self" || receiverText === "cls" || receiverText === "super()") {
|
|
510
|
+
return "bound";
|
|
511
|
+
}
|
|
512
|
+
if (declarationKind !== "instance-method") {
|
|
513
|
+
return "bound";
|
|
514
|
+
}
|
|
515
|
+
if (ownerTypeName && receiverText === ownerTypeName) {
|
|
516
|
+
return "unbound";
|
|
517
|
+
}
|
|
518
|
+
if (receiver.type === "identifier") {
|
|
519
|
+
const module = index.byFile.get(fileIdentityKey(file));
|
|
520
|
+
if (module) {
|
|
521
|
+
const resolved = resolveNamedDefinition(index, module, file, parsedCallsite.sup, receiverText);
|
|
522
|
+
if (resolved?.status === "ok" && resolved.definition.kind === SymbolKind.Class) {
|
|
523
|
+
return "unbound";
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
return "bound";
|
|
528
|
+
}
|
|
824
529
|
async function buildCallCompatibilityHintForReference(input) {
|
|
825
|
-
const { index, changedSymbol, signature, ref, callerRangeIndex, diagnostics, projectRoot } = input;
|
|
530
|
+
const { index, changedSymbol, signature, unboundSignature, declarationKind, ownerTypeName, ref, callerRangeIndex, diagnostics, projectRoot, } = input;
|
|
826
531
|
if (fileIdentityKey(ref.file) === fileIdentityKey(changedSymbol.file) &&
|
|
827
532
|
sameRangeStart(ref.range, changedSymbol.range)) {
|
|
828
533
|
return null;
|
|
@@ -849,7 +554,30 @@ async function buildCallCompatibilityHintForReference(input) {
|
|
|
849
554
|
}
|
|
850
555
|
return null;
|
|
851
556
|
}
|
|
852
|
-
|
|
557
|
+
// Pick the arity for the call form: an unbound call passes the receiver as its first argument,
|
|
558
|
+
// so it must be compared against the receiver-inclusive range instead of the bound one.
|
|
559
|
+
let expected = signature;
|
|
560
|
+
const hasDistinctUnboundForm = unboundSignature !== null &&
|
|
561
|
+
(unboundSignature.minArgs !== signature.minArgs || unboundSignature.maxArgs !== signature.maxArgs);
|
|
562
|
+
if (hasDistinctUnboundForm) {
|
|
563
|
+
const callNode = parsedCallsite.tree ? locateCallsiteCallNode(callsiteRequest) : null;
|
|
564
|
+
const binding = callNode
|
|
565
|
+
? callBindingForm({
|
|
566
|
+
languageId: parsedCallsite.sup.id,
|
|
567
|
+
callNode,
|
|
568
|
+
source: parsedCallsite.source,
|
|
569
|
+
parsedCallsite,
|
|
570
|
+
file: ref.file,
|
|
571
|
+
index,
|
|
572
|
+
declarationKind,
|
|
573
|
+
ownerTypeName,
|
|
574
|
+
})
|
|
575
|
+
: "bound";
|
|
576
|
+
if (binding === "unbound" && unboundSignature) {
|
|
577
|
+
expected = unboundSignature;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
const compatibility = classifyCompatibility(expected, actual);
|
|
853
581
|
const callerSymbolId = findCallerSymbolId(callerRangeIndex, ref);
|
|
854
582
|
const callsiteFile = projectRoot ? path.relative(projectRoot, ref.file).replace(/\\/g, "/") : ref.file;
|
|
855
583
|
return {
|
|
@@ -858,7 +586,7 @@ async function buildCallCompatibilityHintForReference(input) {
|
|
|
858
586
|
callsiteFile,
|
|
859
587
|
callsiteRange: ref.range,
|
|
860
588
|
...(callerSymbolId ? { callerSymbolId } : {}),
|
|
861
|
-
expected
|
|
589
|
+
expected,
|
|
862
590
|
actual,
|
|
863
591
|
};
|
|
864
592
|
}
|
|
@@ -899,27 +627,82 @@ export async function attachCallCompatibilityHints(index, changedSymbols, option
|
|
|
899
627
|
incrementSkippedReason(diagnostics, "unsupported_language");
|
|
900
628
|
continue;
|
|
901
629
|
}
|
|
902
|
-
const
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
630
|
+
const module = index.byFile.get(fileIdentityKey(changedSymbol.file));
|
|
631
|
+
const referenceDef = module?.locals.find((local) => local.kind === changedSymbol.kind && sameRangeStart(local.range, changedSymbol.range)) ?? {
|
|
632
|
+
file: changedSymbol.file,
|
|
633
|
+
localName: changedSymbol.name,
|
|
634
|
+
kind: changedSymbol.kind,
|
|
635
|
+
range: changedSymbol.range,
|
|
636
|
+
};
|
|
637
|
+
const signature = referenceDef.callable?.arity
|
|
638
|
+
? { ...referenceDef.callable.arity, confidence: "high" }
|
|
639
|
+
: extractCallableSignature({
|
|
640
|
+
languageId: parsedDefinition.sup.id,
|
|
641
|
+
source: parsedDefinition.source,
|
|
642
|
+
symbolStartIndex: changedSymbol.range.start.index ?? 0,
|
|
643
|
+
tree: parsedDefinition.tree,
|
|
644
|
+
});
|
|
908
645
|
if (!signature) {
|
|
909
646
|
incrementSkippedReason(diagnostics, "signature_unknown");
|
|
910
647
|
continue;
|
|
911
648
|
}
|
|
912
|
-
|
|
649
|
+
// Receiver-bearing declarations accept different argument counts per call form: a bound call
|
|
650
|
+
// never passes the receiver, an unbound call does. Both arities are merged below so prototype
|
|
651
|
+
// defaults apply to each.
|
|
652
|
+
const unboundSignature = referenceDef.callable?.arity
|
|
653
|
+
? { ...(referenceDef.callable.unboundArity ?? referenceDef.callable.arity), confidence: "high" }
|
|
654
|
+
: extractCallableSignature({
|
|
655
|
+
languageId: parsedDefinition.sup.id,
|
|
656
|
+
source: parsedDefinition.source,
|
|
657
|
+
symbolStartIndex: changedSymbol.range.start.index ?? 0,
|
|
658
|
+
tree: parsedDefinition.tree,
|
|
659
|
+
binding: "unbound",
|
|
660
|
+
});
|
|
661
|
+
const hasDistinctUnboundForm = unboundSignature !== null &&
|
|
662
|
+
(unboundSignature.minArgs !== signature.minArgs || unboundSignature.maxArgs !== signature.maxArgs);
|
|
663
|
+
const arityTargets = hasDistinctUnboundForm && unboundSignature ? [signature, unboundSignature] : [signature];
|
|
664
|
+
const cppBinding = changedCppCallableBinding(index, changedSymbol, parsedDefinition);
|
|
665
|
+
const equivalentBindings = cppBinding ? cppEquivalentCallableBindings(cppBinding) : undefined;
|
|
666
|
+
const hasOverloads = cppBinding && equivalentBindings
|
|
667
|
+
? equivalentBindings.length !== (cppBinding.sameScopeFunctionBindings?.length ?? 1)
|
|
668
|
+
: hasSameFileOverloadCandidates(index, changedSymbol, parsedDefinition);
|
|
669
|
+
if (hasOverloads) {
|
|
913
670
|
incrementSkippedReason(diagnostics, "overload_set");
|
|
914
671
|
continue;
|
|
915
672
|
}
|
|
673
|
+
const equivalentDefinitions = parsedDefinition.sup.id === "cpp"
|
|
674
|
+
? await getCppEquivalentCallableDefinitions(index, referenceDef, parsedDefinition)
|
|
675
|
+
: undefined;
|
|
676
|
+
// Default arguments can live on a prototype rather than its definition.
|
|
677
|
+
// Both sites describe the same accepted range.
|
|
678
|
+
if (equivalentDefinitions) {
|
|
679
|
+
for (const definition of equivalentDefinitions) {
|
|
680
|
+
const arity = definition.callable?.arity;
|
|
681
|
+
if (!arity)
|
|
682
|
+
continue;
|
|
683
|
+
for (const target of arityTargets) {
|
|
684
|
+
target.minArgs = Math.min(target.minArgs, arity.minArgs);
|
|
685
|
+
if (target.maxArgs === null || arity.maxArgs === null) {
|
|
686
|
+
target.maxArgs = null;
|
|
687
|
+
}
|
|
688
|
+
else {
|
|
689
|
+
target.maxArgs = Math.max(target.maxArgs, arity.maxArgs);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
const changedStartIndex = changedSymbol.range.start.index;
|
|
695
|
+
const declarationNode = changedStartIndex === undefined ? null : callableDeclarationAt(parsedDefinition.tree, changedStartIndex);
|
|
696
|
+
const declarationKind = referenceDef.callable?.kind ??
|
|
697
|
+
(declarationNode
|
|
698
|
+
? getCallableDeclarationKind({
|
|
699
|
+
languageId: parsedDefinition.sup.id,
|
|
700
|
+
source: parsedDefinition.source,
|
|
701
|
+
declaration: declarationNode,
|
|
702
|
+
})
|
|
703
|
+
: null);
|
|
704
|
+
const ownerTypeName = declarationNode ? ownerTypeNameOf(declarationNode, parsedDefinition.source) : null;
|
|
916
705
|
const referenceScanLimit = referenceScanLimitForCallsites(options.maxRefs);
|
|
917
|
-
const referenceDef = {
|
|
918
|
-
file: changedSymbol.file,
|
|
919
|
-
localName: changedSymbol.name,
|
|
920
|
-
kind: changedSymbol.kind,
|
|
921
|
-
range: changedSymbol.range,
|
|
922
|
-
};
|
|
923
706
|
if (options.workBudget) {
|
|
924
707
|
recordReferenceLookupStarted(options.workBudget);
|
|
925
708
|
}
|
|
@@ -931,7 +714,7 @@ export async function attachCallCompatibilityHints(index, changedSymbols, option
|
|
|
931
714
|
if (referenceResult.status === "ok") {
|
|
932
715
|
refs = referenceResult.references.filter((ref) => shouldIncludeReference(ref.file));
|
|
933
716
|
}
|
|
934
|
-
const seenRefs = new Set(refs.map((ref) => `${ref.file}:${ref.range.start.line}:${ref.range.start.column}`));
|
|
717
|
+
const seenRefs = new Set(refs.map((ref) => `${fileIdentityKey(ref.file)}:${ref.range.start.line}:${ref.range.start.column}`));
|
|
935
718
|
const hints = [];
|
|
936
719
|
let consideredCallsites = 0;
|
|
937
720
|
const addHintForReference = async (ref) => {
|
|
@@ -942,6 +725,9 @@ export async function attachCallCompatibilityHints(index, changedSymbols, option
|
|
|
942
725
|
index,
|
|
943
726
|
changedSymbol,
|
|
944
727
|
signature,
|
|
728
|
+
unboundSignature: hasDistinctUnboundForm ? unboundSignature : null,
|
|
729
|
+
declarationKind,
|
|
730
|
+
ownerTypeName,
|
|
945
731
|
ref,
|
|
946
732
|
callerRangeIndex,
|
|
947
733
|
diagnostics,
|
|
@@ -959,16 +745,20 @@ export async function attachCallCompatibilityHints(index, changedSymbols, option
|
|
|
959
745
|
}
|
|
960
746
|
await addHintForReference(ref);
|
|
961
747
|
}
|
|
962
|
-
const shouldRunVerifiedScan = consideredCallsites < options.maxRefs &&
|
|
748
|
+
const shouldRunVerifiedScan = consideredCallsites < options.maxRefs &&
|
|
749
|
+
(parsedDefinition.sup.id === "c" ||
|
|
750
|
+
parsedDefinition.sup.id === "cpp" ||
|
|
751
|
+
referenceResult.status !== "ok" ||
|
|
752
|
+
!consideredCallsites);
|
|
963
753
|
if (shouldRunVerifiedScan) {
|
|
964
754
|
const verifiedScanLimit = Math.max(0, Math.min(referenceScanLimit - refs.length, options.maxRefs - consideredCallsites));
|
|
965
755
|
if (verifiedScanLimit) {
|
|
966
|
-
const verifiedCallsites = await collectVerifiedCallsiteReferences(index, changedSymbol, verifiedScanLimit, shouldIncludeReference, diagnostics);
|
|
756
|
+
const verifiedCallsites = await collectVerifiedCallsiteReferences(index, changedSymbol, verifiedScanLimit, shouldIncludeReference, diagnostics, parsedDefinition, equivalentDefinitions, seenRefs);
|
|
967
757
|
for (const ref of verifiedCallsites) {
|
|
968
758
|
if (consideredCallsites >= options.maxRefs) {
|
|
969
759
|
break;
|
|
970
760
|
}
|
|
971
|
-
const key = `${ref.file}:${ref.range.start.line}:${ref.range.start.column}`;
|
|
761
|
+
const key = `${fileIdentityKey(ref.file)}:${ref.range.start.line}:${ref.range.start.column}`;
|
|
972
762
|
if (seenRefs.has(key)) {
|
|
973
763
|
continue;
|
|
974
764
|
}
|