@namzu/lsp 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +17 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/routing.d.ts +5 -5
- package/dist/routing.d.ts.map +1 -1
- package/dist/routing.js +17 -9
- package/dist/routing.js.map +1 -1
- package/dist/stdio.d.ts +23 -5
- package/dist/stdio.d.ts.map +1 -1
- package/dist/stdio.js +129 -44
- package/dist/stdio.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/routing.ts +36 -9
- package/src/stdio.ts +217 -56
- package/src/types.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @namzu/lsp
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9642d5d: An `lsp` call now takes the turn's abort signal, so stopping a turn ends a
|
|
8
|
+
language-server request instead of leaving the turn waiting on it.
|
|
9
|
+
|
|
10
|
+
The four `CodeNavigationProvider` methods take an optional last argument,
|
|
11
|
+
`CodeNavigationRequestOptions` (`{ signal }`). Aborting it drops that request
|
|
12
|
+
from the pending table, sends the server `$/cancelRequest`, and answers with a
|
|
13
|
+
new `interrupted` arm, `{ kind: 'interrupted', reason }`, on
|
|
14
|
+
`CodeNavigationResult`, `HoverResult` and `SymbolSearchResult`.
|
|
15
|
+
|
|
16
|
+
That arm is added to the result unions, so a consumer that switches over all
|
|
17
|
+
three existing arms exhaustively needs one more. `interrupted` is deliberately
|
|
18
|
+
not `failed`: the server did nothing wrong, the next call still uses it, and
|
|
19
|
+
the answer is unknown only because nobody finished asking. It is deliberately
|
|
20
|
+
not an empty `locations`/`symbols` list either — that reads as "nothing uses
|
|
21
|
+
this", which is what a deletion is made on.
|
|
22
|
+
|
|
23
|
+
The `lsp` builtin passes `ToolContext.abortSignal` and returns a stopped turn
|
|
24
|
+
before starting a server at all; it reports an interrupted call as interrupted
|
|
25
|
+
and unknown rather than empty.
|
|
26
|
+
|
|
27
|
+
`StdioCodeNavigationProvider` also bounds a handshake against each caller's
|
|
28
|
+
signal. The start stays shared, so one caller's abort stops that caller
|
|
29
|
+
waiting and leaves the `initialize` to finish under its own startup timeout,
|
|
30
|
+
which still fails with the binary named and the timeout stated.
|
|
31
|
+
|
|
3
32
|
## 0.3.3
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -61,6 +61,23 @@ const tools = toolset('lsp', getCodeNavigationTools(codeNavigation))
|
|
|
61
61
|
await codeNavigation.dispose()
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
## Cancellation
|
|
65
|
+
|
|
66
|
+
Every call takes the turn's signal as an optional last argument:
|
|
67
|
+
`references(file, line, character, { signal })`, and the same for
|
|
68
|
+
`definition`, `hover`, and `symbols(query, scope, { signal })`. Aborting it
|
|
69
|
+
drops that request, sends `$/cancelRequest` so the server can stop working on
|
|
70
|
+
it, and answers `{ kind: 'interrupted' }` — never `failed`, and never an
|
|
71
|
+
empty list. The server is not treated as broken, so the next call still uses
|
|
72
|
+
it; a call made after the turn is already stopped returns `interrupted`
|
|
73
|
+
without spawning a server at all. The handshake is shared between callers, so
|
|
74
|
+
one caller's abort stops that caller waiting and leaves the start to finish
|
|
75
|
+
under its own startup timeout.
|
|
76
|
+
|
|
77
|
+
A server that never completes `initialize` fails with `{ kind: 'failed' }`
|
|
78
|
+
naming the binary and the timeout, rather than answering navigation queries
|
|
79
|
+
with an empty result.
|
|
80
|
+
|
|
64
81
|
## Documentation
|
|
65
82
|
|
|
66
83
|
- [Namzu docs](https://github.com/cogitave/namzu/tree/main/docs)
|
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export { StdioCodeNavigationProvider } from './stdio.js';
|
|
|
2
2
|
export type { StdioCodeNavigationOptions } from './stdio.js';
|
|
3
3
|
export { RoutingCodeNavigationProvider } from './routing.js';
|
|
4
4
|
export type { CodeNavigationRoute, RoutingCodeNavigationOptions } from './routing.js';
|
|
5
|
-
export type { CodeNavigationProvider, CodeNavigationResult, HoverResult, SourceLocation, SymbolLocation, SymbolSearchResult, } from './types.js';
|
|
5
|
+
export type { CodeNavigationProvider, CodeNavigationRequestOptions, CodeNavigationResult, HoverResult, SourceLocation, SymbolLocation, SymbolSearchResult, } from './types.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAA;AACxD,YAAY,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAA;AAC5D,YAAY,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AACrF,YAAY,EACX,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,cAAc,EACd,kBAAkB,GAClB,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAA;AACxD,YAAY,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAA;AAC5D,YAAY,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AACrF,YAAY,EACX,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,cAAc,EACd,kBAAkB,GAClB,MAAM,YAAY,CAAA"}
|
package/dist/routing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type StdioCodeNavigationOptions } from './stdio.js';
|
|
2
|
-
import type { CodeNavigationProvider, CodeNavigationResult, HoverResult, SymbolSearchResult } from './types.js';
|
|
2
|
+
import type { CodeNavigationProvider, CodeNavigationRequestOptions, CodeNavigationResult, HoverResult, SymbolSearchResult } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* One server per language, started when its first file is asked about.
|
|
5
5
|
*
|
|
@@ -39,9 +39,9 @@ export declare class RoutingCodeNavigationProvider implements CodeNavigationProv
|
|
|
39
39
|
private readonly started;
|
|
40
40
|
private readonly create;
|
|
41
41
|
constructor(options: RoutingCodeNavigationOptions);
|
|
42
|
-
definition(file: string, line: number, character: number): Promise<CodeNavigationResult>;
|
|
43
|
-
references(file: string, line: number, character: number): Promise<CodeNavigationResult>;
|
|
44
|
-
hover(file: string, line: number, character: number): Promise<HoverResult>;
|
|
42
|
+
definition(file: string, line: number, character: number, options?: CodeNavigationRequestOptions): Promise<CodeNavigationResult>;
|
|
43
|
+
references(file: string, line: number, character: number, options?: CodeNavigationRequestOptions): Promise<CodeNavigationResult>;
|
|
44
|
+
hover(file: string, line: number, character: number, options?: CodeNavigationRequestOptions): Promise<HoverResult>;
|
|
45
45
|
/**
|
|
46
46
|
* Search by name, across one language or all of them.
|
|
47
47
|
*
|
|
@@ -50,7 +50,7 @@ export declare class RoutingCodeNavigationProvider implements CodeNavigationProv
|
|
|
50
50
|
* because "find this symbol" in a mixed repository means all of it and a
|
|
51
51
|
* caller who wanted one language would have said which.
|
|
52
52
|
*/
|
|
53
|
-
symbols(query: string, scope?: string): Promise<SymbolSearchResult>;
|
|
53
|
+
symbols(query: string, scope?: string, options?: CodeNavigationRequestOptions): Promise<SymbolSearchResult>;
|
|
54
54
|
dispose(): Promise<void>;
|
|
55
55
|
/** How many servers are running. For a test asserting reuse. */
|
|
56
56
|
startedCount(): number;
|
package/dist/routing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../src/routing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,0BAA0B,EAA+B,MAAM,YAAY,CAAA;AACzF,OAAO,KAAK,EACX,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EACX,kBAAkB,EAClB,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,mBAAmB;IACnC,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;IACtC,QAAQ,CAAC,MAAM,EAAE,0BAA0B,CAAA;CAC3C;AAED,MAAM,WAAW,4BAA4B;IAC5C,QAAQ,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAA;IAC/C;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,0BAA0B,KAAK,sBAAsB,CAAA;CACzF;AAED,qBAAa,6BAA8B,YAAW,sBAAsB;IAC3E,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAyC;IACrE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyD;IACjF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiE;gBAE5E,OAAO,EAAE,4BAA4B;IAY3C,UAAU,
|
|
1
|
+
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../src/routing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,0BAA0B,EAA+B,MAAM,YAAY,CAAA;AACzF,OAAO,KAAK,EACX,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,WAAW,EACX,kBAAkB,EAClB,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,mBAAmB;IACnC,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM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23 @@ export class RoutingCodeNavigationProvider {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
async definition(file, line, character) {
|
|
18
|
+
async definition(file, line, character, options) {
|
|
19
19
|
const routed = this.routeFor(file);
|
|
20
20
|
if ('reason' in routed)
|
|
21
21
|
return { kind: 'unsupported', reason: routed.reason };
|
|
22
|
-
return await routed.provider.definition(file, line, character);
|
|
22
|
+
return await routed.provider.definition(file, line, character, options);
|
|
23
23
|
}
|
|
24
|
-
async references(file, line, character) {
|
|
24
|
+
async references(file, line, character, options) {
|
|
25
25
|
const routed = this.routeFor(file);
|
|
26
26
|
if ('reason' in routed)
|
|
27
27
|
return { kind: 'unsupported', reason: routed.reason };
|
|
28
|
-
return await routed.provider.references(file, line, character);
|
|
28
|
+
return await routed.provider.references(file, line, character, options);
|
|
29
29
|
}
|
|
30
|
-
async hover(file, line, character) {
|
|
30
|
+
async hover(file, line, character, options) {
|
|
31
31
|
const routed = this.routeFor(file);
|
|
32
32
|
if ('reason' in routed)
|
|
33
33
|
return { kind: 'unsupported', reason: routed.reason };
|
|
34
|
-
return await routed.provider.hover(file, line, character);
|
|
34
|
+
return await routed.provider.hover(file, line, character, options);
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Search by name, across one language or all of them.
|
|
@@ -41,24 +41,32 @@ export class RoutingCodeNavigationProvider {
|
|
|
41
41
|
* because "find this symbol" in a mixed repository means all of it and a
|
|
42
42
|
* caller who wanted one language would have said which.
|
|
43
43
|
*/
|
|
44
|
-
async symbols(query, scope) {
|
|
44
|
+
async symbols(query, scope, options) {
|
|
45
45
|
if (scope) {
|
|
46
46
|
const routed = this.routeFor(scope);
|
|
47
47
|
if ('reason' in routed)
|
|
48
48
|
return { kind: 'unsupported', reason: routed.reason };
|
|
49
|
-
return await routed.provider.symbols(query, scope);
|
|
49
|
+
return await routed.provider.symbols(query, scope, options);
|
|
50
50
|
}
|
|
51
51
|
const routes = [...new Set(this.byExtension.values())];
|
|
52
52
|
if (routes.length === 0) {
|
|
53
53
|
return { kind: 'unsupported', reason: 'No language servers are configured.' };
|
|
54
54
|
}
|
|
55
|
-
const answers = await Promise.all(routes.map(async (route) => await this.providerFor(route).symbols(query)));
|
|
55
|
+
const answers = await Promise.all(routes.map(async (route) => await this.providerFor(route).symbols(query, undefined, options)));
|
|
56
56
|
const found = answers.flatMap((a) => (a.kind === 'symbols' ? a.symbols : []));
|
|
57
57
|
if (found.length > 0)
|
|
58
58
|
return { kind: 'symbols', symbols: found };
|
|
59
59
|
// Nothing found anywhere. If EVERY server refused, that is not an empty
|
|
60
60
|
// result — nobody looked. Reporting it as `symbols: []` would tell the
|
|
61
61
|
// caller the name does not exist in the repository.
|
|
62
|
+
//
|
|
63
|
+
// An interrupted search is the same claim from the other side: the
|
|
64
|
+
// caller stopped it, so no server got to finish looking. It is checked
|
|
65
|
+
// first because it names the reason the caller itself supplied, and a
|
|
66
|
+
// turn that was stopped should not be handed a transport failure.
|
|
67
|
+
const interrupted = answers.find((a) => a.kind === 'interrupted');
|
|
68
|
+
if (interrupted)
|
|
69
|
+
return interrupted;
|
|
62
70
|
const failure = answers.find((a) => a.kind === 'failed');
|
|
63
71
|
if (failure)
|
|
64
72
|
return failure;
|
package/dist/routing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.js","sourceRoot":"","sources":["../src/routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAmC,2BAA2B,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"routing.js","sourceRoot":"","sources":["../src/routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAmC,2BAA2B,EAAE,MAAM,YAAY,CAAA;AA8CzF,MAAM,OAAO,6BAA6B;IACxB,WAAW,GAAG,IAAI,GAAG,EAA+B,CAA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,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;QACjF,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;IACrB,CAAC;IAED,gEAAgE;IAChE,YAAY;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;IACzB,CAAC;IAEO,QAAQ,CAAC,IAAY;QAC5B,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAA;QAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QAC7C,IAAI,CAAC,KAAK,EAAE,CAAC;YACZ,OAAO;gBACN,MAAM,EAAE,yCAAyC,SAAS,IAAI,IAAI,oEAAoE;aACtI,CAAA;QACF,CAAC;QACD,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAA;IAC7C,CAAC;IAEO,WAAW,CAAC,KAA0B;QAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACxC,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAA;QAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QACzC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAChC,OAAO,OAAO,CAAA;IACf,CAAC;CACD"}
|
package/dist/stdio.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CodeNavigationProvider, CodeNavigationResult, HoverResult, SymbolSearchResult } from './types.js';
|
|
1
|
+
import type { CodeNavigationProvider, CodeNavigationRequestOptions, CodeNavigationResult, HoverResult, SymbolSearchResult } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* One language server, over its stdin and stdout.
|
|
4
4
|
*
|
|
@@ -18,6 +18,12 @@ import type { CodeNavigationProvider, CodeNavigationResult, HoverResult, SymbolS
|
|
|
18
18
|
* answer produces `{ kind: 'failed' }` naming the binary. Returning
|
|
19
19
|
* `{ kind: 'locations', locations: [] }` there tells an agent the symbol has
|
|
20
20
|
* no callers, and the agent then deletes it.
|
|
21
|
+
*
|
|
22
|
+
* **A caller that stops waiting is not a failure either.** The turn's signal
|
|
23
|
+
* travels with the request: aborting it drops that request, tells the server
|
|
24
|
+
* with `$/cancelRequest`, and answers `{ kind: 'interrupted' }`. Latching
|
|
25
|
+
* that as a terminal transport error would take navigation away for the
|
|
26
|
+
* rest of the session because somebody pressed Esc once.
|
|
21
27
|
*/
|
|
22
28
|
export interface StdioCodeNavigationOptions {
|
|
23
29
|
/** The server binary. */
|
|
@@ -58,14 +64,26 @@ export declare class StdioCodeNavigationProvider implements CodeNavigationProvid
|
|
|
58
64
|
private terminalError;
|
|
59
65
|
private disposed;
|
|
60
66
|
constructor(options: StdioCodeNavigationOptions);
|
|
61
|
-
definition(file: string, line: number, character: number): Promise<CodeNavigationResult>;
|
|
62
|
-
references(file: string, line: number, character: number): Promise<CodeNavigationResult>;
|
|
63
|
-
hover(file: string, line: number, character: number): Promise<HoverResult>;
|
|
64
|
-
symbols(query: string, _scope?: string): Promise<SymbolSearchResult>;
|
|
67
|
+
definition(file: string, line: number, character: number, options?: CodeNavigationRequestOptions): Promise<CodeNavigationResult>;
|
|
68
|
+
references(file: string, line: number, character: number, options?: CodeNavigationRequestOptions): Promise<CodeNavigationResult>;
|
|
69
|
+
hover(file: string, line: number, character: number, options?: CodeNavigationRequestOptions): Promise<HoverResult>;
|
|
70
|
+
symbols(query: string, _scope?: string, options?: CodeNavigationRequestOptions): Promise<SymbolSearchResult>;
|
|
65
71
|
private navigate;
|
|
72
|
+
/**
|
|
73
|
+
* Wait for the handshake, but never past the caller's signal.
|
|
74
|
+
*
|
|
75
|
+
* The start is SHARED — one process, one `initialize` — so one caller's
|
|
76
|
+
* abort must not fail it for everyone else: it stops that caller waiting
|
|
77
|
+
* and leaves the handshake alone, bounded by the startup timeout that was
|
|
78
|
+
* already running. The rejection of the shared promise is observed here so
|
|
79
|
+
* an abort that outlives its caller is not an unhandled rejection.
|
|
80
|
+
*/
|
|
81
|
+
private ready;
|
|
66
82
|
/** Spawn and handshake, once, and remember a failure so it is not retried per call. */
|
|
67
83
|
private start;
|
|
68
84
|
private request;
|
|
85
|
+
/** Drop a request from the table, releasing its timer and abort listener. */
|
|
86
|
+
private forget;
|
|
69
87
|
private notify;
|
|
70
88
|
private write;
|
|
71
89
|
private writeTo;
|
package/dist/stdio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EAGX,kBAAkB,EAClB,MAAM,YAAY,CAAA;AAEnB
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,WAAW,EAGX,kBAAkB,EAClB,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,WAAW,0BAA0B;IAC1C,yBAAyB;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,yCAAyC;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,sCAAsC;IACtC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAClC,yCAAyC;IACzC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA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AAO,CAAC,MAAM;IAUd,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,KAAK;IAQb,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,gBAAgB;IAmDxB,gFAAgF;IAChF,OAAO,CAAC,eAAe;IAQvB;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO;IAuBf,OAAO,CAAC,OAAO;IAoBT,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CA2C9B"}
|
package/dist/stdio.js
CHANGED
|
@@ -2,6 +2,23 @@ import { spawn } from 'node:child_process';
|
|
|
2
2
|
import { pathToFileURL } from 'node:url';
|
|
3
3
|
const DEFAULT_STARTUP_TIMEOUT_MS = 15_000;
|
|
4
4
|
const DEFAULT_REQUEST_TIMEOUT_MS = 20_000;
|
|
5
|
+
/**
|
|
6
|
+
* A request the caller stopped waiting for.
|
|
7
|
+
*
|
|
8
|
+
* Its own error type, recognised by instance rather than by message text: an
|
|
9
|
+
* abort is a control-flow signal, and every caller has to answer it with the
|
|
10
|
+
* `interrupted` arm rather than with `failed`. Matching on wording instead
|
|
11
|
+
* would classify a server that happened to say "cancel" as an abort.
|
|
12
|
+
*/
|
|
13
|
+
class InterruptedError extends Error {
|
|
14
|
+
constructor(reason) {
|
|
15
|
+
super(reason);
|
|
16
|
+
this.name = 'AbortError';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function interrupted(reason) {
|
|
20
|
+
return new InterruptedError(reason);
|
|
21
|
+
}
|
|
5
22
|
function toSourceLocation(location) {
|
|
6
23
|
// `file://` off, so a caller gets a path it can hand to `readFile`. The
|
|
7
24
|
// wire speaks URIs because a server may serve untitled buffers; every
|
|
@@ -46,23 +63,23 @@ export class StdioCodeNavigationProvider {
|
|
|
46
63
|
constructor(options) {
|
|
47
64
|
this.options = options;
|
|
48
65
|
}
|
|
49
|
-
async definition(file, line, character) {
|
|
50
|
-
return await this.navigate('textDocument/definition', file, line, character, {});
|
|
66
|
+
async definition(file, line, character, options) {
|
|
67
|
+
return await this.navigate('textDocument/definition', file, line, character, {}, options);
|
|
51
68
|
}
|
|
52
|
-
async references(file, line, character) {
|
|
69
|
+
async references(file, line, character, options) {
|
|
53
70
|
return await this.navigate('textDocument/references', file, line, character, {
|
|
54
71
|
// The declaration itself is not a "use". An agent asking who calls
|
|
55
72
|
// this wants the call sites; including the declaration inflates the
|
|
56
73
|
// count by one and reads as a caller that does not exist.
|
|
57
74
|
context: { includeDeclaration: false },
|
|
58
|
-
});
|
|
75
|
+
}, options);
|
|
59
76
|
}
|
|
60
|
-
async hover(file, line, character) {
|
|
77
|
+
async hover(file, line, character, options) {
|
|
61
78
|
try {
|
|
62
|
-
await this.
|
|
79
|
+
await this.ready(options);
|
|
63
80
|
}
|
|
64
81
|
catch (err) {
|
|
65
|
-
return
|
|
82
|
+
return toStartFailure(err);
|
|
66
83
|
}
|
|
67
84
|
if (this.capabilities.hoverProvider === false) {
|
|
68
85
|
return { kind: 'unsupported', reason: `${this.options.command} declares no hoverProvider.` };
|
|
@@ -71,7 +88,7 @@ export class StdioCodeNavigationProvider {
|
|
|
71
88
|
const result = await this.request('textDocument/hover', {
|
|
72
89
|
textDocument: { uri: pathToFileURL(file).href },
|
|
73
90
|
position: { line, character },
|
|
74
|
-
});
|
|
91
|
+
}, options?.signal);
|
|
75
92
|
// EMPTY, not failed. Hovering over whitespace or a comment resolves
|
|
76
93
|
// to nothing, and a caller has to be able to tell that from a server
|
|
77
94
|
// that broke — the same distinction `locations: []` carries.
|
|
@@ -81,12 +98,12 @@ export class StdioCodeNavigationProvider {
|
|
|
81
98
|
return toFailure(err, `${this.options.command}`, 'textDocument/hover');
|
|
82
99
|
}
|
|
83
100
|
}
|
|
84
|
-
async symbols(query, _scope) {
|
|
101
|
+
async symbols(query, _scope, options) {
|
|
85
102
|
try {
|
|
86
|
-
await this.
|
|
103
|
+
await this.ready(options);
|
|
87
104
|
}
|
|
88
105
|
catch (err) {
|
|
89
|
-
return
|
|
106
|
+
return toStartFailure(err);
|
|
90
107
|
}
|
|
91
108
|
// The DECLARED capability decides which request goes out. A server
|
|
92
109
|
// with a workspace index answers the whole repository; one with only
|
|
@@ -94,7 +111,7 @@ export class StdioCodeNavigationProvider {
|
|
|
94
111
|
// told so rather than asked and silently mishandled.
|
|
95
112
|
if (this.capabilities.workspaceSymbolProvider) {
|
|
96
113
|
try {
|
|
97
|
-
const result = await this.request('workspace/symbol', { query });
|
|
114
|
+
const result = await this.request('workspace/symbol', { query }, options?.signal);
|
|
98
115
|
return { kind: 'symbols', symbols: toSymbols(result) };
|
|
99
116
|
}
|
|
100
117
|
catch (err) {
|
|
@@ -109,9 +126,7 @@ export class StdioCodeNavigationProvider {
|
|
|
109
126
|
};
|
|
110
127
|
}
|
|
111
128
|
try {
|
|
112
|
-
const result = await this.request('textDocument/documentSymbol', {
|
|
113
|
-
textDocument: { uri: pathToFileURL(_scope).href },
|
|
114
|
-
});
|
|
129
|
+
const result = await this.request('textDocument/documentSymbol', { textDocument: { uri: pathToFileURL(_scope).href } }, options?.signal);
|
|
115
130
|
return {
|
|
116
131
|
kind: 'symbols',
|
|
117
132
|
symbols: toSymbols(result, _scope).filter((s) => s.name.includes(query)),
|
|
@@ -126,19 +141,19 @@ export class StdioCodeNavigationProvider {
|
|
|
126
141
|
reason: `${this.options.command} declares neither workspaceSymbolProvider nor documentSymbolProvider, so it cannot find a symbol by name.`,
|
|
127
142
|
};
|
|
128
143
|
}
|
|
129
|
-
async navigate(method, file, line, character, extra) {
|
|
144
|
+
async navigate(method, file, line, character, extra, options) {
|
|
130
145
|
try {
|
|
131
|
-
await this.
|
|
146
|
+
await this.ready(options);
|
|
132
147
|
}
|
|
133
148
|
catch (err) {
|
|
134
|
-
return
|
|
149
|
+
return toStartFailure(err);
|
|
135
150
|
}
|
|
136
151
|
try {
|
|
137
152
|
const result = await this.request(method, {
|
|
138
153
|
textDocument: { uri: pathToFileURL(file).href },
|
|
139
154
|
position: { line, character },
|
|
140
155
|
...extra,
|
|
141
|
-
});
|
|
156
|
+
}, options?.signal);
|
|
142
157
|
if (result === null || result === undefined) {
|
|
143
158
|
// A server that answered `null` looked and found nothing. That is
|
|
144
159
|
// an empty location list, not a failure — and saying so is what
|
|
@@ -154,18 +169,40 @@ export class StdioCodeNavigationProvider {
|
|
|
154
169
|
};
|
|
155
170
|
}
|
|
156
171
|
catch (err) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
172
|
+
return toFailure(err, this.options.command, method);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Wait for the handshake, but never past the caller's signal.
|
|
177
|
+
*
|
|
178
|
+
* The start is SHARED — one process, one `initialize` — so one caller's
|
|
179
|
+
* abort must not fail it for everyone else: it stops that caller waiting
|
|
180
|
+
* and leaves the handshake alone, bounded by the startup timeout that was
|
|
181
|
+
* already running. The rejection of the shared promise is observed here so
|
|
182
|
+
* an abort that outlives its caller is not an unhandled rejection.
|
|
183
|
+
*/
|
|
184
|
+
async ready(options) {
|
|
185
|
+
const signal = options?.signal;
|
|
186
|
+
// Checked BEFORE the start is begun: a stopped turn must not spawn a
|
|
187
|
+
// language server it has no question left to ask.
|
|
188
|
+
if (signal?.aborted) {
|
|
189
|
+
throw interrupted(`The call was cancelled before the language server "${this.options.command}" was asked.`);
|
|
168
190
|
}
|
|
191
|
+
const starting = this.start();
|
|
192
|
+
if (!signal)
|
|
193
|
+
return await starting;
|
|
194
|
+
starting.catch(() => { });
|
|
195
|
+
await new Promise((resolve, reject) => {
|
|
196
|
+
const onAbort = () => reject(interrupted(`The call was cancelled while the language server "${this.options.command}" was starting.`));
|
|
197
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
198
|
+
starting.then(() => {
|
|
199
|
+
signal.removeEventListener('abort', onAbort);
|
|
200
|
+
resolve();
|
|
201
|
+
}, (err) => {
|
|
202
|
+
signal.removeEventListener('abort', onAbort);
|
|
203
|
+
reject(err);
|
|
204
|
+
});
|
|
205
|
+
});
|
|
169
206
|
}
|
|
170
207
|
/** Spawn and handshake, once, and remember a failure so it is not retried per call. */
|
|
171
208
|
start() {
|
|
@@ -219,7 +256,7 @@ export class StdioCodeNavigationProvider {
|
|
|
219
256
|
});
|
|
220
257
|
return this.starting;
|
|
221
258
|
}
|
|
222
|
-
request(method, params) {
|
|
259
|
+
request(method, params, signal) {
|
|
223
260
|
if (this.disposed)
|
|
224
261
|
return Promise.reject(new Error('This code navigation provider is disposed.'));
|
|
225
262
|
if (this.terminalError)
|
|
@@ -227,16 +264,48 @@ export class StdioCodeNavigationProvider {
|
|
|
227
264
|
if (!this.child) {
|
|
228
265
|
return Promise.reject(new Error(`The language server "${this.options.command}" is not running.`));
|
|
229
266
|
}
|
|
267
|
+
if (signal?.aborted) {
|
|
268
|
+
// Nothing was sent, so there is nothing to answer and nothing to
|
|
269
|
+
// cancel: the server is not told about a request it never received.
|
|
270
|
+
return Promise.reject(interrupted(`The call was cancelled before the language server "${this.options.command}" was asked for ${method}.`));
|
|
271
|
+
}
|
|
230
272
|
this.seq += 1;
|
|
231
273
|
const id = this.seq;
|
|
232
274
|
const timeoutMs = this.options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
233
275
|
return new Promise((resolve, reject) => {
|
|
234
276
|
const timer = setTimeout(() => {
|
|
235
|
-
this.
|
|
277
|
+
this.forget(id);
|
|
236
278
|
reject(new Error(`The language server did not answer ${method} within ${timeoutMs}ms.`));
|
|
237
279
|
}, timeoutMs);
|
|
238
280
|
timer.unref?.();
|
|
239
|
-
|
|
281
|
+
const onAbort = signal
|
|
282
|
+
? () => {
|
|
283
|
+
// Only the caller stops waiting. The transport is fine, so the
|
|
284
|
+
// server stays up for the next call — this is not a `failed`
|
|
285
|
+
// transport, and latching it as one would kill navigation for a
|
|
286
|
+
// turn that pressed Esc.
|
|
287
|
+
this.forget(id);
|
|
288
|
+
// A server grinding through a slow index otherwise keeps
|
|
289
|
+
// answering a question nobody is waiting for. Its answer, if it
|
|
290
|
+
// sends one, finds no waiter and is dropped by `deliver`.
|
|
291
|
+
try {
|
|
292
|
+
this.notify('$/cancelRequest', { id });
|
|
293
|
+
}
|
|
294
|
+
catch {
|
|
295
|
+
// The pipe is gone. The transport listeners retire it.
|
|
296
|
+
}
|
|
297
|
+
reject(interrupted(`The call was cancelled before the language server "${this.options.command}" answered ${method}.`));
|
|
298
|
+
}
|
|
299
|
+
: undefined;
|
|
300
|
+
if (signal && onAbort)
|
|
301
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
302
|
+
this.pending.set(id, {
|
|
303
|
+
resolve,
|
|
304
|
+
reject,
|
|
305
|
+
timer,
|
|
306
|
+
...(signal ? { signal } : {}),
|
|
307
|
+
...(onAbort ? { onAbort } : {}),
|
|
308
|
+
});
|
|
240
309
|
try {
|
|
241
310
|
this.write({ jsonrpc: '2.0', id, method, params });
|
|
242
311
|
}
|
|
@@ -245,6 +314,17 @@ export class StdioCodeNavigationProvider {
|
|
|
245
314
|
}
|
|
246
315
|
});
|
|
247
316
|
}
|
|
317
|
+
/** Drop a request from the table, releasing its timer and abort listener. */
|
|
318
|
+
forget(id) {
|
|
319
|
+
const waiting = this.pending.get(id);
|
|
320
|
+
if (!waiting)
|
|
321
|
+
return undefined;
|
|
322
|
+
this.pending.delete(id);
|
|
323
|
+
clearTimeout(waiting.timer);
|
|
324
|
+
if (waiting.signal && waiting.onAbort)
|
|
325
|
+
waiting.signal.removeEventListener('abort', waiting.onAbort);
|
|
326
|
+
return waiting;
|
|
327
|
+
}
|
|
248
328
|
notify(method, params) {
|
|
249
329
|
this.write({ jsonrpc: '2.0', method, params });
|
|
250
330
|
}
|
|
@@ -298,11 +378,9 @@ export class StdioCodeNavigationProvider {
|
|
|
298
378
|
if (this.disposed)
|
|
299
379
|
return;
|
|
300
380
|
this.terminalError ??= error.message;
|
|
301
|
-
for (const
|
|
302
|
-
|
|
303
|
-
waiting.reject(new Error(this.terminalError));
|
|
381
|
+
for (const id of [...this.pending.keys()]) {
|
|
382
|
+
this.forget(id)?.reject(new Error(this.terminalError));
|
|
304
383
|
}
|
|
305
|
-
this.pending.clear();
|
|
306
384
|
}
|
|
307
385
|
/**
|
|
308
386
|
* Read the framed stream.
|
|
@@ -349,11 +427,9 @@ export class StdioCodeNavigationProvider {
|
|
|
349
427
|
}
|
|
350
428
|
if (message.id === undefined)
|
|
351
429
|
return;
|
|
352
|
-
const waiting = this.
|
|
430
|
+
const waiting = this.forget(message.id);
|
|
353
431
|
if (!waiting)
|
|
354
432
|
return;
|
|
355
|
-
this.pending.delete(message.id);
|
|
356
|
-
clearTimeout(waiting.timer);
|
|
357
433
|
if (message.error) {
|
|
358
434
|
waiting.reject(new Error(message.error.message ?? `error ${message.error.code ?? 'unknown'}`));
|
|
359
435
|
}
|
|
@@ -367,11 +443,9 @@ export class StdioCodeNavigationProvider {
|
|
|
367
443
|
this.disposed = true;
|
|
368
444
|
const child = this.child;
|
|
369
445
|
this.child = undefined;
|
|
370
|
-
for (const
|
|
371
|
-
|
|
372
|
-
waiting.reject(new Error('The code navigation provider was disposed.'));
|
|
446
|
+
for (const id of [...this.pending.keys()]) {
|
|
447
|
+
this.forget(id)?.reject(new Error('The code navigation provider was disposed.'));
|
|
373
448
|
}
|
|
374
|
-
this.pending.clear();
|
|
375
449
|
if (!child)
|
|
376
450
|
return;
|
|
377
451
|
// The handshake FIRST, so a server with unsaved index state gets to
|
|
@@ -428,6 +502,11 @@ function isLocation(value) {
|
|
|
428
502
|
* cannot construct.
|
|
429
503
|
*/
|
|
430
504
|
function toFailure(err, command, method) {
|
|
505
|
+
// FIRST, before any wording is read: an abort is not a statement about the
|
|
506
|
+
// server, and a server whose error happened to mention cancelling must not
|
|
507
|
+
// be classified as an abort.
|
|
508
|
+
if (err instanceof InterruptedError)
|
|
509
|
+
return { kind: 'interrupted', reason: err.message };
|
|
431
510
|
const message = err instanceof Error ? err.message : String(err);
|
|
432
511
|
// A method the server does not implement is `unsupported`, not `failed`:
|
|
433
512
|
// a caller can fall back and say why the answer is approximate, where a
|
|
@@ -437,6 +516,12 @@ function toFailure(err, command, method) {
|
|
|
437
516
|
}
|
|
438
517
|
return { kind: 'failed', error: message };
|
|
439
518
|
}
|
|
519
|
+
/** The same split for a handshake that was cancelled before a method was even named. */
|
|
520
|
+
function toStartFailure(err) {
|
|
521
|
+
if (err instanceof InterruptedError)
|
|
522
|
+
return { kind: 'interrupted', reason: err.message };
|
|
523
|
+
return { kind: 'failed', error: err instanceof Error ? err.message : String(err) };
|
|
524
|
+
}
|
|
440
525
|
/**
|
|
441
526
|
* The wire's several hover shapes, as one string.
|
|
442
527
|
*
|
package/dist/stdio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AA6CxC,MAAM,0BAA0B,GAAG,MAAM,CAAA;AACzC,MAAM,0BAA0B,GAAG,MAAM,CAAA;AAiBzC,SAAS,gBAAgB,CAAC,QAAqB;IAC9C,wEAAwE;IACxE,sEAAsE;IACtE,oDAAoD;IACpD,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC;QAC9C,CAAC,CAAC,kBAAkB,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;QACpD,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAA;IACf,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAA;IAC9B,OAAO;QACN,IAAI;QACJ,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI;QAC/B,SAAS,EAAE,QAAQ,CA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AAK;gBAClC,CAAC,CAAC,gBAAgB,CAAC;oBACjB,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;oBACzD,KAAK,EAAE,CAAC,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAyB;iBAClE,CAAC;gBACH,CAAC,CAAC,SAAS,CAAA;QACb,IAAI,QAAQ,EAAE,CAAC;YACd,GAAG,CAAC,IAAI,CAAC;gBACR,GAAG,QAAQ;gBACX,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,GAAG,CAAC,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACnE,GAAG,CAAC,OAAO,IAAI,CAAC,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACxF,CAAC,CAAA;QACH,CAAC;QACD,oEAAoE;QACpE,uEAAuE;QACvE,uBAAuB;QACvB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAA;IACtF,CAAC;IACD,OAAO,GAAG,CAAA;AACX,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
* a copy that can drift, with the drifted one deciding whether the `lsp`
|
|
25
25
|
* builtin accepts this provider at all.
|
|
26
26
|
*/
|
|
27
|
-
export type { CodeNavigationProvider, CodeNavigationResult, HoverResult, SourceLocation, SymbolLocation, SymbolSearchResult, } from '@namzu/sdk';
|
|
27
|
+
export type { CodeNavigationProvider, CodeNavigationRequestOptions, CodeNavigationResult, HoverResult, SourceLocation, SymbolLocation, SymbolSearchResult, } from '@namzu/sdk';
|
|
28
28
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;GAQG;AACH,YAAY,EACX,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,cAAc,EACd,kBAAkB,GAClB,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;GAQG;AACH,YAAY,EACX,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,cAAc,EACd,kBAAkB,GAClB,MAAM,YAAY,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@namzu/lsp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Language-server-backed code navigation for @namzu/sdk. Resolves definitions and references through a real language server over stdio, so an agent asked for call sites gets symbol resolution rather than regex matches.",
|
|
5
5
|
"license": "FSL-1.1-MIT",
|
|
6
6
|
"engines": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@types/node": "^22.19.17",
|
|
54
54
|
"typescript": "^5.5.0",
|
|
55
55
|
"vitest": "^4.1.11",
|
|
56
|
-
"@namzu/sdk": "^
|
|
56
|
+
"@namzu/sdk": "^71.1.0"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "tsc --build",
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { RoutingCodeNavigationProvider } from './routing.js'
|
|
|
4
4
|
export type { CodeNavigationRoute, RoutingCodeNavigationOptions } from './routing.js'
|
|
5
5
|
export type {
|
|
6
6
|
CodeNavigationProvider,
|
|
7
|
+
CodeNavigationRequestOptions,
|
|
7
8
|
CodeNavigationResult,
|
|
8
9
|
HoverResult,
|
|
9
10
|
SourceLocation,
|
package/src/routing.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { extname } from 'node:path'
|
|
|
3
3
|
import { type StdioCodeNavigationOptions, StdioCodeNavigationProvider } from './stdio.js'
|
|
4
4
|
import type {
|
|
5
5
|
CodeNavigationProvider,
|
|
6
|
+
CodeNavigationRequestOptions,
|
|
6
7
|
CodeNavigationResult,
|
|
7
8
|
HoverResult,
|
|
8
9
|
SymbolSearchResult,
|
|
@@ -62,22 +63,37 @@ export class RoutingCodeNavigationProvider implements CodeNavigationProvider {
|
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
async definition(
|
|
66
|
+
async definition(
|
|
67
|
+
file: string,
|
|
68
|
+
line: number,
|
|
69
|
+
character: number,
|
|
70
|
+
options?: CodeNavigationRequestOptions,
|
|
71
|
+
): Promise<CodeNavigationResult> {
|
|
66
72
|
const routed = this.routeFor(file)
|
|
67
73
|
if ('reason' in routed) return { kind: 'unsupported', reason: routed.reason }
|
|
68
|
-
return await routed.provider.definition(file, line, character)
|
|
74
|
+
return await routed.provider.definition(file, line, character, options)
|
|
69
75
|
}
|
|
70
76
|
|
|
71
|
-
async references(
|
|
77
|
+
async references(
|
|
78
|
+
file: string,
|
|
79
|
+
line: number,
|
|
80
|
+
character: number,
|
|
81
|
+
options?: CodeNavigationRequestOptions,
|
|
82
|
+
): Promise<CodeNavigationResult> {
|
|
72
83
|
const routed = this.routeFor(file)
|
|
73
84
|
if ('reason' in routed) return { kind: 'unsupported', reason: routed.reason }
|
|
74
|
-
return await routed.provider.references(file, line, character)
|
|
85
|
+
return await routed.provider.references(file, line, character, options)
|
|
75
86
|
}
|
|
76
87
|
|
|
77
|
-
async hover(
|
|
88
|
+
async hover(
|
|
89
|
+
file: string,
|
|
90
|
+
line: number,
|
|
91
|
+
character: number,
|
|
92
|
+
options?: CodeNavigationRequestOptions,
|
|
93
|
+
): Promise<HoverResult> {
|
|
78
94
|
const routed = this.routeFor(file)
|
|
79
95
|
if ('reason' in routed) return { kind: 'unsupported', reason: routed.reason }
|
|
80
|
-
return await routed.provider.hover(file, line, character)
|
|
96
|
+
return await routed.provider.hover(file, line, character, options)
|
|
81
97
|
}
|
|
82
98
|
|
|
83
99
|
/**
|
|
@@ -88,11 +104,15 @@ export class RoutingCodeNavigationProvider implements CodeNavigationProvider {
|
|
|
88
104
|
* because "find this symbol" in a mixed repository means all of it and a
|
|
89
105
|
* caller who wanted one language would have said which.
|
|
90
106
|
*/
|
|
91
|
-
async symbols(
|
|
107
|
+
async symbols(
|
|
108
|
+
query: string,
|
|
109
|
+
scope?: string,
|
|
110
|
+
options?: CodeNavigationRequestOptions,
|
|
111
|
+
): Promise<SymbolSearchResult> {
|
|
92
112
|
if (scope) {
|
|
93
113
|
const routed = this.routeFor(scope)
|
|
94
114
|
if ('reason' in routed) return { kind: 'unsupported', reason: routed.reason }
|
|
95
|
-
return await routed.provider.symbols(query, scope)
|
|
115
|
+
return await routed.provider.symbols(query, scope, options)
|
|
96
116
|
}
|
|
97
117
|
|
|
98
118
|
const routes = [...new Set(this.byExtension.values())]
|
|
@@ -101,7 +121,7 @@ export class RoutingCodeNavigationProvider implements CodeNavigationProvider {
|
|
|
101
121
|
}
|
|
102
122
|
|
|
103
123
|
const answers = await Promise.all(
|
|
104
|
-
routes.map(async (route) => await this.providerFor(route).symbols(query)),
|
|
124
|
+
routes.map(async (route) => await this.providerFor(route).symbols(query, undefined, options)),
|
|
105
125
|
)
|
|
106
126
|
const found = answers.flatMap((a) => (a.kind === 'symbols' ? a.symbols : []))
|
|
107
127
|
if (found.length > 0) return { kind: 'symbols', symbols: found }
|
|
@@ -109,6 +129,13 @@ export class RoutingCodeNavigationProvider implements CodeNavigationProvider {
|
|
|
109
129
|
// Nothing found anywhere. If EVERY server refused, that is not an empty
|
|
110
130
|
// result — nobody looked. Reporting it as `symbols: []` would tell the
|
|
111
131
|
// caller the name does not exist in the repository.
|
|
132
|
+
//
|
|
133
|
+
// An interrupted search is the same claim from the other side: the
|
|
134
|
+
// caller stopped it, so no server got to finish looking. It is checked
|
|
135
|
+
// first because it names the reason the caller itself supplied, and a
|
|
136
|
+
// turn that was stopped should not be handed a transport failure.
|
|
137
|
+
const interrupted = answers.find((a) => a.kind === 'interrupted')
|
|
138
|
+
if (interrupted) return interrupted
|
|
112
139
|
const failure = answers.find((a) => a.kind === 'failed')
|
|
113
140
|
if (failure) return failure
|
|
114
141
|
const unsupported = answers.find((a) => a.kind === 'unsupported')
|
package/src/stdio.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { pathToFileURL } from 'node:url'
|
|
|
3
3
|
|
|
4
4
|
import type {
|
|
5
5
|
CodeNavigationProvider,
|
|
6
|
+
CodeNavigationRequestOptions,
|
|
6
7
|
CodeNavigationResult,
|
|
7
8
|
HoverResult,
|
|
8
9
|
SourceLocation,
|
|
@@ -29,6 +30,12 @@ import type {
|
|
|
29
30
|
* answer produces `{ kind: 'failed' }` naming the binary. Returning
|
|
30
31
|
* `{ kind: 'locations', locations: [] }` there tells an agent the symbol has
|
|
31
32
|
* no callers, and the agent then deletes it.
|
|
33
|
+
*
|
|
34
|
+
* **A caller that stops waiting is not a failure either.** The turn's signal
|
|
35
|
+
* travels with the request: aborting it drops that request, tells the server
|
|
36
|
+
* with `$/cancelRequest`, and answers `{ kind: 'interrupted' }`. Latching
|
|
37
|
+
* that as a terminal transport error would take navigation away for the
|
|
38
|
+
* rest of the session because somebody pressed Esc once.
|
|
32
39
|
*/
|
|
33
40
|
|
|
34
41
|
export interface StdioCodeNavigationOptions {
|
|
@@ -51,6 +58,28 @@ interface Pending {
|
|
|
51
58
|
resolve: (value: unknown) => void
|
|
52
59
|
reject: (error: Error) => void
|
|
53
60
|
timer: NodeJS.Timeout
|
|
61
|
+
/** The caller's signal, and the listener added to it, so both are released when the request settles. */
|
|
62
|
+
signal?: AbortSignal
|
|
63
|
+
onAbort?: () => void
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* A request the caller stopped waiting for.
|
|
68
|
+
*
|
|
69
|
+
* Its own error type, recognised by instance rather than by message text: an
|
|
70
|
+
* abort is a control-flow signal, and every caller has to answer it with the
|
|
71
|
+
* `interrupted` arm rather than with `failed`. Matching on wording instead
|
|
72
|
+
* would classify a server that happened to say "cancel" as an abort.
|
|
73
|
+
*/
|
|
74
|
+
class InterruptedError extends Error {
|
|
75
|
+
constructor(reason: string) {
|
|
76
|
+
super(reason)
|
|
77
|
+
this.name = 'AbortError'
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function interrupted(reason: string): InterruptedError {
|
|
82
|
+
return new InterruptedError(reason)
|
|
54
83
|
}
|
|
55
84
|
|
|
56
85
|
/** LSP's own position shape, before it becomes a {@link SourceLocation}. */
|
|
@@ -106,33 +135,59 @@ export class StdioCodeNavigationProvider implements CodeNavigationProvider {
|
|
|
106
135
|
|
|
107
136
|
constructor(private readonly options: StdioCodeNavigationOptions) {}
|
|
108
137
|
|
|
109
|
-
async definition(
|
|
110
|
-
|
|
138
|
+
async definition(
|
|
139
|
+
file: string,
|
|
140
|
+
line: number,
|
|
141
|
+
character: number,
|
|
142
|
+
options?: CodeNavigationRequestOptions,
|
|
143
|
+
): Promise<CodeNavigationResult> {
|
|
144
|
+
return await this.navigate('textDocument/definition', file, line, character, {}, options)
|
|
111
145
|
}
|
|
112
146
|
|
|
113
|
-
async references(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
147
|
+
async references(
|
|
148
|
+
file: string,
|
|
149
|
+
line: number,
|
|
150
|
+
character: number,
|
|
151
|
+
options?: CodeNavigationRequestOptions,
|
|
152
|
+
): Promise<CodeNavigationResult> {
|
|
153
|
+
return await this.navigate(
|
|
154
|
+
'textDocument/references',
|
|
155
|
+
file,
|
|
156
|
+
line,
|
|
157
|
+
character,
|
|
158
|
+
{
|
|
159
|
+
// The declaration itself is not a "use". An agent asking who calls
|
|
160
|
+
// this wants the call sites; including the declaration inflates the
|
|
161
|
+
// count by one and reads as a caller that does not exist.
|
|
162
|
+
context: { includeDeclaration: false },
|
|
163
|
+
},
|
|
164
|
+
options,
|
|
165
|
+
)
|
|
120
166
|
}
|
|
121
167
|
|
|
122
|
-
async hover(
|
|
168
|
+
async hover(
|
|
169
|
+
file: string,
|
|
170
|
+
line: number,
|
|
171
|
+
character: number,
|
|
172
|
+
options?: CodeNavigationRequestOptions,
|
|
173
|
+
): Promise<HoverResult> {
|
|
123
174
|
try {
|
|
124
|
-
await this.
|
|
175
|
+
await this.ready(options)
|
|
125
176
|
} catch (err) {
|
|
126
|
-
return
|
|
177
|
+
return toStartFailure(err)
|
|
127
178
|
}
|
|
128
179
|
if (this.capabilities.hoverProvider === false) {
|
|
129
180
|
return { kind: 'unsupported', reason: `${this.options.command} declares no hoverProvider.` }
|
|
130
181
|
}
|
|
131
182
|
try {
|
|
132
|
-
const result = await this.request(
|
|
133
|
-
textDocument
|
|
134
|
-
|
|
135
|
-
|
|
183
|
+
const result = await this.request(
|
|
184
|
+
'textDocument/hover',
|
|
185
|
+
{
|
|
186
|
+
textDocument: { uri: pathToFileURL(file).href },
|
|
187
|
+
position: { line, character },
|
|
188
|
+
},
|
|
189
|
+
options?.signal,
|
|
190
|
+
)
|
|
136
191
|
// EMPTY, not failed. Hovering over whitespace or a comment resolves
|
|
137
192
|
// to nothing, and a caller has to be able to tell that from a server
|
|
138
193
|
// that broke — the same distinction `locations: []` carries.
|
|
@@ -142,11 +197,15 @@ export class StdioCodeNavigationProvider implements CodeNavigationProvider {
|
|
|
142
197
|
}
|
|
143
198
|
}
|
|
144
199
|
|
|
145
|
-
async symbols(
|
|
200
|
+
async symbols(
|
|
201
|
+
query: string,
|
|
202
|
+
_scope?: string,
|
|
203
|
+
options?: CodeNavigationRequestOptions,
|
|
204
|
+
): Promise<SymbolSearchResult> {
|
|
146
205
|
try {
|
|
147
|
-
await this.
|
|
206
|
+
await this.ready(options)
|
|
148
207
|
} catch (err) {
|
|
149
|
-
return
|
|
208
|
+
return toStartFailure(err)
|
|
150
209
|
}
|
|
151
210
|
|
|
152
211
|
// The DECLARED capability decides which request goes out. A server
|
|
@@ -155,7 +214,7 @@ export class StdioCodeNavigationProvider implements CodeNavigationProvider {
|
|
|
155
214
|
// told so rather than asked and silently mishandled.
|
|
156
215
|
if (this.capabilities.workspaceSymbolProvider) {
|
|
157
216
|
try {
|
|
158
|
-
const result = await this.request('workspace/symbol', { query })
|
|
217
|
+
const result = await this.request('workspace/symbol', { query }, options?.signal)
|
|
159
218
|
return { kind: 'symbols', symbols: toSymbols(result) }
|
|
160
219
|
} catch (err) {
|
|
161
220
|
return toFailure(err, this.options.command, 'workspace/symbol')
|
|
@@ -169,9 +228,11 @@ export class StdioCodeNavigationProvider implements CodeNavigationProvider {
|
|
|
169
228
|
}
|
|
170
229
|
}
|
|
171
230
|
try {
|
|
172
|
-
const result = await this.request(
|
|
173
|
-
textDocument
|
|
174
|
-
|
|
231
|
+
const result = await this.request(
|
|
232
|
+
'textDocument/documentSymbol',
|
|
233
|
+
{ textDocument: { uri: pathToFileURL(_scope).href } },
|
|
234
|
+
options?.signal,
|
|
235
|
+
)
|
|
175
236
|
return {
|
|
176
237
|
kind: 'symbols',
|
|
177
238
|
symbols: toSymbols(result, _scope).filter((s) => s.name.includes(query)),
|
|
@@ -192,19 +253,24 @@ export class StdioCodeNavigationProvider implements CodeNavigationProvider {
|
|
|
192
253
|
line: number,
|
|
193
254
|
character: number,
|
|
194
255
|
extra: Record<string, unknown>,
|
|
256
|
+
options?: CodeNavigationRequestOptions,
|
|
195
257
|
): Promise<CodeNavigationResult> {
|
|
196
258
|
try {
|
|
197
|
-
await this.
|
|
259
|
+
await this.ready(options)
|
|
198
260
|
} catch (err) {
|
|
199
|
-
return
|
|
261
|
+
return toStartFailure(err)
|
|
200
262
|
}
|
|
201
263
|
|
|
202
264
|
try {
|
|
203
|
-
const result = await this.request(
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
265
|
+
const result = await this.request(
|
|
266
|
+
method,
|
|
267
|
+
{
|
|
268
|
+
textDocument: { uri: pathToFileURL(file).href },
|
|
269
|
+
position: { line, character },
|
|
270
|
+
...extra,
|
|
271
|
+
},
|
|
272
|
+
options?.signal,
|
|
273
|
+
)
|
|
208
274
|
if (result === null || result === undefined) {
|
|
209
275
|
// A server that answered `null` looked and found nothing. That is
|
|
210
276
|
// an empty location list, not a failure — and saying so is what
|
|
@@ -219,20 +285,53 @@ export class StdioCodeNavigationProvider implements CodeNavigationProvider {
|
|
|
219
285
|
.map(toSourceLocation),
|
|
220
286
|
}
|
|
221
287
|
} catch (err) {
|
|
222
|
-
|
|
223
|
-
// A method the server does not implement is `unsupported`, not
|
|
224
|
-
// `failed`: a caller can fall back to grep and say why, where a
|
|
225
|
-
// failure means the answer is unknown.
|
|
226
|
-
if (/method not found|-32601/i.test(message)) {
|
|
227
|
-
return {
|
|
228
|
-
kind: 'unsupported',
|
|
229
|
-
reason: `${this.options.command} does not implement ${method}.`,
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
return { kind: 'failed', error: message }
|
|
288
|
+
return toFailure(err, this.options.command, method)
|
|
233
289
|
}
|
|
234
290
|
}
|
|
235
291
|
|
|
292
|
+
/**
|
|
293
|
+
* Wait for the handshake, but never past the caller's signal.
|
|
294
|
+
*
|
|
295
|
+
* The start is SHARED — one process, one `initialize` — so one caller's
|
|
296
|
+
* abort must not fail it for everyone else: it stops that caller waiting
|
|
297
|
+
* and leaves the handshake alone, bounded by the startup timeout that was
|
|
298
|
+
* already running. The rejection of the shared promise is observed here so
|
|
299
|
+
* an abort that outlives its caller is not an unhandled rejection.
|
|
300
|
+
*/
|
|
301
|
+
private async ready(options?: CodeNavigationRequestOptions): Promise<void> {
|
|
302
|
+
const signal = options?.signal
|
|
303
|
+
// Checked BEFORE the start is begun: a stopped turn must not spawn a
|
|
304
|
+
// language server it has no question left to ask.
|
|
305
|
+
if (signal?.aborted) {
|
|
306
|
+
throw interrupted(
|
|
307
|
+
`The call was cancelled before the language server "${this.options.command}" was asked.`,
|
|
308
|
+
)
|
|
309
|
+
}
|
|
310
|
+
const starting = this.start()
|
|
311
|
+
if (!signal) return await starting
|
|
312
|
+
|
|
313
|
+
starting.catch(() => {})
|
|
314
|
+
await new Promise<void>((resolve, reject) => {
|
|
315
|
+
const onAbort = () =>
|
|
316
|
+
reject(
|
|
317
|
+
interrupted(
|
|
318
|
+
`The call was cancelled while the language server "${this.options.command}" was starting.`,
|
|
319
|
+
),
|
|
320
|
+
)
|
|
321
|
+
signal.addEventListener('abort', onAbort, { once: true })
|
|
322
|
+
starting.then(
|
|
323
|
+
() => {
|
|
324
|
+
signal.removeEventListener('abort', onAbort)
|
|
325
|
+
resolve()
|
|
326
|
+
},
|
|
327
|
+
(err: unknown) => {
|
|
328
|
+
signal.removeEventListener('abort', onAbort)
|
|
329
|
+
reject(err)
|
|
330
|
+
},
|
|
331
|
+
)
|
|
332
|
+
})
|
|
333
|
+
}
|
|
334
|
+
|
|
236
335
|
/** Spawn and handshake, once, and remember a failure so it is not retried per call. */
|
|
237
336
|
private start(): Promise<void> {
|
|
238
337
|
if (this.disposed)
|
|
@@ -297,7 +396,11 @@ export class StdioCodeNavigationProvider implements CodeNavigationProvider {
|
|
|
297
396
|
return this.starting
|
|
298
397
|
}
|
|
299
398
|
|
|
300
|
-
private request(
|
|
399
|
+
private request(
|
|
400
|
+
method: string,
|
|
401
|
+
params: Record<string, unknown>,
|
|
402
|
+
signal?: AbortSignal,
|
|
403
|
+
): Promise<unknown> {
|
|
301
404
|
if (this.disposed)
|
|
302
405
|
return Promise.reject(new Error('This code navigation provider is disposed.'))
|
|
303
406
|
if (this.terminalError) return Promise.reject(new Error(this.terminalError))
|
|
@@ -306,16 +409,54 @@ export class StdioCodeNavigationProvider implements CodeNavigationProvider {
|
|
|
306
409
|
new Error(`The language server "${this.options.command}" is not running.`),
|
|
307
410
|
)
|
|
308
411
|
}
|
|
412
|
+
if (signal?.aborted) {
|
|
413
|
+
// Nothing was sent, so there is nothing to answer and nothing to
|
|
414
|
+
// cancel: the server is not told about a request it never received.
|
|
415
|
+
return Promise.reject(
|
|
416
|
+
interrupted(
|
|
417
|
+
`The call was cancelled before the language server "${this.options.command}" was asked for ${method}.`,
|
|
418
|
+
),
|
|
419
|
+
)
|
|
420
|
+
}
|
|
309
421
|
this.seq += 1
|
|
310
422
|
const id = this.seq
|
|
311
423
|
const timeoutMs = this.options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS
|
|
312
424
|
return new Promise<unknown>((resolve, reject) => {
|
|
313
425
|
const timer = setTimeout(() => {
|
|
314
|
-
this.
|
|
426
|
+
this.forget(id)
|
|
315
427
|
reject(new Error(`The language server did not answer ${method} within ${timeoutMs}ms.`))
|
|
316
428
|
}, timeoutMs)
|
|
317
429
|
timer.unref?.()
|
|
318
|
-
|
|
430
|
+
const onAbort = signal
|
|
431
|
+
? () => {
|
|
432
|
+
// Only the caller stops waiting. The transport is fine, so the
|
|
433
|
+
// server stays up for the next call — this is not a `failed`
|
|
434
|
+
// transport, and latching it as one would kill navigation for a
|
|
435
|
+
// turn that pressed Esc.
|
|
436
|
+
this.forget(id)
|
|
437
|
+
// A server grinding through a slow index otherwise keeps
|
|
438
|
+
// answering a question nobody is waiting for. Its answer, if it
|
|
439
|
+
// sends one, finds no waiter and is dropped by `deliver`.
|
|
440
|
+
try {
|
|
441
|
+
this.notify('$/cancelRequest', { id })
|
|
442
|
+
} catch {
|
|
443
|
+
// The pipe is gone. The transport listeners retire it.
|
|
444
|
+
}
|
|
445
|
+
reject(
|
|
446
|
+
interrupted(
|
|
447
|
+
`The call was cancelled before the language server "${this.options.command}" answered ${method}.`,
|
|
448
|
+
),
|
|
449
|
+
)
|
|
450
|
+
}
|
|
451
|
+
: undefined
|
|
452
|
+
if (signal && onAbort) signal.addEventListener('abort', onAbort, { once: true })
|
|
453
|
+
this.pending.set(id, {
|
|
454
|
+
resolve,
|
|
455
|
+
reject,
|
|
456
|
+
timer,
|
|
457
|
+
...(signal ? { signal } : {}),
|
|
458
|
+
...(onAbort ? { onAbort } : {}),
|
|
459
|
+
})
|
|
319
460
|
try {
|
|
320
461
|
this.write({ jsonrpc: '2.0', id, method, params })
|
|
321
462
|
} catch (err) {
|
|
@@ -324,6 +465,17 @@ export class StdioCodeNavigationProvider implements CodeNavigationProvider {
|
|
|
324
465
|
})
|
|
325
466
|
}
|
|
326
467
|
|
|
468
|
+
/** Drop a request from the table, releasing its timer and abort listener. */
|
|
469
|
+
private forget(id: number): Pending | undefined {
|
|
470
|
+
const waiting = this.pending.get(id)
|
|
471
|
+
if (!waiting) return undefined
|
|
472
|
+
this.pending.delete(id)
|
|
473
|
+
clearTimeout(waiting.timer)
|
|
474
|
+
if (waiting.signal && waiting.onAbort)
|
|
475
|
+
waiting.signal.removeEventListener('abort', waiting.onAbort)
|
|
476
|
+
return waiting
|
|
477
|
+
}
|
|
478
|
+
|
|
327
479
|
private notify(method: string, params: Record<string, unknown>): void {
|
|
328
480
|
this.write({ jsonrpc: '2.0', method, params })
|
|
329
481
|
}
|
|
@@ -402,11 +554,9 @@ export class StdioCodeNavigationProvider implements CodeNavigationProvider {
|
|
|
402
554
|
private retireTransport(error: Error): void {
|
|
403
555
|
if (this.disposed) return
|
|
404
556
|
this.terminalError ??= error.message
|
|
405
|
-
for (const
|
|
406
|
-
|
|
407
|
-
waiting.reject(new Error(this.terminalError))
|
|
557
|
+
for (const id of [...this.pending.keys()]) {
|
|
558
|
+
this.forget(id)?.reject(new Error(this.terminalError))
|
|
408
559
|
}
|
|
409
|
-
this.pending.clear()
|
|
410
560
|
}
|
|
411
561
|
|
|
412
562
|
/**
|
|
@@ -451,10 +601,8 @@ export class StdioCodeNavigationProvider implements CodeNavigationProvider {
|
|
|
451
601
|
return
|
|
452
602
|
}
|
|
453
603
|
if (message.id === undefined) return
|
|
454
|
-
const waiting = this.
|
|
604
|
+
const waiting = this.forget(message.id)
|
|
455
605
|
if (!waiting) return
|
|
456
|
-
this.pending.delete(message.id)
|
|
457
|
-
clearTimeout(waiting.timer)
|
|
458
606
|
if (message.error) {
|
|
459
607
|
waiting.reject(new Error(message.error.message ?? `error ${message.error.code ?? 'unknown'}`))
|
|
460
608
|
} else {
|
|
@@ -467,11 +615,9 @@ export class StdioCodeNavigationProvider implements CodeNavigationProvider {
|
|
|
467
615
|
this.disposed = true
|
|
468
616
|
const child = this.child
|
|
469
617
|
this.child = undefined
|
|
470
|
-
for (const
|
|
471
|
-
|
|
472
|
-
waiting.reject(new Error('The code navigation provider was disposed.'))
|
|
618
|
+
for (const id of [...this.pending.keys()]) {
|
|
619
|
+
this.forget(id)?.reject(new Error('The code navigation provider was disposed.'))
|
|
473
620
|
}
|
|
474
|
-
this.pending.clear()
|
|
475
621
|
if (!child) return
|
|
476
622
|
|
|
477
623
|
// The handshake FIRST, so a server with unsaved index state gets to
|
|
@@ -531,7 +677,14 @@ function toFailure(
|
|
|
531
677
|
err: unknown,
|
|
532
678
|
command: string,
|
|
533
679
|
method: string,
|
|
534
|
-
):
|
|
680
|
+
):
|
|
681
|
+
| { kind: 'unsupported'; reason: string }
|
|
682
|
+
| { kind: 'failed'; error: string }
|
|
683
|
+
| { kind: 'interrupted'; reason: string } {
|
|
684
|
+
// FIRST, before any wording is read: an abort is not a statement about the
|
|
685
|
+
// server, and a server whose error happened to mention cancelling must not
|
|
686
|
+
// be classified as an abort.
|
|
687
|
+
if (err instanceof InterruptedError) return { kind: 'interrupted', reason: err.message }
|
|
535
688
|
const message = err instanceof Error ? err.message : String(err)
|
|
536
689
|
// A method the server does not implement is `unsupported`, not `failed`:
|
|
537
690
|
// a caller can fall back and say why the answer is approximate, where a
|
|
@@ -542,6 +695,14 @@ function toFailure(
|
|
|
542
695
|
return { kind: 'failed', error: message }
|
|
543
696
|
}
|
|
544
697
|
|
|
698
|
+
/** The same split for a handshake that was cancelled before a method was even named. */
|
|
699
|
+
function toStartFailure(
|
|
700
|
+
err: unknown,
|
|
701
|
+
): { kind: 'failed'; error: string } | { kind: 'interrupted'; reason: string } {
|
|
702
|
+
if (err instanceof InterruptedError) return { kind: 'interrupted', reason: err.message }
|
|
703
|
+
return { kind: 'failed', error: err instanceof Error ? err.message : String(err) }
|
|
704
|
+
}
|
|
705
|
+
|
|
545
706
|
/**
|
|
546
707
|
* The wire's several hover shapes, as one string.
|
|
547
708
|
*
|