@mrclrchtr/supi-code-intelligence 6.1.0 → 6.2.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 +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/debug-identity.ts +11 -0
- package/node_modules/@mrclrchtr/supi-core/src/debug.ts +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/README.md +21 -3
- 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-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-identity.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug.ts +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/package.json +4 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +12 -7
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-capabilities.ts +0 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-publication.ts +6 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-timing.ts +5 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +17 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +40 -18
- package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +164 -30
- package/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +9 -87
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +0 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +4 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/config/types.ts +0 -29
- package/node_modules/@mrclrchtr/supi-lsp/src/debug-telemetry.ts +7 -21
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/diagnostic-severity.ts +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/diagnostic-summary.ts +11 -14
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +0 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/stale-diagnostics.ts +0 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/workspace-sentinels.ts +29 -49
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-client-state.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-diagnostics.ts +4 -8
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-helpers.ts +1 -9
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +6 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-recovery.ts +9 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +26 -41
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +275 -99
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +4 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +59 -28
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +27 -19
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +26 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registration.ts +0 -17
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +83 -19
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-transition-debug.ts +5 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/session/scanner.ts +24 -21
- package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +29 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/summary.ts +19 -40
- package/node_modules/@mrclrchtr/supi-lsp/src/utils.ts +13 -19
- package/node_modules/@mrclrchtr/supi-lsp/src/workspace-path-policy.ts +287 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +6 -18
- 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-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-identity.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug.ts +5 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/api.ts +1 -11
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/coordinates.ts +19 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/language.ts +5 -23
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/operation-support.ts +3 -21
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +5 -9
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +10 -20
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +7 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +9 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-protocol.ts +134 -9
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-name.ts +96 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +11 -12
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +39 -56
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/exports.ts +9 -7
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/js-binding-pattern.ts +26 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/node-at.ts +2 -21
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline-html-sql.ts +144 -12
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline.ts +50 -37
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/scope.ts +138 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +0 -7
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/parsed-file-store.ts +1 -14
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime.ts +0 -10
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/service.ts +6 -8
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/worker-main.ts +34 -10
- package/package.json +5 -5
- package/src/analysis/capability/capability-warnings.ts +4 -22
- package/src/analysis/search/ast-scan-timing.ts +4 -2
- package/src/analysis/search/ast-scan.ts +1 -1
- package/src/api.ts +1 -0
- package/src/extension.ts +4 -2
- package/src/session/health-refresh.ts +24 -2
- package/src/session/health-types.ts +19 -0
- package/src/session/input/health-refactor.ts +16 -14
- package/src/session/refactor-types.ts +14 -1
- package/src/session/refactor-workflow.ts +21 -16
- package/src/substrate/lsp/lifecycle.ts +0 -3
- package/src/substrate/lsp/maintenance.ts +4 -5
- package/src/substrate/lsp/settings.ts +6 -9
- package/src/substrate/lsp/state.ts +0 -2
- package/src/substrate/workspace-provider-host.ts +2 -2
- package/src/tool/code_health/file-scope-markdown.ts +43 -0
- package/src/tool/code_health/markdown.ts +66 -66
- package/src/tool/code_health/refresh-outcome.ts +46 -0
- package/src/tool/code_health/refresh-status.ts +166 -23
- package/src/tool/code_health/result.ts +1 -0
- package/src/tool/code_health/tui.ts +18 -5
- package/src/tool/code_refactor_apply/guidance.ts +3 -2
- package/src/tool/code_refactor_plan/guidance.ts +1 -1
- package/src/tool/register.ts +5 -2
- package/src/tool/schemas.ts +21 -11
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-actions.ts +0 -59
- package/node_modules/@mrclrchtr/supi-lsp/src/pattern-matcher.ts +0 -24
- package/node_modules/@mrclrchtr/supi-tree-sitter/scripts/generate-kotlin-wasm.mjs +0 -132
- package/node_modules/@mrclrchtr/supi-tree-sitter/scripts/generate-sql-wasm.mjs +0 -158
- package/node_modules/@mrclrchtr/supi-tree-sitter/scripts/vendor-wasm.mjs +0 -167
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/index.ts +0 -42
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-registration.ts +0 -37
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/service-registry.ts +0 -30
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/structure.ts +0 -8
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ The package adds eight tools that Pi selects as needed:
|
|
|
81
81
|
| `code_graph` | Follow LSP references and implementations plus AST calls made by a symbol |
|
|
82
82
|
| `code_find` | Search LSP workspace symbols or parsed AST source structure rather than raw text |
|
|
83
83
|
| `code_health` | Check live diagnostics, language servers, and code-intelligence availability |
|
|
84
|
-
| `code_refactor_plan` | Preview a precise rename or
|
|
84
|
+
| `code_refactor_plan` | Preview a precise rename, extraction, import cleanup, or dead-code deletion without changing files |
|
|
85
85
|
| `code_refactor_apply` | Apply a fresh refactor plan after safety checks |
|
|
86
86
|
|
|
87
87
|
Pi's built-in `grep` remains the right tool for literal or regular-expression searches; these tools add symbol and source-structure awareness.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Maximum UTF-16 code-unit length of one debug identity string. */
|
|
2
|
+
export const MAX_DEBUG_IDENTITY_STRING = 512;
|
|
3
|
+
|
|
4
|
+
/** Marker appended to a truncated debug identity string. */
|
|
5
|
+
export const DEBUG_IDENTITY_TRUNCATION_MARKER = "…";
|
|
6
|
+
|
|
7
|
+
/** Bound one debug identity string, including its truncation marker. */
|
|
8
|
+
export function truncateDebugIdentity(value: string): string {
|
|
9
|
+
if (value.length <= MAX_DEBUG_IDENTITY_STRING) return value;
|
|
10
|
+
return `${value.slice(0, MAX_DEBUG_IDENTITY_STRING - 1)}${DEBUG_IDENTITY_TRUNCATION_MARKER}`;
|
|
11
|
+
}
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
// Kept separate from debug-registry.ts so debug-timing.ts can import the
|
|
4
4
|
// registry without creating an import cycle through the barrel re-export.
|
|
5
5
|
|
|
6
|
+
export {
|
|
7
|
+
DEBUG_IDENTITY_TRUNCATION_MARKER,
|
|
8
|
+
MAX_DEBUG_IDENTITY_STRING,
|
|
9
|
+
truncateDebugIdentity,
|
|
10
|
+
} from "./debug-identity.ts";
|
|
6
11
|
// biome-ignore lint/performance/noReExportAll: preserve the stable debug domain entry point
|
|
7
12
|
export * from "./debug-registry.ts";
|
|
8
13
|
// biome-ignore lint/performance/noReExportAll: preserve the stable debug domain entry point
|
|
@@ -82,6 +82,24 @@ Configuration overrides merge with the built-in server definitions. Use `.pi/sup
|
|
|
82
82
|
|
|
83
83
|
Gopls pull diagnostics stay opt-in while golang/go#70199 is open; without the option the built-in Go configuration stays in push mode. Kotlin's `--stdio` argument is already part of the built-in configuration and needs no override.
|
|
84
84
|
|
|
85
|
+
### Automatic workspace path policy
|
|
86
|
+
|
|
87
|
+
Automatic LSP work uses one path policy that does not change for each workspace runtime. It covers project discovery, route startup, warm-up, sentinel and source-file lists, created-file tracking, runtime guidance, and diagnostic summaries not tied to one request.
|
|
88
|
+
|
|
89
|
+
The policy excludes these directories by default: `.git`, `.cache`, `.pi`, `.pnpm`, `node_modules`, `dist`, `build`, `out`, `coverage`, `.next`, `.nuxt`, `.turbo`, and `__pycache__`. It also applies `lsp.exclude` patterns and root or nested `.gitignore` rules. Patterns use gitignore syntax, including rules relative to each directory and `!` rules. Built-in exclusions cannot be enabled again. Symbolic-link directories are not visited. Other dot-directories, such as `.github` and `.storybook`, remain allowed.
|
|
90
|
+
|
|
91
|
+
Set `lsp.exclude` in project or global SuPi configuration:
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"lsp": {
|
|
96
|
+
"exclude": ["generated/**", "!generated/keep.ts"]
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
An exact semantic request can still route an excluded file when a compatible server is available. This does not add the file to automatic work. Configured diagnostic suppression still applies to diagnostic output.
|
|
102
|
+
|
|
85
103
|
### Custom server configuration
|
|
86
104
|
|
|
87
105
|
A custom server needs a command and at least one file type:
|
|
@@ -104,7 +122,7 @@ A custom server needs a command and at least one file type:
|
|
|
104
122
|
|
|
105
123
|
File types do not include a leading dot. If `rootMarkers` is omitted, the server uses the session root.
|
|
106
124
|
|
|
107
|
-
|
|
125
|
+
Disable one language with `lsp.servers.<language>.enabled: false`. Use `/supi-ci-status` from `@mrclrchtr/supi-code-intelligence` to see detected, running, and missing servers.
|
|
108
126
|
|
|
109
127
|
## What it provides
|
|
110
128
|
|
|
@@ -191,7 +209,7 @@ Detected servers start concurrently. In a polyglot workspace, disable unneeded l
|
|
|
191
209
|
}
|
|
192
210
|
```
|
|
193
211
|
|
|
194
|
-
|
|
212
|
+
If every server definition is disabled, the controller publishes an explicit `disabled` runtime state instead of an empty `ready` runtime. When a ready owner has no active client yet, it stays published for lazy routing while semantic capability remains pending.
|
|
195
213
|
|
|
196
214
|
## Architecture
|
|
197
215
|
|
|
@@ -212,7 +230,7 @@ See [`docs/adr/0016-workspace-lsp-runtime-interface.md`](../../docs/adr/0016-wor
|
|
|
212
230
|
|
|
213
231
|
## Package exports
|
|
214
232
|
|
|
215
|
-
- `@mrclrchtr/supi-lsp/api` — runtime/controller/config types and
|
|
233
|
+
- `@mrclrchtr/supi-lsp/api` — runtime/controller/config types, registry operations, and automatic path-policy helpers
|
|
216
234
|
- `@mrclrchtr/supi-lsp/provider/lsp-semantic-provider` — semantic provider adapter
|
|
217
235
|
|
|
218
236
|
## Source
|
package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-identity.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Maximum UTF-16 code-unit length of one debug identity string. */
|
|
2
|
+
export const MAX_DEBUG_IDENTITY_STRING = 512;
|
|
3
|
+
|
|
4
|
+
/** Marker appended to a truncated debug identity string. */
|
|
5
|
+
export const DEBUG_IDENTITY_TRUNCATION_MARKER = "…";
|
|
6
|
+
|
|
7
|
+
/** Bound one debug identity string, including its truncation marker. */
|
|
8
|
+
export function truncateDebugIdentity(value: string): string {
|
|
9
|
+
if (value.length <= MAX_DEBUG_IDENTITY_STRING) return value;
|
|
10
|
+
return `${value.slice(0, MAX_DEBUG_IDENTITY_STRING - 1)}${DEBUG_IDENTITY_TRUNCATION_MARKER}`;
|
|
11
|
+
}
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
// Kept separate from debug-registry.ts so debug-timing.ts can import the
|
|
4
4
|
// registry without creating an import cycle through the barrel re-export.
|
|
5
5
|
|
|
6
|
+
export {
|
|
7
|
+
DEBUG_IDENTITY_TRUNCATION_MARKER,
|
|
8
|
+
MAX_DEBUG_IDENTITY_STRING,
|
|
9
|
+
truncateDebugIdentity,
|
|
10
|
+
} from "./debug-identity.ts";
|
|
6
11
|
// biome-ignore lint/performance/noReExportAll: preserve the stable debug domain entry point
|
|
7
12
|
export * from "./debug-registry.ts";
|
|
8
13
|
// biome-ignore lint/performance/noReExportAll: preserve the stable debug domain entry point
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-lsp",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Language Server Protocol runtime for SuPi code intelligence",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"vscode-jsonrpc": "^9.0.0",
|
|
38
38
|
"vscode-languageserver-protocol": "^3.18.0",
|
|
39
39
|
"vscode-languageserver-types": "^3.18.0",
|
|
40
|
-
"@mrclrchtr/supi-code-runtime": "6.
|
|
41
|
-
"@mrclrchtr/supi-core": "6.
|
|
40
|
+
"@mrclrchtr/supi-code-runtime": "6.2.0",
|
|
41
|
+
"@mrclrchtr/supi-core": "6.2.0"
|
|
42
42
|
},
|
|
43
43
|
"bundledDependencies": [
|
|
44
44
|
"@mrclrchtr/supi-code-runtime",
|
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
"exports": {
|
|
54
54
|
"./api": "./src/api.ts",
|
|
55
55
|
"./package.json": "./package.json",
|
|
56
|
-
"./provider/lsp-semantic-provider": "./src/provider/lsp-semantic-provider.ts"
|
|
57
|
-
"./debug-telemetry": "./src/debug-telemetry.ts"
|
|
56
|
+
"./provider/lsp-semantic-provider": "./src/provider/lsp-semantic-provider.ts"
|
|
58
57
|
}
|
|
59
58
|
}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
// Public API surface for the LSP session-scoped service.
|
|
2
2
|
|
|
3
3
|
export { type LoadConfigOptions, loadConfig } from "./config/config.ts";
|
|
4
|
-
export type {
|
|
5
|
-
export {
|
|
6
|
-
getDeprecatedLspKeys,
|
|
7
|
-
getLspDisabledMessage,
|
|
8
|
-
hasDeprecatedLspKeys,
|
|
9
|
-
loadLspSettings,
|
|
10
|
-
} from "./config/lsp-settings.ts";
|
|
4
|
+
export type { LspSettings } from "./config/lsp-settings.ts";
|
|
5
|
+
export { loadLspSettings } from "./config/lsp-settings.ts";
|
|
11
6
|
export {
|
|
12
7
|
clearTsconfigCache,
|
|
13
8
|
type FileScopeDecision,
|
|
@@ -43,6 +38,8 @@ export { isLikelyStaleDiagnostic } from "./diagnostics/stale-diagnostics.ts";
|
|
|
43
38
|
export {
|
|
44
39
|
scanWorkspaceSentinels,
|
|
45
40
|
syncWorkspaceSentinelSnapshot,
|
|
41
|
+
type WorkspaceSentinelScanOptions,
|
|
42
|
+
type WorkspaceSentinelSyncResult,
|
|
46
43
|
} from "./diagnostics/workspace-sentinels.ts";
|
|
47
44
|
export { raceReadinessValue, raceRequestControl } from "./session/readiness.ts";
|
|
48
45
|
export type {
|
|
@@ -59,6 +56,7 @@ export type {
|
|
|
59
56
|
DiagnosticEvidenceSummary,
|
|
60
57
|
OutstandingDiagnosticSummaryEntry,
|
|
61
58
|
ProcessCrashDiagnosticDemand,
|
|
59
|
+
ProcessCrashRecoverySummary,
|
|
62
60
|
RecoverDiagnosticsResult,
|
|
63
61
|
RoutedMutationResponse,
|
|
64
62
|
SemanticReadinessResult,
|
|
@@ -71,8 +69,15 @@ export type {
|
|
|
71
69
|
} from "./session/runtime-registry.ts";
|
|
72
70
|
export {
|
|
73
71
|
clearWorkspaceLspRuntime,
|
|
72
|
+
emptyProcessCrashRecoverySummary,
|
|
74
73
|
getWorkspaceLspRuntime,
|
|
75
74
|
setWorkspaceLspRuntimeState,
|
|
76
75
|
waitForWorkspaceLspRuntime,
|
|
77
76
|
} from "./session/runtime-registry.ts";
|
|
78
77
|
export { scanMissingServers } from "./session/scanner.ts";
|
|
78
|
+
export {
|
|
79
|
+
AUTOMATIC_LSP_EXCLUDED_DIRECTORIES,
|
|
80
|
+
type AutomaticLspPathPolicy,
|
|
81
|
+
createAutomaticLspPathPolicy,
|
|
82
|
+
createDefaultAutomaticLspPathPolicy,
|
|
83
|
+
} from "./workspace-path-policy.ts";
|
|
@@ -66,11 +66,6 @@ export class ClientDynamicRegistrations {
|
|
|
66
66
|
return (this.idsByMethod.get(method)?.size ?? 0) > 0;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
/** Snapshot of the active registration ids for a method. */
|
|
70
|
-
ids(method: string): readonly string[] {
|
|
71
|
-
return [...(this.idsByMethod.get(method) ?? [])];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
69
|
/** Drop all registrations — capability loss on shutdown, crash, or disposal. */
|
|
75
70
|
clear(): void {
|
|
76
71
|
this.idsByMethod.clear();
|
|
@@ -9,9 +9,12 @@
|
|
|
9
9
|
// and timing data. They never carry diagnostic payloads or source text.
|
|
10
10
|
|
|
11
11
|
import * as path from "node:path";
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
import {
|
|
13
|
+
recordDebugEvent,
|
|
14
|
+
truncateDebugIdentity as truncateIdentity,
|
|
15
|
+
} from "@mrclrchtr/supi-core/debug";
|
|
16
|
+
import { uriToFile } from "@mrclrchtr/supi-core/path";
|
|
17
|
+
import { boundCwd } from "../debug-telemetry.ts";
|
|
15
18
|
|
|
16
19
|
/** Maximum tracked synchronizations before the oldest entry is evicted. */
|
|
17
20
|
export const MAX_TRACKED_SYNCHRONIZATIONS = 64;
|
|
@@ -5,12 +5,13 @@ import {
|
|
|
5
5
|
isCodeRequestInterruption,
|
|
6
6
|
throwIfCodeRequestInterrupted,
|
|
7
7
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
8
|
+
import { fileToUri, uriToFile } from "@mrclrchtr/supi-core/path";
|
|
8
9
|
import type { TextDocumentIdentifier } from "../config/types.ts";
|
|
9
10
|
import {
|
|
10
11
|
type DiagnosticEvidenceSummary,
|
|
11
12
|
summarizeDiagnosticEvidence,
|
|
12
13
|
} from "../diagnostics/evidence.ts";
|
|
13
|
-
import { detectLanguageId
|
|
14
|
+
import { detectLanguageId } from "../utils.ts";
|
|
14
15
|
import {
|
|
15
16
|
type DiagnosticCacheEntry,
|
|
16
17
|
type DiagnosticSynchronization,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { CodeRequestControl } from "@mrclrchtr/supi-code-runtime/api";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
startDebugTimer,
|
|
4
|
+
truncateDebugIdentity as truncateIdentity,
|
|
5
|
+
} from "@mrclrchtr/supi-core/debug";
|
|
6
|
+
import { boundCwd } from "../debug-telemetry.ts";
|
|
4
7
|
|
|
5
8
|
type DiagnosticCollection = "cache" | "fallback" | "none" | "pull" | "push";
|
|
6
9
|
type DiagnosticFreshness = "not-observed" | "observed";
|
|
@@ -7,9 +7,10 @@ import {
|
|
|
7
7
|
throwIfCodeRequestInterrupted,
|
|
8
8
|
unavailableCodeQuery,
|
|
9
9
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
10
|
+
import { fileToUri, uriToFile } from "@mrclrchtr/supi-core/path";
|
|
10
11
|
import type { Diagnostic, TextDocumentItem } from "../config/types.ts";
|
|
11
12
|
import type { DiagnosticEvidenceSummary } from "../diagnostics/evidence.ts";
|
|
12
|
-
import { detectLanguageId
|
|
13
|
+
import { detectLanguageId } from "../utils.ts";
|
|
13
14
|
import { applyPushDiagnostics, buildClientDiagnosticSnapshot } from "./client-diagnostic-cache.ts";
|
|
14
15
|
import { collectSynchronizedFileDiagnostics } from "./client-diagnostic-collection.ts";
|
|
15
16
|
import {
|
|
@@ -12,7 +12,11 @@ import {
|
|
|
12
12
|
throwIfCodeRequestInterrupted,
|
|
13
13
|
unavailableCodeQuery,
|
|
14
14
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
recordDebugEvent,
|
|
17
|
+
truncateDebugIdentity as truncateIdentity,
|
|
18
|
+
} from "@mrclrchtr/supi-core/debug";
|
|
19
|
+
import { fileToUri } from "@mrclrchtr/supi-core/path";
|
|
16
20
|
import { type ProgressToken, TextDocumentSyncKind } from "vscode-languageserver-protocol";
|
|
17
21
|
import { CLIENT_CAPABILITIES } from "../config/capabilities.ts";
|
|
18
22
|
import type {
|
|
@@ -35,10 +39,9 @@ import type {
|
|
|
35
39
|
WorkspaceEdit,
|
|
36
40
|
WorkspaceSymbol,
|
|
37
41
|
} from "../config/types.ts";
|
|
38
|
-
import { boundCwd
|
|
42
|
+
import { boundCwd } from "../debug-telemetry.ts";
|
|
39
43
|
import type { DiagnosticEvidenceSummary } from "../diagnostics/evidence.ts";
|
|
40
44
|
import { raceRequestControl } from "../session/readiness.ts";
|
|
41
|
-
import { fileToUri } from "../utils.ts";
|
|
42
45
|
import {
|
|
43
46
|
ClientDynamicRegistrations,
|
|
44
47
|
DOCUMENT_DIAGNOSTIC_METHOD,
|
|
@@ -141,6 +144,15 @@ function killProcessTree(pid: number): void {
|
|
|
141
144
|
}
|
|
142
145
|
}
|
|
143
146
|
|
|
147
|
+
/** Terminate a failed startup without leaving server descendants running. */
|
|
148
|
+
function killFailedStartupProcess(child: ChildProcess): void {
|
|
149
|
+
if (child.pid) {
|
|
150
|
+
killProcessTree(child.pid);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
child.kill();
|
|
154
|
+
}
|
|
155
|
+
|
|
144
156
|
// ── Types ─────────────────────────────────────────────────────────────
|
|
145
157
|
export type ClientStatus = "initializing" | "running" | "error" | "shutdown";
|
|
146
158
|
|
|
@@ -285,7 +297,7 @@ export class LspClient {
|
|
|
285
297
|
if (!this.process.stdin || !this.process.stdout) {
|
|
286
298
|
const failure = new Error(`${cmd}: missing stdin/stdout`);
|
|
287
299
|
this.handleProcessFailure(failure);
|
|
288
|
-
this.process
|
|
300
|
+
killFailedStartupProcess(this.process);
|
|
289
301
|
throw failure;
|
|
290
302
|
}
|
|
291
303
|
|
|
@@ -350,7 +362,7 @@ export class LspClient {
|
|
|
350
362
|
} catch (err) {
|
|
351
363
|
const failure = new Error(`${this.name}: initialize failed: ${err}`, { cause: err });
|
|
352
364
|
this.handleProcessFailure(failure);
|
|
353
|
-
this.process
|
|
365
|
+
killFailedStartupProcess(this.process);
|
|
354
366
|
throw failure;
|
|
355
367
|
}
|
|
356
368
|
}
|
|
@@ -7,7 +7,10 @@ import {
|
|
|
7
7
|
type CodeRequestControl,
|
|
8
8
|
CodeRequestDeadlineError,
|
|
9
9
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
startDebugTimer,
|
|
12
|
+
truncateDebugIdentity as truncateIdentity,
|
|
13
|
+
} from "@mrclrchtr/supi-core/debug";
|
|
11
14
|
import {
|
|
12
15
|
CancellationTokenSource,
|
|
13
16
|
createMessageConnection,
|
|
@@ -18,7 +21,7 @@ import {
|
|
|
18
21
|
StreamMessageReader,
|
|
19
22
|
StreamMessageWriter,
|
|
20
23
|
} from "vscode-jsonrpc/node";
|
|
21
|
-
import { boundCwd, LSP_REQUEST_TIMEOUT_ERROR_CODE
|
|
24
|
+
import { boundCwd, LSP_REQUEST_TIMEOUT_ERROR_CODE } from "../debug-telemetry.ts";
|
|
22
25
|
|
|
23
26
|
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
24
27
|
|
|
@@ -112,34 +115,40 @@ export class JsonRpcClient {
|
|
|
112
115
|
const methodClass = classifyRequestMethod(method);
|
|
113
116
|
const boundedMethod = truncateIdentity(method);
|
|
114
117
|
const timer = startDebugTimer();
|
|
118
|
+
// A request cancelled before dispatch must not produce protocol traffic.
|
|
119
|
+
if (signal?.aborted) {
|
|
120
|
+
return rejectUndispatchedRequest(
|
|
121
|
+
signal.reason ?? new Error(`Request ${method} was cancelled`),
|
|
122
|
+
{
|
|
123
|
+
timer,
|
|
124
|
+
operationId: options?.operationId,
|
|
125
|
+
observation: { method: boundedMethod, methodClass, outcome: "cancelled" },
|
|
126
|
+
identity: { server: this.server, cwd: this.cwd },
|
|
127
|
+
},
|
|
128
|
+
);
|
|
129
|
+
}
|
|
115
130
|
// An expired absolute deadline must not even send the request: the caller
|
|
116
131
|
// no longer awaits a result, so no protocol traffic may start.
|
|
117
132
|
if (deadlineMs !== undefined && deadlineMs <= 0) {
|
|
118
|
-
|
|
133
|
+
return rejectUndispatchedRequest(new CodeRequestDeadlineError(), {
|
|
119
134
|
timer,
|
|
120
|
-
options?.operationId,
|
|
121
|
-
{
|
|
135
|
+
operationId: options?.operationId,
|
|
136
|
+
observation: {
|
|
122
137
|
method: boundedMethod,
|
|
123
138
|
methodClass,
|
|
124
139
|
outcome: "timed-out",
|
|
125
140
|
errorCode: LSP_REQUEST_TIMEOUT_ERROR_CODE,
|
|
126
141
|
},
|
|
127
|
-
{ server: this.server, cwd: this.cwd },
|
|
128
|
-
);
|
|
129
|
-
return Promise.reject(new CodeRequestDeadlineError());
|
|
142
|
+
identity: { server: this.server, cwd: this.cwd },
|
|
143
|
+
});
|
|
130
144
|
}
|
|
131
145
|
if (this.closed || !this.connection) {
|
|
132
|
-
|
|
146
|
+
return rejectUndispatchedRequest(new Error("JSON-RPC client is closed"), {
|
|
133
147
|
timer,
|
|
134
|
-
options?.operationId,
|
|
135
|
-
{
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
outcome: "cancelled",
|
|
139
|
-
},
|
|
140
|
-
{ server: this.server, cwd: this.cwd },
|
|
141
|
-
);
|
|
142
|
-
return Promise.reject(new Error("JSON-RPC client is closed"));
|
|
148
|
+
operationId: options?.operationId,
|
|
149
|
+
observation: { method: boundedMethod, methodClass, outcome: "cancelled" },
|
|
150
|
+
identity: { server: this.server, cwd: this.cwd },
|
|
151
|
+
});
|
|
143
152
|
}
|
|
144
153
|
const tokenSource = new CancellationTokenSource();
|
|
145
154
|
let timeout: ReturnType<typeof setTimeout> | undefined;
|
|
@@ -344,6 +353,19 @@ function jsonRpcErrorCode(error: unknown): number | undefined {
|
|
|
344
353
|
return typeof code === "number" && Number.isInteger(code) ? code : undefined;
|
|
345
354
|
}
|
|
346
355
|
|
|
356
|
+
function rejectUndispatchedRequest(
|
|
357
|
+
error: unknown,
|
|
358
|
+
timing: {
|
|
359
|
+
timer: ReturnType<typeof startDebugTimer>;
|
|
360
|
+
operationId: string | undefined;
|
|
361
|
+
observation: RequestTimingObservation;
|
|
362
|
+
identity: { server?: string; cwd?: string };
|
|
363
|
+
},
|
|
364
|
+
): Promise<never> {
|
|
365
|
+
recordRequestTiming(timing.timer, timing.operationId, timing.observation, timing.identity);
|
|
366
|
+
return Promise.reject(error);
|
|
367
|
+
}
|
|
368
|
+
|
|
347
369
|
function recordRequestTiming(
|
|
348
370
|
timer: ReturnType<typeof startDebugTimer>,
|
|
349
371
|
operationId: string | undefined,
|