@mrclrchtr/supi-review 13.0.0 → 14.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/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +59 -13
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/session.ts +2 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/spill.ts +2 -2
- package/node_modules/@mrclrchtr/supi-agent-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/session/agent-run-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/session/transcript-format.ts +3 -1
- package/node_modules/@mrclrchtr/supi-agent-runtime/src/session/transcript-store.ts +25 -10
- package/node_modules/@mrclrchtr/supi-code-intelligence/CHANGELOG.md +18 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/README.md +3 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +10 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +59 -13
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/session.ts +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/spill.ts +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/README.md +6 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +10 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +59 -13
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spill.ts +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +5 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-request.ts +3 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-timing.ts +14 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-typescript.ts +8 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +4 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-input-admission.ts +7 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +24 -8
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +5 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +3 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/debug-telemetry.ts +64 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +3 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-typescript-coverage.ts +27 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +16 -112
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +521 -83
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/workspace-symbol-collection.ts +163 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/workspace-symbol-row-limit.ts +72 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +11 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +36 -7
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +10 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +59 -13
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spill.ts +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/package.json +5 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/health/server-status.ts +32 -9
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/health/signals.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/instruction-files.ts +11 -7
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/exclusions.ts +18 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/file-outline-omissions.ts +17 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/symbol-selection.ts +100 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/symbol.ts +48 -8
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/types.ts +8 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/app/app.ts +37 -21
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/extension.ts +1 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/headless.ts +4 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/health-types.ts +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/orientation-types.ts +5 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/orientation-workflow.ts +13 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/target-workflow.ts +18 -12
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/render.ts +10 -11
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/result.ts +6 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/structured.ts +3 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/markdown.ts +3 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/structured-schema.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/structured.ts +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_orientation/markdown.ts +6 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_resolve/result.ts +2 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_resolve/structured.ts +6 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/result/candidate-selection.ts +17 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/ui/footer.ts +147 -42
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/ui/status-overlay.ts +13 -8
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +59 -13
- package/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
- package/node_modules/@mrclrchtr/supi-core/src/session.ts +2 -0
- package/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
- package/node_modules/@mrclrchtr/supi-core/src/spill.ts +2 -2
- package/package.json +4 -4
- package/src/target/packet.ts +1 -1
- package/src/tool/review_run/schemas.ts +2 -1
- package/src/workspace/cleanup-command.ts +43 -2
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
12
12
|
import { fileToUri, uriToFile } from "@mrclrchtr/supi-core/path";
|
|
13
13
|
import type { Diagnostic, TextDocumentItem } from "../config/types.ts";
|
|
14
|
+
import type { RequestTimingBatch } from "../debug-telemetry.ts";
|
|
14
15
|
import type { DiagnosticEvidenceSummary } from "../diagnostics/evidence.ts";
|
|
15
16
|
import { detectLanguageId } from "../utils.ts";
|
|
16
17
|
import { applyPushDiagnostics, buildClientDiagnosticSnapshot } from "./client-diagnostic-cache.ts";
|
|
@@ -722,6 +723,7 @@ export class ClientDiagnostics {
|
|
|
722
723
|
},
|
|
723
724
|
deadline: requestOptions.deadline,
|
|
724
725
|
operationId: requestOptions.operationId,
|
|
726
|
+
requestTimings: requestOptions.requestTimings,
|
|
725
727
|
}),
|
|
726
728
|
options,
|
|
727
729
|
publications: {
|
|
@@ -1082,6 +1084,7 @@ export class ClientDiagnostics {
|
|
|
1082
1084
|
control?: CodeRequestControl;
|
|
1083
1085
|
deadline?: number;
|
|
1084
1086
|
operationId?: string;
|
|
1087
|
+
requestTimings?: RequestTimingBatch;
|
|
1085
1088
|
}): Promise<boolean> {
|
|
1086
1089
|
const adapter = this.host.diagnosticRequestAdapter;
|
|
1087
1090
|
if (!adapter?.supports(options.request.uri)) return Promise.resolve(false);
|
|
@@ -1118,6 +1121,7 @@ export class ClientDiagnostics {
|
|
|
1118
1121
|
timeoutMs: ownerTimeoutMs,
|
|
1119
1122
|
signal: controller.signal,
|
|
1120
1123
|
operationId: options.operationId,
|
|
1124
|
+
requestTimings: options.requestTimings,
|
|
1121
1125
|
};
|
|
1122
1126
|
const execution = startDiagnosticEvidenceFromAdapter({
|
|
1123
1127
|
adapter,
|
|
@@ -4,7 +4,13 @@ import {
|
|
|
4
4
|
throwIfCodeRequestInterrupted,
|
|
5
5
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Waiting operations per client. First opens dispatch one at a time, so the
|
|
9
|
+
* bound limits memory for a stalled server, not server load. It must exceed
|
|
10
|
+
* the first opens of several concurrent tool calls: candidate lists open one
|
|
11
|
+
* file per candidate.
|
|
12
|
+
*/
|
|
13
|
+
export const MAX_PENDING_INPUT_OPERATIONS = 1024;
|
|
8
14
|
|
|
9
15
|
type InputOperationKind = "request" | "enrollment" | "request-enrollment";
|
|
10
16
|
|
|
@@ -1133,6 +1133,7 @@ export class LspClient {
|
|
|
1133
1133
|
timeoutMs: request.timeoutMs,
|
|
1134
1134
|
deadline: ownerDeadline,
|
|
1135
1135
|
...(request.operationId !== undefined ? { operationId: request.operationId } : {}),
|
|
1136
|
+
...(request.requestTimings ? { requestTimings: request.requestTimings } : {}),
|
|
1136
1137
|
},
|
|
1137
1138
|
);
|
|
1138
1139
|
activeSettled = owned.settled;
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
// and notification/request dispatching through vscode-jsonrpc's MessageConnection.
|
|
4
4
|
// biome-ignore-all lint/style/noExcessiveLinesPerFile: Transport lifetime and protocol handling stay together.
|
|
5
5
|
|
|
6
|
+
import { performance } from "node:perf_hooks";
|
|
6
7
|
import type { Readable, Writable } from "node:stream";
|
|
7
|
-
import {
|
|
8
|
-
type CodeRequestControl,
|
|
9
|
-
CodeRequestDeadlineError,
|
|
10
|
-
} from "@mrclrchtr/supi-code-runtime/api";
|
|
8
|
+
import { CodeRequestDeadlineError } from "@mrclrchtr/supi-code-runtime/api";
|
|
11
9
|
import {
|
|
12
10
|
startDebugTimer,
|
|
13
11
|
truncateDebugIdentity as truncateIdentity,
|
|
@@ -22,7 +20,11 @@ import {
|
|
|
22
20
|
StreamMessageReader,
|
|
23
21
|
StreamMessageWriter,
|
|
24
22
|
} from "vscode-jsonrpc/node";
|
|
25
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
type BatchedRequestControl,
|
|
25
|
+
boundCwd,
|
|
26
|
+
LSP_REQUEST_TIMEOUT_ERROR_CODE,
|
|
27
|
+
} from "../debug-telemetry.ts";
|
|
26
28
|
|
|
27
29
|
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
28
30
|
|
|
@@ -112,7 +114,7 @@ export class JsonRpcClient {
|
|
|
112
114
|
sendRequestOwned(
|
|
113
115
|
method: string,
|
|
114
116
|
params?: unknown,
|
|
115
|
-
options?: { timeoutMs?: number } &
|
|
117
|
+
options?: { timeoutMs?: number } & BatchedRequestControl,
|
|
116
118
|
): { result: Promise<unknown>; settled: Promise<void> } {
|
|
117
119
|
let settle!: () => void;
|
|
118
120
|
const settled = new Promise<void>((resolve) => {
|
|
@@ -133,12 +135,20 @@ export class JsonRpcClient {
|
|
|
133
135
|
return { result, settled };
|
|
134
136
|
}
|
|
135
137
|
|
|
136
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* Send a request and wait for the correlated response, optionally overriding
|
|
140
|
+
* the timeout. With `requestTimings`, a completed request adds its duration
|
|
141
|
+
* to that batch instead of recording its own `request.timing` event.
|
|
142
|
+
*/
|
|
137
143
|
// biome-ignore lint/complexity/noExcessiveLinesPerFunction: Request timeout and cancellation races stay together.
|
|
138
144
|
sendRequest(
|
|
139
145
|
method: string,
|
|
140
146
|
params?: unknown,
|
|
141
|
-
options?: {
|
|
147
|
+
options?: {
|
|
148
|
+
timeoutMs?: number;
|
|
149
|
+
onSettled?: () => void;
|
|
150
|
+
owned?: boolean;
|
|
151
|
+
} & BatchedRequestControl,
|
|
142
152
|
): Promise<unknown> {
|
|
143
153
|
const timeoutMs = options?.timeoutMs ?? this.timeoutMs;
|
|
144
154
|
const owned = options?.owned === true;
|
|
@@ -147,6 +157,8 @@ export class JsonRpcClient {
|
|
|
147
157
|
const methodClass = classifyRequestMethod(method);
|
|
148
158
|
const boundedMethod = truncateIdentity(method);
|
|
149
159
|
const timer = startDebugTimer();
|
|
160
|
+
const requestTimings = timer.enabled ? options?.requestTimings : undefined;
|
|
161
|
+
const startedAt = requestTimings ? performance.now() : 0;
|
|
150
162
|
// A request cancelled before dispatch must not produce protocol traffic.
|
|
151
163
|
if (signal?.aborted) {
|
|
152
164
|
const result = rejectUndispatchedRequest(
|
|
@@ -259,6 +271,10 @@ export class JsonRpcClient {
|
|
|
259
271
|
])
|
|
260
272
|
.then(
|
|
261
273
|
(result) => {
|
|
274
|
+
if (requestTimings) {
|
|
275
|
+
requestTimings.add(boundedMethod, performance.now() - startedAt);
|
|
276
|
+
return result;
|
|
277
|
+
}
|
|
262
278
|
recordRequestTiming(
|
|
263
279
|
timer,
|
|
264
280
|
options?.operationId,
|
|
@@ -70,6 +70,11 @@ export interface ProjectServerInfo extends DetectedProjectServer {
|
|
|
70
70
|
openFiles: string[];
|
|
71
71
|
/** Whether the LSP server is currently not indexing and ready to serve queries. */
|
|
72
72
|
ready: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Present while the background warm-up loads the route's projects. The route
|
|
75
|
+
* answers queries; a symbol query waits for the pass.
|
|
76
|
+
*/
|
|
77
|
+
loadingProjects?: true;
|
|
73
78
|
/** Negotiated operation support, when the route has a capability snapshot. */
|
|
74
79
|
operationSupport?: ServerOperationSupportMap;
|
|
75
80
|
}
|
|
@@ -177,6 +177,9 @@ export function projectConfigIncludesFile(configPath: string, filePath: string):
|
|
|
177
177
|
return parsed !== null && decideFileScope(parsed, path.resolve(filePath)).included;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
/** Normalized paths of the files in a project config's program; undefined when it cannot be parsed. */
|
|
181
|
+
export const projectFileNames = (config: string) => parseProjectConfig(config)?.fileNames;
|
|
182
|
+
|
|
180
183
|
function isOutOfTree(cwd: string, absolutePath: string): boolean {
|
|
181
184
|
const relative = path.relative(path.resolve(cwd), absolutePath);
|
|
182
185
|
return relative.startsWith(`..${path.sep}`) || relative === "..";
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// identity for local protocol diagnosis. Each identity string and list uses
|
|
5
5
|
// the shared bounds.
|
|
6
6
|
|
|
7
|
+
import type { CodeRequestControl } from "@mrclrchtr/supi-code-runtime/api";
|
|
7
8
|
import { truncateDebugIdentity } from "@mrclrchtr/supi-core/debug";
|
|
8
9
|
|
|
9
10
|
/** Maximum number of server entries in one bounded LSP debug payload. */
|
|
@@ -29,3 +30,66 @@ export function boundCwd(cwd: string | undefined): string | undefined {
|
|
|
29
30
|
export function boundServerNames(names: readonly string[]): string[] {
|
|
30
31
|
return names.slice(0, MAX_SERVERS).map(truncateDebugIdentity);
|
|
31
32
|
}
|
|
33
|
+
|
|
34
|
+
/** Maximum number of distinct methods one batch reports by name. */
|
|
35
|
+
const MAX_BATCH_METHODS = 16;
|
|
36
|
+
const OTHER_BATCH_METHODS = "other";
|
|
37
|
+
|
|
38
|
+
/** Completed-request totals for one method of a batch operation. */
|
|
39
|
+
export interface RequestTimingTotals {
|
|
40
|
+
readonly count: number;
|
|
41
|
+
readonly totalMs: number;
|
|
42
|
+
readonly maxMs: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Completed-request timings of one batch operation, such as a diagnostic
|
|
47
|
+
* refresh over every open document or a workspace-symbol warm-up pass.
|
|
48
|
+
*
|
|
49
|
+
* A batch sends one request per document. Recording each as its own
|
|
50
|
+
* `request.timing` event fills the Debug buffer with near-identical events, so
|
|
51
|
+
* the transport adds completed requests here instead and the batch's summary
|
|
52
|
+
* event reports them through `snapshot()`. Failed, timed-out, and cancelled
|
|
53
|
+
* requests still record their own event. A request that completes after its
|
|
54
|
+
* batch reported is not recorded.
|
|
55
|
+
*/
|
|
56
|
+
export class RequestTimingBatch {
|
|
57
|
+
readonly #methods = new Map<string, { count: number; totalMs: number; maxMs: number }>();
|
|
58
|
+
|
|
59
|
+
/** Add one completed request. */
|
|
60
|
+
add(method: string, durationMs: number): void {
|
|
61
|
+
const known = this.#methods.has(method) || this.#methods.size < MAX_BATCH_METHODS;
|
|
62
|
+
const key = known ? method : OTHER_BATCH_METHODS;
|
|
63
|
+
const totals = this.#methods.get(key) ?? { count: 0, totalMs: 0, maxMs: 0 };
|
|
64
|
+
const elapsed = Number.isFinite(durationMs) ? Math.max(0, durationMs) : 0;
|
|
65
|
+
totals.count++;
|
|
66
|
+
totals.totalMs += elapsed;
|
|
67
|
+
totals.maxMs = Math.max(totals.maxMs, elapsed);
|
|
68
|
+
this.#methods.set(key, totals);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Totals by method, or `undefined` when no request completed. */
|
|
72
|
+
snapshot(): Record<string, RequestTimingTotals> | undefined {
|
|
73
|
+
if (this.#methods.size === 0) return undefined;
|
|
74
|
+
return Object.fromEntries(
|
|
75
|
+
Array.from(this.#methods, ([method, totals]) => [
|
|
76
|
+
method,
|
|
77
|
+
{
|
|
78
|
+
count: totals.count,
|
|
79
|
+
totalMs: roundDuration(totals.totalMs),
|
|
80
|
+
maxMs: roundDuration(totals.maxMs),
|
|
81
|
+
},
|
|
82
|
+
]),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Request control that also routes completed-request timings into a batch. */
|
|
88
|
+
export interface BatchedRequestControl extends CodeRequestControl {
|
|
89
|
+
/** Collects completed request timings instead of one event per request. */
|
|
90
|
+
readonly requestTimings?: RequestTimingBatch;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function roundDuration(value: number): number {
|
|
94
|
+
return Math.round(value * 10) / 10;
|
|
95
|
+
}
|
|
@@ -16,6 +16,8 @@ interface ProjectServerInfoInput {
|
|
|
16
16
|
statusReason?: ProjectServerStatusReason;
|
|
17
17
|
typescript?: TypeScriptSelection;
|
|
18
18
|
failureMessage?: string;
|
|
19
|
+
/** The background warm-up is loading this route's projects. */
|
|
20
|
+
loadingProjects?: boolean;
|
|
19
21
|
/** Filter files from ambient project status without changing explicit routing. */
|
|
20
22
|
includeOpenFile?: (file: string) => boolean;
|
|
21
23
|
}
|
|
@@ -51,6 +53,7 @@ export function buildProjectServerInfo(
|
|
|
51
53
|
.filter((file) => input.includeOpenFile?.(file) ?? true)
|
|
52
54
|
.map((file) => displayRelativeFilePath(file, cwd)) ?? [],
|
|
53
55
|
ready: input.client?.ready ?? false,
|
|
56
|
+
...(input.loadingProjects ? { loadingProjects: true as const } : {}),
|
|
54
57
|
operationSupport: getServerOperationSupport(input.client?.serverCapabilities ?? null),
|
|
55
58
|
};
|
|
56
59
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import * as path from "node:path";
|
|
2
2
|
import { collectExtendedProjectConfigs } from "../config/tsconfig-extends.ts";
|
|
3
3
|
import { normalizeTsconfigPath } from "../config/tsconfig-path.ts";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
getFileScopeDecision,
|
|
6
|
+
projectConfigIncludesFile,
|
|
7
|
+
projectFileNames,
|
|
8
|
+
} from "../config/tsconfig-scope.ts";
|
|
5
9
|
import { type AutomaticLspPathPolicy, walkAutomaticLspTree } from "../workspace-path-policy.ts";
|
|
6
10
|
|
|
7
11
|
/** Directory depth searched for project configs below a TypeScript route root. */
|
|
@@ -43,6 +47,9 @@ export function discoverTypeScriptProjectConfigs(
|
|
|
43
47
|
* Base configs extended by another discovered config are skipped: their
|
|
44
48
|
* default include usually spans the whole tree while they own only root
|
|
45
49
|
* tooling files, so counting them would mark nearly every answer partial.
|
|
50
|
+
*
|
|
51
|
+
* Projects that own no file are skipped too: their program holds only files of
|
|
52
|
+
* other projects, and no open file or answer could ever show them as loaded.
|
|
46
53
|
*/
|
|
47
54
|
export function findUnloadedTypeScriptProjects(options: {
|
|
48
55
|
readonly file: string;
|
|
@@ -64,11 +71,29 @@ export function findUnloadedTypeScriptProjects(options: {
|
|
|
64
71
|
return options.configs.filter((config) => {
|
|
65
72
|
const key = normalizeTsconfigPath(config);
|
|
66
73
|
return (
|
|
67
|
-
!loaded.has(key) &&
|
|
74
|
+
!loaded.has(key) &&
|
|
75
|
+
!baseConfigs.has(key) &&
|
|
76
|
+
projectConfigIncludesFile(config, options.file) &&
|
|
77
|
+
ownsProgramFile(config, options.cwd)
|
|
68
78
|
);
|
|
69
79
|
});
|
|
70
80
|
}
|
|
71
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Whether a project config is the nearest config of a file in its own program.
|
|
84
|
+
* A test config that includes `../src` before any test exists owns none.
|
|
85
|
+
*/
|
|
86
|
+
function ownsProgramFile(config: string, cwd: string): boolean {
|
|
87
|
+
const key = normalizeTsconfigPath(config);
|
|
88
|
+
// Program file names are normalized, so the tree root must be too.
|
|
89
|
+
const root = normalizeTsconfigPath(cwd);
|
|
90
|
+
for (const file of projectFileNames(config) ?? []) {
|
|
91
|
+
const nearest = getFileScopeDecision(file, root).configPath;
|
|
92
|
+
if (nearest && normalizeTsconfigPath(nearest) === key) return true;
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
|
|
72
97
|
/**
|
|
73
98
|
* Other projects that tsserver's implementation search skips for `file`.
|
|
74
99
|
*
|
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
import { type Dirent, realpathSync, statSync } from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
type CodeQueryResult,
|
|
5
|
-
type CodeRequestControl,
|
|
6
|
-
completedCodeQuery,
|
|
7
|
-
partialCodeQuery,
|
|
8
|
-
unavailableCodeQuery,
|
|
9
|
-
} from "@mrclrchtr/supi-code-runtime/api";
|
|
10
3
|
import { isWithinOrEqual } from "@mrclrchtr/supi-core/project";
|
|
11
|
-
import type {
|
|
12
|
-
import type {
|
|
13
|
-
DocumentSymbol,
|
|
14
|
-
Position,
|
|
15
|
-
SymbolInformation,
|
|
16
|
-
WorkspaceSymbol,
|
|
17
|
-
} from "../config/types.ts";
|
|
4
|
+
import type { DocumentSymbol, Position, SymbolInformation } from "../config/types.ts";
|
|
18
5
|
import {
|
|
19
6
|
type AutomaticLspPathPolicy,
|
|
20
7
|
createDefaultAutomaticLspPathPolicy,
|
|
21
8
|
walkAutomaticLspTree,
|
|
22
9
|
} from "../workspace-path-policy.ts";
|
|
23
10
|
|
|
24
|
-
type WorkspaceSymbolLike = SymbolInformation | WorkspaceSymbol;
|
|
25
|
-
|
|
26
11
|
const DEFAULT_WARM_FILE_DEPTH = 4;
|
|
27
12
|
const DEFAULT_MARKER_SCAN_DEPTH = 6;
|
|
28
13
|
/** Candidates per marker root; later candidates help only when earlier ones land outside the project. */
|
|
@@ -58,109 +43,28 @@ export function getWorkspaceSymbolWarmPosition(
|
|
|
58
43
|
return null;
|
|
59
44
|
}
|
|
60
45
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
hasSupport: boolean;
|
|
64
|
-
completedClientCount: number;
|
|
65
|
-
failures: string[];
|
|
66
|
-
/** Results removed by the automatic path policy. */
|
|
67
|
-
excludedCount?: number;
|
|
68
|
-
/** Bounded paths removed by the automatic path policy. */
|
|
69
|
-
excludedExamples?: string[];
|
|
70
|
-
/** Known coverage limits: the server may not have loaded every project in scope. */
|
|
71
|
-
coverageGap?: string;
|
|
72
|
-
}
|
|
46
|
+
/** Project roots one all-roots warm-up pass opens for a route. */
|
|
47
|
+
const MAX_WARM_ROOTS = 96;
|
|
73
48
|
|
|
74
49
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* so an empty or short result does not prove a symbol is absent.
|
|
50
|
+
* Bound an all-roots warm-up pass. Roots past the limit stay unopened, and the
|
|
51
|
+
* returned gap says so: their symbols may be missing from the result.
|
|
78
52
|
*/
|
|
79
|
-
export function
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const
|
|
53
|
+
export function limitWorkspaceSymbolWarmRoots(targets: readonly WorkspaceSymbolWarmTarget[]): {
|
|
54
|
+
targets: WorkspaceSymbolWarmTarget[];
|
|
55
|
+
gap: string | null;
|
|
56
|
+
} {
|
|
57
|
+
const roots = [...new Set(targets.map((target) => target.projectRoot))];
|
|
58
|
+
if (roots.length <= MAX_WARM_ROOTS) return { targets: [...targets], gap: null };
|
|
59
|
+
const kept = new Set(roots.slice(0, MAX_WARM_ROOTS));
|
|
84
60
|
return {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
`Workspace-symbol coverage is limited: ${
|
|
88
|
-
"
|
|
61
|
+
targets: targets.filter((target) => kept.has(target.projectRoot)),
|
|
62
|
+
gap:
|
|
63
|
+
`Workspace-symbol coverage is limited: ${roots.length - MAX_WARM_ROOTS} of ${roots.length} ` +
|
|
64
|
+
"project roots were not opened. Pass a narrower scope and retry.",
|
|
89
65
|
};
|
|
90
66
|
}
|
|
91
67
|
|
|
92
|
-
export async function collectWorkspaceSymbols(
|
|
93
|
-
clients: Iterable<LspClient>,
|
|
94
|
-
query: string,
|
|
95
|
-
control?: CodeRequestControl,
|
|
96
|
-
): Promise<WorkspaceSymbolCollection> {
|
|
97
|
-
const results: WorkspaceSymbolLike[] = [];
|
|
98
|
-
const failures: string[] = [];
|
|
99
|
-
let hasSupport = false;
|
|
100
|
-
let completedClientCount = 0;
|
|
101
|
-
|
|
102
|
-
for (const client of clients) {
|
|
103
|
-
if (client.status !== "running") continue;
|
|
104
|
-
if (!client.serverCapabilities?.workspaceSymbolProvider) continue;
|
|
105
|
-
hasSupport = true;
|
|
106
|
-
const result = await client.workspaceSymbol(query, control);
|
|
107
|
-
if (result.kind === "unavailable") {
|
|
108
|
-
failures.push(result.reason);
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
completedClientCount++;
|
|
112
|
-
results.push(...(result.data ?? []));
|
|
113
|
-
if (result.kind === "partial") failures.push(result.reason);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return { results, hasSupport, completedClientCount, failures };
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function workspaceSymbolExclusionReason(collection: WorkspaceSymbolCollection): string | null {
|
|
120
|
-
const excludedCount = collection.excludedCount ?? 0;
|
|
121
|
-
if (excludedCount === 0) return null;
|
|
122
|
-
const noun = `workspace-symbol result${excludedCount === 1 ? "" : "s"}`;
|
|
123
|
-
// Paths belong to typed metadata so consumers can distinguish observed aliases from navigation.
|
|
124
|
-
return `Automatic path policy excluded ${excludedCount} ${noun}.`;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/** Project one multi-client collection into the shared typed query contract. */
|
|
128
|
-
export function workspaceSymbolCollectionResult(
|
|
129
|
-
collection: WorkspaceSymbolCollection,
|
|
130
|
-
): CodeQueryResult<WorkspaceSymbolLike[]> {
|
|
131
|
-
if (!collection.hasSupport) {
|
|
132
|
-
return unavailableCodeQuery("No active LSP client supports workspace-symbol requests.");
|
|
133
|
-
}
|
|
134
|
-
if (collection.completedClientCount === 0) {
|
|
135
|
-
return unavailableCodeQuery(
|
|
136
|
-
collection.failures.join("; ") || "No workspace-symbol request completed.",
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
const exclusion = workspaceSymbolExclusionReason(collection);
|
|
140
|
-
if (collection.failures.length > 0 || exclusion || collection.coverageGap) {
|
|
141
|
-
const excludedCount = collection.excludedCount ?? 0;
|
|
142
|
-
const exclusionOnly = collection.failures.length === 0 && !collection.coverageGap;
|
|
143
|
-
const metadata =
|
|
144
|
-
excludedCount > 0
|
|
145
|
-
? {
|
|
146
|
-
automaticPathExclusion: {
|
|
147
|
-
excludedCount,
|
|
148
|
-
examples: [...(collection.excludedExamples ?? [])],
|
|
149
|
-
},
|
|
150
|
-
...(exclusionOnly ? { exclusionOnly: true } : {}),
|
|
151
|
-
}
|
|
152
|
-
: undefined;
|
|
153
|
-
return partialCodeQuery(
|
|
154
|
-
collection.results,
|
|
155
|
-
[collection.failures.join("; "), collection.coverageGap, exclusion]
|
|
156
|
-
.filter(Boolean)
|
|
157
|
-
.join("; "),
|
|
158
|
-
metadata,
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
return completedCodeQuery(collection.results);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
68
|
/**
|
|
165
69
|
* Choose files to open so a workspace-symbol server loads the projects under `root`.
|
|
166
70
|
*
|