@mrclrchtr/supi-code-intelligence 11.1.0 → 11.3.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/CHANGELOG.md +19 -0
- package/README.md +41 -6
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/README.md +81 -7
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/LICENSE +15 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/README.md +680 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/index.js +7 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/range.js +577 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/major.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/index.js +93 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/constants.js +37 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/re.js +223 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/package.json +78 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/preload.js +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/range.bnf +17 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/valid.js +13 -0
- package/node_modules/@mrclrchtr/supi-lsp/package.json +5 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-collection.ts +11 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +77 -6
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-input-admission.ts +149 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-typescript-project.ts +40 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +174 -49
- package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +53 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/config/operation-support.ts +19 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +22 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/typescript-launch.ts +276 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +22 -10
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +157 -23
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +306 -75
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +4 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +19 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-rename.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/scanner.ts +27 -15
- package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +40 -25
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/call-context.ts +44 -0
- package/package.json +6 -5
- package/src/analysis/capability/capability-warnings.ts +18 -12
- package/src/analysis/health/check.ts +115 -0
- package/src/analysis/health/diagnostics.ts +3 -0
- package/src/analysis/health/file-scope.ts +2 -3
- package/src/analysis/health/semantic-state.ts +38 -0
- package/src/analysis/health/server-status.ts +14 -2
- package/src/analysis/health/signals.ts +2 -0
- package/src/analysis/health/status.ts +82 -0
- package/src/analysis/refactor/apply.ts +17 -8
- package/src/analysis/search/exclusions.ts +47 -0
- package/src/analysis/search/paths.ts +32 -9
- package/src/analysis/target/anchored-structural.ts +3 -8
- package/src/analysis/target/anchored.ts +4 -20
- package/src/analysis/target/identity.ts +1 -1
- package/src/analysis/target/latex-label-container.ts +6 -6
- package/src/analysis/target/latex-section-anchor.ts +6 -6
- package/src/analysis/target/resolution.ts +18 -0
- package/src/analysis/target/symbol.ts +39 -11
- package/src/analysis/target/types.ts +6 -1
- package/src/extension.ts +17 -11
- package/src/session/graph/collect.ts +1 -10
- package/src/session/graph-types.ts +2 -0
- package/src/session/graph-workflow.ts +1 -0
- package/src/session/health-types.ts +7 -0
- package/src/session/health-workflow.ts +8 -43
- package/src/session/inspect/collect.ts +8 -2
- package/src/session/inspect/file-point.ts +2 -3
- package/src/session/inspect-workflow.ts +1 -1
- package/src/session/orientation/collect.ts +184 -20
- package/src/session/orientation/context-facts.ts +27 -2
- package/src/session/orientation/context-sections.ts +49 -3
- package/src/session/orientation/facts.ts +132 -0
- package/src/session/orientation/gather.ts +98 -11
- package/src/session/orientation/workspace-context.ts +16 -6
- package/src/session/orientation-types.ts +8 -0
- package/src/session/orientation-workflow.ts +20 -6
- package/src/session/refactor-identity.ts +76 -0
- package/src/session/refactor-plans.ts +5 -2
- package/src/session/refactor-workflow.ts +15 -17
- package/src/session/target-store.ts +3 -18
- package/src/session/target-workflow.ts +33 -16
- package/src/substrate/lsp/recovery.ts +5 -5
- package/src/tool/code_find/guidance.ts +1 -1
- package/src/tool/code_find/render.ts +8 -4
- package/src/tool/code_find/result.ts +78 -6
- package/src/tool/code_find/spec.ts +4 -3
- package/src/tool/code_find/structured.ts +25 -9
- package/src/tool/code_graph/details.ts +1 -0
- package/src/tool/code_graph/display.ts +1 -1
- package/src/tool/code_graph/guidance.ts +1 -1
- package/src/tool/code_graph/markdown.ts +11 -6
- package/src/tool/code_graph/read-next.ts +38 -9
- package/src/tool/code_graph/reference-selection.ts +30 -0
- package/src/tool/code_graph/result.ts +25 -118
- package/src/tool/code_graph/section.ts +133 -0
- package/src/tool/code_graph/spec.ts +3 -3
- package/src/tool/code_graph/structured.ts +17 -6
- package/src/tool/code_health/display-paths.ts +92 -0
- package/src/tool/code_health/file-scope-markdown.ts +3 -2
- package/src/tool/code_health/markdown.ts +12 -2
- package/src/tool/code_health/result.ts +18 -3
- package/src/tool/code_health/spec.ts +5 -3
- package/src/tool/code_health/structured-schema.ts +250 -0
- package/src/tool/code_health/structured.ts +256 -0
- package/src/tool/code_inspect/result.ts +11 -5
- package/src/tool/code_inspect/spec.ts +7 -1
- package/src/tool/code_inspect/structured.ts +231 -0
- package/src/tool/code_orientation/execute.ts +1 -1
- package/src/tool/code_orientation/result.ts +31 -8
- package/src/tool/code_orientation/spec.ts +2 -0
- package/src/tool/code_orientation/structured-schema.ts +617 -0
- package/src/tool/code_orientation/structured-workspace.ts +194 -0
- package/src/tool/code_orientation/structured.ts +189 -0
- package/src/tool/code_orientation/workspace-format.ts +2 -5
- package/src/tool/code_orientation/workspace-observations.ts +81 -0
- package/src/tool/code_orientation/workspace-output.ts +5 -0
- package/src/tool/code_orientation/workspace-projects.ts +16 -31
- package/src/tool/code_orientation/workspace-sections.ts +46 -32
- package/src/tool/code_refactor_apply/execute.ts +1 -1
- package/src/tool/code_refactor_apply/result.ts +14 -6
- package/src/tool/code_refactor_apply/spec.ts +2 -0
- package/src/tool/code_refactor_apply/structured.ts +49 -0
- package/src/tool/code_refactor_plan/result.ts +18 -9
- package/src/tool/code_refactor_plan/spec.ts +2 -0
- package/src/tool/code_refactor_plan/structured.ts +127 -0
- package/src/tool/code_resolve/markdown.ts +6 -30
- package/src/tool/code_resolve/result.ts +24 -11
- package/src/tool/code_resolve/structured.ts +7 -9
- package/src/tool/result/refactor.ts +8 -5
- package/src/tool/result/structured.ts +8 -5
- package/src/tool/result/types.ts +18 -14
- package/src/tool/schemas.ts +12 -6
- package/src/ui/status-command.ts +147 -322
- package/src/ui/status-overlay.ts +584 -421
- package/src/ui/status-presentation.ts +108 -0
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
type StructuralProvider,
|
|
18
18
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
19
19
|
import type { AnchorKind } from "../../session/target-store.ts";
|
|
20
|
-
import type {
|
|
20
|
+
import type { AnchoredResolutionSource } from "../../types/index.ts";
|
|
21
21
|
import { resolveFromStructural } from "./anchored-structural.ts";
|
|
22
22
|
import {
|
|
23
23
|
canonicalFileDeclarationKind,
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
type DeclarationOccurrenceIdentity,
|
|
26
26
|
} from "./identity.ts";
|
|
27
27
|
import { resolveTexlabSectionLabelCollision } from "./latex-label-container.ts";
|
|
28
|
+
import { createAnchoredResolution } from "./resolution.ts";
|
|
28
29
|
import type { DisambiguationCandidateData, ResolvedTargetData, TargetOutcome } from "./types.ts";
|
|
29
30
|
|
|
30
31
|
/** 1-based symbol anchor position (mirrors the runtime `SymbolAnchor`). */
|
|
@@ -93,25 +94,10 @@ function matchSymbolAt(s: CodeSymbol, line: number, character: number): "exact"
|
|
|
93
94
|
return null;
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
function buildResolution(
|
|
97
|
-
requested: Anchor,
|
|
98
|
-
resolvedAnchor: Anchor,
|
|
99
|
-
snapped: boolean,
|
|
100
|
-
source: AnchoredResolutionSource,
|
|
101
|
-
): AnchoredResolutionMetadata {
|
|
102
|
-
return {
|
|
103
|
-
requested: { line: requested.line, character: requested.character },
|
|
104
|
-
resolved: { line: resolvedAnchor.line, character: resolvedAnchor.character },
|
|
105
|
-
snapped,
|
|
106
|
-
source,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
97
|
function resolvedFromSymbol(
|
|
111
98
|
file: string,
|
|
112
99
|
s: CodeSymbol,
|
|
113
100
|
opts: {
|
|
114
|
-
snapped: boolean;
|
|
115
101
|
requested: Anchor;
|
|
116
102
|
source: AnchoredResolutionSource;
|
|
117
103
|
identity: DeclarationOccurrenceIdentity;
|
|
@@ -135,7 +121,7 @@ function resolvedFromSymbol(
|
|
|
135
121
|
provenance: opts.identity.structuralEvidence ? ["semantic", "structural"] : ["semantic"],
|
|
136
122
|
anchorKind: (s.nameAnchor ? "name" : "declaration") as AnchorKind,
|
|
137
123
|
container: s.container ?? null,
|
|
138
|
-
resolution:
|
|
124
|
+
resolution: createAnchoredResolution(opts.requested, a, opts.source),
|
|
139
125
|
},
|
|
140
126
|
};
|
|
141
127
|
}
|
|
@@ -213,7 +199,6 @@ async function resolveFromSemantic(
|
|
|
213
199
|
const resolveIdentity = createCodeSymbolIdentityResolver(file, symbols, structural, control);
|
|
214
200
|
if (exact.length === 1) {
|
|
215
201
|
return resolvedFromSymbol(file, exact[0], {
|
|
216
|
-
snapped: false,
|
|
217
202
|
requested,
|
|
218
203
|
source: "semantic",
|
|
219
204
|
identity: await resolveIdentity(exact[0]),
|
|
@@ -222,7 +207,6 @@ async function resolveFromSemantic(
|
|
|
222
207
|
if (exact.length > 1) return candidatesFromSymbols(file, exact, resolveIdentity);
|
|
223
208
|
if (snap.length === 1) {
|
|
224
209
|
return resolvedFromSymbol(file, snap[0], {
|
|
225
|
-
snapped: true,
|
|
226
210
|
requested,
|
|
227
211
|
source: "semantic",
|
|
228
212
|
identity: await resolveIdentity(snap[0]),
|
|
@@ -296,7 +280,7 @@ function coordinateNotOnSymbolMessage(
|
|
|
296
280
|
const reason = detail ? ` (on \`${detail}\`)` : "";
|
|
297
281
|
return (
|
|
298
282
|
`No symbol target resolved at \`${at}\`${reason}. ` +
|
|
299
|
-
"
|
|
283
|
+
"Target resolution requires a real symbol backed by provider evidence; " +
|
|
300
284
|
"use `code_inspect` for point-level facts at this coordinate, or pass the identifier coordinate of a declaration."
|
|
301
285
|
);
|
|
302
286
|
}
|
|
@@ -306,7 +306,7 @@ export async function refineTargetOutcomeIdentity(
|
|
|
306
306
|
): Promise<TargetOutcome> {
|
|
307
307
|
if (outcome.kind === "resolved") {
|
|
308
308
|
return {
|
|
309
|
-
|
|
309
|
+
...outcome,
|
|
310
310
|
target: await refineTypeAliasIdentity(outcome.target, structural, control),
|
|
311
311
|
};
|
|
312
312
|
}
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
type DeclarationOccurrenceCandidate,
|
|
12
12
|
declarationOccurrenceFor,
|
|
13
13
|
} from "./identity.ts";
|
|
14
|
+
import { createAnchoredResolution } from "./resolution.ts";
|
|
14
15
|
import type { ResolvedTargetData, TargetOutcome } from "./types.ts";
|
|
15
16
|
|
|
16
17
|
type LabelOutlineCandidate = DeclarationOccurrenceCandidate & {
|
|
@@ -110,12 +111,11 @@ export async function resolveLatexLabelTargetAtAnchor(input: {
|
|
|
110
111
|
provenance: ["structural"],
|
|
111
112
|
anchorKind: "name",
|
|
112
113
|
container: label.container,
|
|
113
|
-
resolution:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
},
|
|
114
|
+
resolution: createAnchoredResolution(
|
|
115
|
+
{ line: input.line, character: input.character },
|
|
116
|
+
anchor,
|
|
117
|
+
"structural-identifier",
|
|
118
|
+
),
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type DeclarationOccurrenceCandidate,
|
|
11
11
|
declarationOccurrenceFor,
|
|
12
12
|
} from "./identity.ts";
|
|
13
|
+
import { createAnchoredResolution } from "./resolution.ts";
|
|
13
14
|
import type { ResolvedTargetData } from "./types.ts";
|
|
14
15
|
|
|
15
16
|
interface SectionCandidate extends DeclarationOccurrenceCandidate {
|
|
@@ -67,12 +68,11 @@ export async function resolveLatexSectionTargetAtAnchor(input: {
|
|
|
67
68
|
provenance: ["structural"],
|
|
68
69
|
anchorKind: "name",
|
|
69
70
|
container: selected.container,
|
|
70
|
-
resolution:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
},
|
|
71
|
+
resolution: createAnchoredResolution(
|
|
72
|
+
{ line: input.line, character: input.character },
|
|
73
|
+
anchor,
|
|
74
|
+
"structural",
|
|
75
|
+
),
|
|
76
76
|
};
|
|
77
77
|
} catch (error) {
|
|
78
78
|
if (isCodeRequestInterruption(error, input.control)) throw error;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AnchoredResolutionMetadata, AnchoredResolutionSource } from "../../types/index.ts";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Record one coordinate request independently of the provider's symbol-match category.
|
|
5
|
+
* An exact identifier hit still snaps when normalized to a different name-anchor position.
|
|
6
|
+
*/
|
|
7
|
+
export function createAnchoredResolution(
|
|
8
|
+
requested: AnchoredResolutionMetadata["requested"],
|
|
9
|
+
resolved: AnchoredResolutionMetadata["resolved"],
|
|
10
|
+
source: AnchoredResolutionSource,
|
|
11
|
+
): AnchoredResolutionMetadata {
|
|
12
|
+
return {
|
|
13
|
+
requested: { line: requested.line, character: requested.character },
|
|
14
|
+
resolved: { line: resolved.line, character: resolved.character },
|
|
15
|
+
snapped: requested.line !== resolved.line || requested.character !== resolved.character,
|
|
16
|
+
source,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import { isWithinOrEqual } from "@mrclrchtr/supi-core/project";
|
|
18
18
|
import type { TargetSymbolKind } from "../../session/target-input.ts";
|
|
19
19
|
import type { AnchorKind } from "../../session/target-store.ts";
|
|
20
|
+
import { describePartialQuery } from "../search/exclusions.ts";
|
|
20
21
|
import { normalizePath } from "../search/paths.ts";
|
|
21
22
|
import type {
|
|
22
23
|
DisambiguationCandidateData,
|
|
@@ -131,7 +132,7 @@ export async function resolveSymbolTarget(
|
|
|
131
132
|
reason: `Symbol discovery for \`${symbol}\` is unavailable: ${result.reason}`,
|
|
132
133
|
};
|
|
133
134
|
}
|
|
134
|
-
if (result.data.length === 0) return emptySymbolOutcome(symbol, result, options?.path);
|
|
135
|
+
if (result.data.length === 0) return emptySymbolOutcome(symbol, result, cwd, options?.path);
|
|
135
136
|
|
|
136
137
|
const scoped = result.data
|
|
137
138
|
.filter((candidate) => (scopePath ? isWithinOrEqual(scopePath, candidate.file) : true))
|
|
@@ -139,7 +140,7 @@ export async function resolveSymbolTarget(
|
|
|
139
140
|
const eligible = options?.exportedOnly
|
|
140
141
|
? scoped.filter((candidate) => !NON_EXPORTED_KINDS.has(candidate.kind))
|
|
141
142
|
: scoped;
|
|
142
|
-
if (eligible.length === 0) return emptySymbolOutcome(symbol, result, options?.path);
|
|
143
|
+
if (eligible.length === 0) return emptySymbolOutcome(symbol, result, cwd, options?.path);
|
|
143
144
|
|
|
144
145
|
const requestedKind = options?.kind;
|
|
145
146
|
if (requestedKind) {
|
|
@@ -150,7 +151,7 @@ export async function resolveSymbolTarget(
|
|
|
150
151
|
return buildCandidateOutcome({
|
|
151
152
|
kind: "kind-mismatch",
|
|
152
153
|
candidates: eligible,
|
|
153
|
-
...candidateCompleteness(result, eligible.length),
|
|
154
|
+
...candidateCompleteness(result, eligible.length, cwd),
|
|
154
155
|
semantic,
|
|
155
156
|
cwd,
|
|
156
157
|
maxResults: options.maxResults,
|
|
@@ -160,7 +161,8 @@ export async function resolveSymbolTarget(
|
|
|
160
161
|
}
|
|
161
162
|
return resolveCandidates({
|
|
162
163
|
candidates: exactKind,
|
|
163
|
-
...candidateCompleteness(result, exactKind.length),
|
|
164
|
+
...candidateCompleteness(result, exactKind.length, cwd),
|
|
165
|
+
exclusionNote: exclusionOnlyNote(result, cwd),
|
|
164
166
|
semantic,
|
|
165
167
|
cwd,
|
|
166
168
|
maxResults: options.maxResults,
|
|
@@ -170,7 +172,8 @@ export async function resolveSymbolTarget(
|
|
|
170
172
|
|
|
171
173
|
return resolveCandidates({
|
|
172
174
|
candidates: eligible,
|
|
173
|
-
...candidateCompleteness(result, eligible.length),
|
|
175
|
+
...candidateCompleteness(result, eligible.length, cwd),
|
|
176
|
+
exclusionNote: exclusionOnlyNote(result, cwd),
|
|
174
177
|
semantic,
|
|
175
178
|
cwd,
|
|
176
179
|
maxResults: options?.maxResults,
|
|
@@ -187,7 +190,11 @@ function normalizeProviderKind(kind: string): string {
|
|
|
187
190
|
}
|
|
188
191
|
|
|
189
192
|
async function resolveCandidates(
|
|
190
|
-
options: CandidateOutcomeBase &
|
|
193
|
+
options: CandidateOutcomeBase &
|
|
194
|
+
Omit<TargetCandidateCompleteness, "omittedCount"> & {
|
|
195
|
+
/** Disclosure for a unique match beside policy-excluded rows. */
|
|
196
|
+
exclusionNote?: string;
|
|
197
|
+
},
|
|
191
198
|
): Promise<TargetOutcome> {
|
|
192
199
|
const {
|
|
193
200
|
candidates,
|
|
@@ -198,13 +205,16 @@ async function resolveCandidates(
|
|
|
198
205
|
totalCount,
|
|
199
206
|
partialReason,
|
|
200
207
|
partialMessage,
|
|
208
|
+
exclusionNote,
|
|
201
209
|
} = options;
|
|
202
210
|
const ranged = candidates.filter(
|
|
203
211
|
(candidate) =>
|
|
204
212
|
candidate.declarationAnchor.line > 0 || candidate.declarationAnchor.character > 0,
|
|
205
213
|
);
|
|
206
214
|
if (ranged.length === 1 && totalCount !== null) {
|
|
207
|
-
|
|
215
|
+
const resolved = resolvedTarget(await refineResolvedSymbolAnchor(ranged[0], semantic, control));
|
|
216
|
+
// Exclusion-only evidence resolves, but the excluded rows stay disclosed.
|
|
217
|
+
return exclusionNote ? { ...resolved, notes: [exclusionNote] } : resolved;
|
|
208
218
|
}
|
|
209
219
|
return buildCandidateOutcome({
|
|
210
220
|
kind: "disambiguation",
|
|
@@ -219,7 +229,7 @@ async function resolveCandidates(
|
|
|
219
229
|
});
|
|
220
230
|
}
|
|
221
231
|
|
|
222
|
-
function resolvedTarget(candidate: CodeSymbol): TargetOutcome {
|
|
232
|
+
function resolvedTarget(candidate: CodeSymbol): Extract<TargetOutcome, { kind: "resolved" }> {
|
|
223
233
|
const anchor = anchorOf(candidate);
|
|
224
234
|
return {
|
|
225
235
|
kind: "resolved",
|
|
@@ -251,12 +261,29 @@ interface CandidateOutcomeBase {
|
|
|
251
261
|
function candidateCompleteness(
|
|
252
262
|
result: Exclude<CodeQueryResult<CodeSymbol[]>, { kind: "unavailable" }>,
|
|
253
263
|
totalCount: number,
|
|
264
|
+
cwd: string,
|
|
254
265
|
): Omit<TargetCandidateCompleteness, "omittedCount"> {
|
|
255
|
-
|
|
256
|
-
|
|
266
|
+
// Policy exclusions alone remove only rows the workspace marked out of
|
|
267
|
+
// automatic scope; the retained in-policy rows are complete. Failures and
|
|
268
|
+
// coverage gaps keep the total unknown.
|
|
269
|
+
return result.kind === "partial" && result.metadata?.exclusionOnly !== true
|
|
270
|
+
? {
|
|
271
|
+
totalCount: null,
|
|
272
|
+
partialReason: "provider-limited",
|
|
273
|
+
partialMessage: describePartialQuery(result.reason, result.metadata, cwd),
|
|
274
|
+
}
|
|
257
275
|
: { totalCount, partialReason: null };
|
|
258
276
|
}
|
|
259
277
|
|
|
278
|
+
/** Describe exclusion-only evidence so a resolved target still discloses dropped rows. */
|
|
279
|
+
function exclusionOnlyNote(
|
|
280
|
+
result: Exclude<CodeQueryResult<CodeSymbol[]>, { kind: "unavailable" }>,
|
|
281
|
+
cwd: string,
|
|
282
|
+
): string | undefined {
|
|
283
|
+
if (result.kind !== "partial" || result.metadata?.exclusionOnly !== true) return undefined;
|
|
284
|
+
return describePartialQuery(result.reason, result.metadata, cwd);
|
|
285
|
+
}
|
|
286
|
+
|
|
260
287
|
type CandidateOutcomeOptions = CandidateOutcomeBase &
|
|
261
288
|
Omit<TargetCandidateCompleteness, "omittedCount"> &
|
|
262
289
|
(
|
|
@@ -272,12 +299,13 @@ type CandidateOutcomeOptions = CandidateOutcomeBase &
|
|
|
272
299
|
function emptySymbolOutcome(
|
|
273
300
|
symbol: string,
|
|
274
301
|
result: Exclude<CodeQueryResult<CodeSymbol[]>, { kind: "unavailable" }>,
|
|
302
|
+
cwd: string,
|
|
275
303
|
scope?: string,
|
|
276
304
|
): TargetOutcome {
|
|
277
305
|
if (result.kind === "partial") {
|
|
278
306
|
return {
|
|
279
307
|
kind: "unavailable",
|
|
280
|
-
reason: `Symbol discovery for \`${symbol}\` is incomplete: ${result.reason}`,
|
|
308
|
+
reason: `Symbol discovery for \`${symbol}\` is incomplete: ${describePartialQuery(result.reason, result.metadata, cwd)}`,
|
|
281
309
|
};
|
|
282
310
|
}
|
|
283
311
|
return {
|
|
@@ -160,7 +160,12 @@ export interface TargetCandidateCompleteness {
|
|
|
160
160
|
* the resolution pipeline itself stays presentation-agnostic.
|
|
161
161
|
*/
|
|
162
162
|
export type TargetOutcome =
|
|
163
|
-
| {
|
|
163
|
+
| {
|
|
164
|
+
kind: "resolved";
|
|
165
|
+
target: ResolvedTargetData;
|
|
166
|
+
/** Request-scoped evidence notes, such as policy exclusions beside a unique match. */
|
|
167
|
+
notes?: readonly string[];
|
|
168
|
+
}
|
|
164
169
|
| { kind: "group"; group: ResolvedTargetGroupData }
|
|
165
170
|
| ({
|
|
166
171
|
kind: "disambiguation";
|
package/src/extension.ts
CHANGED
|
@@ -47,7 +47,7 @@ export default function codeIntelligenceExtension(
|
|
|
47
47
|
);
|
|
48
48
|
registerWorkspaceRecoveryHandler(pi, lspState);
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
const resolveSession = (cwd: string) => {
|
|
51
51
|
const session = getOrCreateSession?.(cwd) ?? app.getSession(cwd) ?? app.createSession(cwd);
|
|
52
52
|
const lease = lspState.providerLease;
|
|
53
53
|
if (lease?.cwd === cwd) {
|
|
@@ -56,17 +56,23 @@ export default function codeIntelligenceExtension(
|
|
|
56
56
|
}
|
|
57
57
|
session.setHomeDir(homeDir);
|
|
58
58
|
return session;
|
|
59
|
-
}
|
|
59
|
+
};
|
|
60
|
+
registerCodeIntelligenceTools(pi, resolveSession);
|
|
60
61
|
|
|
61
|
-
registerCiStatusCommand(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
registerCiStatusCommand(
|
|
63
|
+
pi,
|
|
64
|
+
homeDir,
|
|
65
|
+
{
|
|
66
|
+
get: (cwd) =>
|
|
67
|
+
lspState.providerLease?.cwd === cwd
|
|
68
|
+
? {
|
|
69
|
+
lspController: lspState.controller,
|
|
70
|
+
automaticPathPolicy: lspState.providerLease.automaticPathPolicy,
|
|
71
|
+
}
|
|
72
|
+
: { lspController: null, automaticPathPolicy: null },
|
|
73
|
+
},
|
|
74
|
+
(ctx) => resolveSession(ctx.cwd),
|
|
75
|
+
);
|
|
70
76
|
const lspFooter = registerLspFooterContribution(pi, lspState);
|
|
71
77
|
|
|
72
78
|
pi.on("session_shutdown", () => {
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
readNextAround,
|
|
11
11
|
readNextEnclosingScope,
|
|
12
12
|
readNextTarget,
|
|
13
|
-
readNextTopSites,
|
|
14
13
|
} from "../../analysis/read-next.ts";
|
|
15
14
|
import { collectCallees } from "../../analysis/relations/callees.ts";
|
|
16
15
|
import { collectImplementations } from "../../analysis/relations/implementations.ts";
|
|
@@ -97,14 +96,6 @@ async function collectReferences(options: CollectRelationOptions): Promise<Graph
|
|
|
97
96
|
targetLine,
|
|
98
97
|
"inspect the resolved target before editing",
|
|
99
98
|
),
|
|
100
|
-
...readNextTopSites(
|
|
101
|
-
references.slice(0, options.maxResults).map((reference) => ({
|
|
102
|
-
file: toDisplayPath(options.cwd, reference.file),
|
|
103
|
-
line: reference.line,
|
|
104
|
-
})),
|
|
105
|
-
2,
|
|
106
|
-
"reference",
|
|
107
|
-
),
|
|
108
99
|
],
|
|
109
100
|
};
|
|
110
101
|
}
|
|
@@ -115,7 +106,7 @@ async function collectCalleesRelation(options: CollectRelationOptions): Promise<
|
|
|
115
106
|
kind: "unavailable",
|
|
116
107
|
rel: "callees",
|
|
117
108
|
message:
|
|
118
|
-
"Callees require a name anchor.
|
|
109
|
+
"Callees require a name anchor. To inspect callees, retry code_graph with target.anchor at the symbol's identifier.",
|
|
119
110
|
};
|
|
120
111
|
}
|
|
121
112
|
if (!options.provider?.calleesAt) {
|
|
@@ -75,6 +75,8 @@ export interface CompletedGraphWorkflow {
|
|
|
75
75
|
readonly resolvedDisplayFile: string;
|
|
76
76
|
readonly maxResults: number;
|
|
77
77
|
readonly sections: readonly GraphSection[];
|
|
78
|
+
/** Target-resolution notes, such as anchor snaps or policy exclusions beside a unique match. */
|
|
79
|
+
readonly notes: readonly string[];
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
/** Graph workflow outcome, preserving target disambiguation and failure states. */
|
|
@@ -10,6 +10,9 @@ import type {
|
|
|
10
10
|
import type { CapabilityWarningReport } from "../analysis/capability/capability-warnings.ts";
|
|
11
11
|
import type { SourceTrackingReport } from "../substrate/lsp/source-tracking.ts";
|
|
12
12
|
|
|
13
|
+
/** Maximum detailed error and warning messages retained for each diagnostic file. */
|
|
14
|
+
export const HEALTH_DIAGNOSTIC_MESSAGE_LIMIT = 3;
|
|
15
|
+
|
|
13
16
|
export type HealthSection = "diagnostics" | "servers";
|
|
14
17
|
|
|
15
18
|
/** Final semantic-diagnostics readiness after routing and requested recovery. */
|
|
@@ -33,6 +36,10 @@ export interface HealthServerInfo {
|
|
|
33
36
|
readonly fileTypes: readonly string[];
|
|
34
37
|
readonly status: ProjectServerInfo["status"];
|
|
35
38
|
readonly statusReason?: ProjectServerStatusReason;
|
|
39
|
+
/** Compiler selection used by this route generation, if automatically resolved. */
|
|
40
|
+
readonly typescript?: ProjectServerInfo["typescript"];
|
|
41
|
+
/** Actionable launch failure, distinct from process recovery status. */
|
|
42
|
+
readonly failureMessage?: string;
|
|
36
43
|
readonly ready: boolean;
|
|
37
44
|
/** Negotiated operation support and SuPi planning limitations. */
|
|
38
45
|
readonly operationSupport?: ServerOperationSupportMap;
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
isScopedFile,
|
|
21
21
|
} from "../analysis/health/diagnostics.ts";
|
|
22
22
|
import { describeStructuralState } from "../analysis/health/recovery.ts";
|
|
23
|
+
import { deriveWorkspaceSemanticHealthState } from "../analysis/health/semantic-state.ts";
|
|
23
24
|
import { collectServers } from "../analysis/health/signals.ts";
|
|
24
25
|
import { SEMANTIC_READINESS_TIMEOUT_REASON } from "../analysis/readiness.ts";
|
|
25
26
|
import { resolveScope } from "../analysis/search/paths.ts";
|
|
@@ -175,55 +176,19 @@ async function establishSemanticHealthState(
|
|
|
175
176
|
options.control,
|
|
176
177
|
)
|
|
177
178
|
: null);
|
|
178
|
-
if (!readiness)
|
|
179
|
+
if (!readiness)
|
|
180
|
+
return deriveWorkspaceSemanticHealthState(options.lspState, options.capabilityState, []);
|
|
179
181
|
if (readiness.kind === "ready") return { kind: "ready" };
|
|
180
182
|
if (readiness.kind === "timeout") {
|
|
181
183
|
return { kind: "pending", reason: SEMANTIC_READINESS_TIMEOUT_REASON };
|
|
182
184
|
}
|
|
183
185
|
return { kind: "unavailable", reason: readiness.reason };
|
|
184
186
|
}
|
|
185
|
-
|
|
186
|
-
options.
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
)
|
|
190
|
-
return { kind: "ready" };
|
|
191
|
-
}
|
|
192
|
-
return deriveNonReadySemanticState(options.lspState, options.capabilityState);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function deriveNonReadySemanticState(
|
|
196
|
-
lspState: WorkspaceLspRuntimeState,
|
|
197
|
-
capabilityState: CapabilityState,
|
|
198
|
-
): Exclude<SemanticHealthState, { kind: "ready" }> {
|
|
199
|
-
switch (lspState.kind) {
|
|
200
|
-
case "pending":
|
|
201
|
-
return { kind: "pending", reason: "LSP is starting" };
|
|
202
|
-
case "inactive":
|
|
203
|
-
return { kind: "inactive", reason: "Inactive on the current session branch" };
|
|
204
|
-
case "disabled":
|
|
205
|
-
return { kind: "disabled", reason: "Disabled by configuration" };
|
|
206
|
-
case "unavailable":
|
|
207
|
-
return { kind: "unavailable", reason: lspState.reason };
|
|
208
|
-
case "ready":
|
|
209
|
-
return deriveReadyOwnerWithoutServerState(capabilityState);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function deriveReadyOwnerWithoutServerState(
|
|
214
|
-
capabilityState: CapabilityState,
|
|
215
|
-
): Exclude<SemanticHealthState, { kind: "ready" }> {
|
|
216
|
-
switch (capabilityState.kind) {
|
|
217
|
-
case "inactive":
|
|
218
|
-
return { kind: "inactive", reason: "Inactive on the current session branch" };
|
|
219
|
-
case "disabled":
|
|
220
|
-
return { kind: "disabled", reason: "Disabled by configuration" };
|
|
221
|
-
case "unavailable":
|
|
222
|
-
return { kind: "unavailable", reason: capabilityState.reason };
|
|
223
|
-
case "pending":
|
|
224
|
-
case "ready":
|
|
225
|
-
return { kind: "pending", reason: "No active, ready project servers" };
|
|
226
|
-
}
|
|
187
|
+
return deriveWorkspaceSemanticHealthState(
|
|
188
|
+
options.lspState,
|
|
189
|
+
options.capabilityState,
|
|
190
|
+
options.runtime?.getProjectServers() ?? [],
|
|
191
|
+
);
|
|
227
192
|
}
|
|
228
193
|
|
|
229
194
|
function collectCapabilityWarnings(
|
|
@@ -76,7 +76,10 @@ async function collectNode(
|
|
|
76
76
|
kind: "partial",
|
|
77
77
|
data,
|
|
78
78
|
reason: result.reason,
|
|
79
|
-
recovery: {
|
|
79
|
+
recovery: {
|
|
80
|
+
file: relativeDisplayPath(input.cwd, result.file),
|
|
81
|
+
errorRanges: result.errorRanges,
|
|
82
|
+
},
|
|
80
83
|
}
|
|
81
84
|
: { kind: "completed", data };
|
|
82
85
|
} catch (error) {
|
|
@@ -103,7 +106,10 @@ async function collectEnclosingSymbol(
|
|
|
103
106
|
kind: "partial",
|
|
104
107
|
data: symbol,
|
|
105
108
|
reason: result.reason,
|
|
106
|
-
recovery: {
|
|
109
|
+
recovery: {
|
|
110
|
+
file: relativeDisplayPath(input.cwd, result.file),
|
|
111
|
+
errorRanges: result.errorRanges,
|
|
112
|
+
},
|
|
107
113
|
}
|
|
108
114
|
: { kind: "completed", data: symbol };
|
|
109
115
|
} catch (error) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/** Filesystem and UTF-16 validation for exact point inspection. */
|
|
2
2
|
|
|
3
3
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
4
|
-
import {
|
|
5
|
-
import { normalizePath } from "../../analysis/search/paths.ts";
|
|
4
|
+
import { normalizePath, toDisplayPath } from "../../analysis/search/paths.ts";
|
|
6
5
|
import type { InputValidation } from "../input/common.ts";
|
|
7
6
|
import type { SourcePointInput } from "../target-input.ts";
|
|
8
7
|
|
|
@@ -60,7 +59,7 @@ export function validateInspectPoint(
|
|
|
60
59
|
kind: "valid",
|
|
61
60
|
value: {
|
|
62
61
|
file,
|
|
63
|
-
relPath:
|
|
62
|
+
relPath: toDisplayPath(cwd, file),
|
|
64
63
|
line: point.line,
|
|
65
64
|
character: point.character,
|
|
66
65
|
lineCount: lines.length,
|
|
@@ -112,7 +112,7 @@ function buildInspectNextQueries(
|
|
|
112
112
|
character: definition.character,
|
|
113
113
|
});
|
|
114
114
|
queries.push(
|
|
115
|
-
`
|
|
115
|
+
`To explore this definition's relationships, call code_graph with target.anchor ${anchor}`,
|
|
116
116
|
);
|
|
117
117
|
} else if (!semanticReady) {
|
|
118
118
|
queries.push(
|