@namzu/lsp 0.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/CHANGELOG.md +49 -0
- package/LICENSE.md +110 -0
- package/README.md +299 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/routing.d.ts +60 -0
- package/dist/routing.d.ts.map +1 -0
- package/dist/routing.js +97 -0
- package/dist/routing.js.map +1 -0
- package/dist/stdio.d.ts +76 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +437 -0
- package/dist/stdio.js.map +1 -0
- package/dist/types.d.ts +28 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +19 -0
- package/dist/types.js.map +1 -0
- package/package.json +65 -0
- package/src/index.ts +12 -0
- package/src/routing.ts +147 -0
- package/src/stdio.ts +534 -0
- package/src/types.ts +35 -0
package/dist/stdio.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { CodeNavigationProvider, CodeNavigationResult, HoverResult, SymbolSearchResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* One language server, over its stdin and stdout.
|
|
4
|
+
*
|
|
5
|
+
* Stdio rather than a socket for the reason every stdio transport in this
|
|
6
|
+
* repository gives: the client spawns the server, so there is no port, no
|
|
7
|
+
* bind address, and no inbound authentication question to get wrong. The
|
|
8
|
+
* boundary is the process.
|
|
9
|
+
*
|
|
10
|
+
* **The framing is not JSON lines.** This wire prefixes each message with a
|
|
11
|
+
* `Content-Length` header and a blank line, so a reader that split on `\n`
|
|
12
|
+
* would tear a message whose body contains one — which every response
|
|
13
|
+
* carrying source text does.
|
|
14
|
+
*
|
|
15
|
+
* **A server that never initializes is a FAILURE, not an empty answer.**
|
|
16
|
+
* The bounded startup timeout exists so a missing binary, a server that
|
|
17
|
+
* crashes on a malformed workspace, or one waiting on a prompt nobody will
|
|
18
|
+
* answer produces `{ kind: 'failed' }` naming the binary. Returning
|
|
19
|
+
* `{ kind: 'locations', locations: [] }` there tells an agent the symbol has
|
|
20
|
+
* no callers, and the agent then deletes it.
|
|
21
|
+
*/
|
|
22
|
+
export interface StdioCodeNavigationOptions {
|
|
23
|
+
/** The server binary. */
|
|
24
|
+
readonly command: string;
|
|
25
|
+
readonly args?: readonly string[];
|
|
26
|
+
/** Workspace root the server indexes. */
|
|
27
|
+
readonly rootDir: string;
|
|
28
|
+
/** How long `initialize` may take. */
|
|
29
|
+
readonly startupTimeoutMs?: number;
|
|
30
|
+
/** How long any one request may take. */
|
|
31
|
+
readonly requestTimeoutMs?: number;
|
|
32
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
33
|
+
}
|
|
34
|
+
export declare class StdioCodeNavigationProvider implements CodeNavigationProvider {
|
|
35
|
+
private readonly options;
|
|
36
|
+
private child;
|
|
37
|
+
private buffer;
|
|
38
|
+
private seq;
|
|
39
|
+
private readonly pending;
|
|
40
|
+
private starting;
|
|
41
|
+
/**
|
|
42
|
+
* What the server said it can do, read from the initialize RESULT.
|
|
43
|
+
*
|
|
44
|
+
* Read rather than probed. Sending `workspace/symbol` to a server that
|
|
45
|
+
* does not implement it and swallowing the error works until a server
|
|
46
|
+
* answers a different error for a different reason — a transient one, a
|
|
47
|
+
* malformed query — and the fallback then fires for a capability the
|
|
48
|
+
* server has. The handshake already carries the answer.
|
|
49
|
+
*/
|
|
50
|
+
private capabilities;
|
|
51
|
+
private startupError;
|
|
52
|
+
private disposed;
|
|
53
|
+
constructor(options: StdioCodeNavigationOptions);
|
|
54
|
+
definition(file: string, line: number, character: number): Promise<CodeNavigationResult>;
|
|
55
|
+
references(file: string, line: number, character: number): Promise<CodeNavigationResult>;
|
|
56
|
+
hover(file: string, line: number, character: number): Promise<HoverResult>;
|
|
57
|
+
symbols(query: string, _scope?: string): Promise<SymbolSearchResult>;
|
|
58
|
+
private navigate;
|
|
59
|
+
/** Spawn and handshake, once, and remember a failure so it is not retried per call. */
|
|
60
|
+
private start;
|
|
61
|
+
private request;
|
|
62
|
+
private notify;
|
|
63
|
+
private write;
|
|
64
|
+
/**
|
|
65
|
+
* Read the framed stream.
|
|
66
|
+
*
|
|
67
|
+
* Byte lengths, not characters: `Content-Length` counts bytes, and a
|
|
68
|
+
* response carrying a non-ASCII identifier has more bytes than
|
|
69
|
+
* characters. Slicing a string by that number cuts the message short and
|
|
70
|
+
* leaves the parser permanently out of step.
|
|
71
|
+
*/
|
|
72
|
+
private consume;
|
|
73
|
+
private deliver;
|
|
74
|
+
dispose(): Promise<void>;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=stdio.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;GAmBG;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;IAClC,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAC/C;AAoCD,qBAAa,2BAA4B,YAAW,sBAAsB;IAmB7D,OAAO,CAAC,QAAQ,CAAC,OAAO;IAlBpC,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,GAAG,CAAI;IACf,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IACrD,OAAO,CAAC,QAAQ,CAA2B;IAC3C;;;;;;;;OAQG;IACH,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,YAAY,CAAoB;IACxC,OAAO,CAAC,QAAQ,CAAQ;gBAEK,OAAO,EAAE,0BAA0B;IAE1D,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAIxF,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IASxF,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAuB1E,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;YA4C5D,QAAQ;IA+CtB,uFAAuF;IACvF,OAAO,CAAC,KAAK;IAsFb,OAAO,CAAC,OAAO;IAef,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,KAAK;IAMb;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO;IAuBf,OAAO,CAAC,OAAO;IAsBT,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAyC9B"}
|
package/dist/stdio.js
ADDED
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
3
|
+
const DEFAULT_STARTUP_TIMEOUT_MS = 15_000;
|
|
4
|
+
const DEFAULT_REQUEST_TIMEOUT_MS = 20_000;
|
|
5
|
+
function toSourceLocation(location) {
|
|
6
|
+
// `file://` off, so a caller gets a path it can hand to `readFile`. The
|
|
7
|
+
// wire speaks URIs because a server may serve untitled buffers; every
|
|
8
|
+
// path this provider is asked about is a real file.
|
|
9
|
+
const path = location.uri.startsWith('file://')
|
|
10
|
+
? decodeURIComponent(new URL(location.uri).pathname)
|
|
11
|
+
: location.uri;
|
|
12
|
+
const end = location.range.end;
|
|
13
|
+
return {
|
|
14
|
+
path,
|
|
15
|
+
line: location.range.start.line,
|
|
16
|
+
character: location.range.start.character,
|
|
17
|
+
...(end ? { endLine: end.line, endCharacter: end.character } : {}),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export class StdioCodeNavigationProvider {
|
|
21
|
+
options;
|
|
22
|
+
child;
|
|
23
|
+
buffer = Buffer.alloc(0);
|
|
24
|
+
seq = 0;
|
|
25
|
+
pending = new Map();
|
|
26
|
+
starting;
|
|
27
|
+
/**
|
|
28
|
+
* What the server said it can do, read from the initialize RESULT.
|
|
29
|
+
*
|
|
30
|
+
* Read rather than probed. Sending `workspace/symbol` to a server that
|
|
31
|
+
* does not implement it and swallowing the error works until a server
|
|
32
|
+
* answers a different error for a different reason — a transient one, a
|
|
33
|
+
* malformed query — and the fallback then fires for a capability the
|
|
34
|
+
* server has. The handshake already carries the answer.
|
|
35
|
+
*/
|
|
36
|
+
capabilities = {};
|
|
37
|
+
startupError;
|
|
38
|
+
disposed = false;
|
|
39
|
+
constructor(options) {
|
|
40
|
+
this.options = options;
|
|
41
|
+
}
|
|
42
|
+
async definition(file, line, character) {
|
|
43
|
+
return await this.navigate('textDocument/definition', file, line, character, {});
|
|
44
|
+
}
|
|
45
|
+
async references(file, line, character) {
|
|
46
|
+
return await this.navigate('textDocument/references', file, line, character, {
|
|
47
|
+
// The declaration itself is not a "use". An agent asking who calls
|
|
48
|
+
// this wants the call sites; including the declaration inflates the
|
|
49
|
+
// count by one and reads as a caller that does not exist.
|
|
50
|
+
context: { includeDeclaration: false },
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
async hover(file, line, character) {
|
|
54
|
+
try {
|
|
55
|
+
await this.start();
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
return { kind: 'failed', error: err instanceof Error ? err.message : String(err) };
|
|
59
|
+
}
|
|
60
|
+
if (this.capabilities.hoverProvider === false) {
|
|
61
|
+
return { kind: 'unsupported', reason: `${this.options.command} declares no hoverProvider.` };
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
const result = await this.request('textDocument/hover', {
|
|
65
|
+
textDocument: { uri: pathToFileURL(file).href },
|
|
66
|
+
position: { line, character },
|
|
67
|
+
});
|
|
68
|
+
// EMPTY, not failed. Hovering over whitespace or a comment resolves
|
|
69
|
+
// to nothing, and a caller has to be able to tell that from a server
|
|
70
|
+
// that broke — the same distinction `locations: []` carries.
|
|
71
|
+
return { kind: 'hover', contents: hoverText(result) };
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
return toFailure(err, `${this.options.command}`, 'textDocument/hover');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async symbols(query, _scope) {
|
|
78
|
+
try {
|
|
79
|
+
await this.start();
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
return { kind: 'failed', error: err instanceof Error ? err.message : String(err) };
|
|
83
|
+
}
|
|
84
|
+
// The DECLARED capability decides which request goes out. A server
|
|
85
|
+
// with a workspace index answers the whole repository; one with only
|
|
86
|
+
// document symbols answers the file it is given; one with neither is
|
|
87
|
+
// told so rather than asked and silently mishandled.
|
|
88
|
+
if (this.capabilities.workspaceSymbolProvider) {
|
|
89
|
+
try {
|
|
90
|
+
const result = await this.request('workspace/symbol', { query });
|
|
91
|
+
return { kind: 'symbols', symbols: toSymbols(result) };
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
return toFailure(err, this.options.command, 'workspace/symbol');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (this.capabilities.documentSymbolProvider) {
|
|
98
|
+
if (!_scope) {
|
|
99
|
+
return {
|
|
100
|
+
kind: 'unsupported',
|
|
101
|
+
reason: `${this.options.command} has no workspace symbol index, so a symbol search needs a file to look in. Pass a scope.`,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
const result = await this.request('textDocument/documentSymbol', {
|
|
106
|
+
textDocument: { uri: pathToFileURL(_scope).href },
|
|
107
|
+
});
|
|
108
|
+
return {
|
|
109
|
+
kind: 'symbols',
|
|
110
|
+
symbols: toSymbols(result, _scope).filter((s) => s.name.includes(query)),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
return toFailure(err, this.options.command, 'textDocument/documentSymbol');
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
kind: 'unsupported',
|
|
119
|
+
reason: `${this.options.command} declares neither workspaceSymbolProvider nor documentSymbolProvider, so it cannot find a symbol by name.`,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async navigate(method, file, line, character, extra) {
|
|
123
|
+
try {
|
|
124
|
+
await this.start();
|
|
125
|
+
}
|
|
126
|
+
catch (err) {
|
|
127
|
+
return { kind: 'failed', error: err instanceof Error ? err.message : String(err) };
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
const result = await this.request(method, {
|
|
131
|
+
textDocument: { uri: pathToFileURL(file).href },
|
|
132
|
+
position: { line, character },
|
|
133
|
+
...extra,
|
|
134
|
+
});
|
|
135
|
+
if (result === null || result === undefined) {
|
|
136
|
+
// A server that answered `null` looked and found nothing. That is
|
|
137
|
+
// an empty location list, not a failure — and saying so is what
|
|
138
|
+
// lets a caller tell it apart from a server that never started.
|
|
139
|
+
return { kind: 'locations', locations: [] };
|
|
140
|
+
}
|
|
141
|
+
const raw = Array.isArray(result) ? result : [result];
|
|
142
|
+
return {
|
|
143
|
+
kind: 'locations',
|
|
144
|
+
locations: raw
|
|
145
|
+
.filter((entry) => isLocation(entry))
|
|
146
|
+
.map(toSourceLocation),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
151
|
+
// A method the server does not implement is `unsupported`, not
|
|
152
|
+
// `failed`: a caller can fall back to grep and say why, where a
|
|
153
|
+
// failure means the answer is unknown.
|
|
154
|
+
if (/method not found|-32601/i.test(message)) {
|
|
155
|
+
return {
|
|
156
|
+
kind: 'unsupported',
|
|
157
|
+
reason: `${this.options.command} does not implement ${method}.`,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return { kind: 'failed', error: message };
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/** Spawn and handshake, once, and remember a failure so it is not retried per call. */
|
|
164
|
+
start() {
|
|
165
|
+
if (this.disposed)
|
|
166
|
+
return Promise.reject(new Error('This code navigation provider is disposed.'));
|
|
167
|
+
if (this.startupError)
|
|
168
|
+
return Promise.reject(new Error(this.startupError));
|
|
169
|
+
if (this.starting)
|
|
170
|
+
return this.starting;
|
|
171
|
+
this.starting = (async () => {
|
|
172
|
+
let child;
|
|
173
|
+
try {
|
|
174
|
+
child = spawn(this.options.command, [...(this.options.args ?? [])], {
|
|
175
|
+
cwd: this.options.rootDir,
|
|
176
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
177
|
+
...(this.options.env ? { env: { ...process.env, ...this.options.env } } : {}),
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
catch (err) {
|
|
181
|
+
throw new Error(`Could not start the language server "${this.options.command}": ${err instanceof Error ? err.message : String(err)}`);
|
|
182
|
+
}
|
|
183
|
+
this.child = child;
|
|
184
|
+
// A spawn failure arrives asynchronously on some platforms, so the
|
|
185
|
+
// error event has to be able to reject the handshake below rather
|
|
186
|
+
// than surface as an unhandled error on a child nobody is watching.
|
|
187
|
+
const spawnFailure = new Promise((_resolve, reject) => {
|
|
188
|
+
child.once('error', (err) => reject(new Error(`Could not start the language server "${this.options.command}": ${err.message}`)));
|
|
189
|
+
child.once('exit', (code) => reject(new Error(`The language server "${this.options.command}" exited with code ${code} before it initialized.`)));
|
|
190
|
+
});
|
|
191
|
+
// Not unhandled: the race below may settle on the other branch, and
|
|
192
|
+
// an unobserved rejection would take the process down.
|
|
193
|
+
spawnFailure.catch(() => { });
|
|
194
|
+
child.stdout?.on('data', (chunk) => this.consume(chunk));
|
|
195
|
+
const startupMs = this.options.startupTimeoutMs ?? DEFAULT_STARTUP_TIMEOUT_MS;
|
|
196
|
+
const timeout = new Promise((_resolve, reject) => {
|
|
197
|
+
const timer = setTimeout(() => reject(new Error(`The language server "${this.options.command}" did not answer initialize within ${startupMs}ms. Refusing rather than answering navigation queries with an empty result.`)), startupMs);
|
|
198
|
+
timer.unref?.();
|
|
199
|
+
});
|
|
200
|
+
const initialized = await Promise.race([
|
|
201
|
+
this.request('initialize', {
|
|
202
|
+
processId: process.pid,
|
|
203
|
+
rootUri: pathToFileURL(this.options.rootDir).href,
|
|
204
|
+
workspaceFolders: [{ uri: pathToFileURL(this.options.rootDir).href, name: 'workspace' }],
|
|
205
|
+
capabilities: {},
|
|
206
|
+
}),
|
|
207
|
+
spawnFailure,
|
|
208
|
+
timeout,
|
|
209
|
+
]);
|
|
210
|
+
// Stored from the initialize RESULT, which is the only place a
|
|
211
|
+
// server states what it can do. Everything downstream reads this
|
|
212
|
+
// instead of sending a request and interpreting the error.
|
|
213
|
+
this.capabilities =
|
|
214
|
+
initialized?.capabilities ?? {};
|
|
215
|
+
this.notify('initialized', {});
|
|
216
|
+
})().catch((err) => {
|
|
217
|
+
// Remembered, so a run that asks twenty times does not spawn twenty
|
|
218
|
+
// servers against a binary that is not there.
|
|
219
|
+
this.startupError = err instanceof Error ? err.message : String(err);
|
|
220
|
+
throw err;
|
|
221
|
+
});
|
|
222
|
+
return this.starting;
|
|
223
|
+
}
|
|
224
|
+
request(method, params) {
|
|
225
|
+
this.seq += 1;
|
|
226
|
+
const id = this.seq;
|
|
227
|
+
const timeoutMs = this.options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
228
|
+
return new Promise((resolve, reject) => {
|
|
229
|
+
const timer = setTimeout(() => {
|
|
230
|
+
this.pending.delete(id);
|
|
231
|
+
reject(new Error(`The language server did not answer ${method} within ${timeoutMs}ms.`));
|
|
232
|
+
}, timeoutMs);
|
|
233
|
+
timer.unref?.();
|
|
234
|
+
this.pending.set(id, { resolve, reject, timer });
|
|
235
|
+
this.write({ jsonrpc: '2.0', id, method, params });
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
notify(method, params) {
|
|
239
|
+
this.write({ jsonrpc: '2.0', method, params });
|
|
240
|
+
}
|
|
241
|
+
write(message) {
|
|
242
|
+
const body = Buffer.from(JSON.stringify(message), 'utf-8');
|
|
243
|
+
this.child?.stdin?.write(`Content-Length: ${body.length}\r\n\r\n`);
|
|
244
|
+
this.child?.stdin?.write(body);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Read the framed stream.
|
|
248
|
+
*
|
|
249
|
+
* Byte lengths, not characters: `Content-Length` counts bytes, and a
|
|
250
|
+
* response carrying a non-ASCII identifier has more bytes than
|
|
251
|
+
* characters. Slicing a string by that number cuts the message short and
|
|
252
|
+
* leaves the parser permanently out of step.
|
|
253
|
+
*/
|
|
254
|
+
consume(chunk) {
|
|
255
|
+
this.buffer = Buffer.concat([this.buffer, chunk]);
|
|
256
|
+
for (;;) {
|
|
257
|
+
const headerEnd = this.buffer.indexOf('\r\n\r\n');
|
|
258
|
+
if (headerEnd === -1)
|
|
259
|
+
return;
|
|
260
|
+
const header = this.buffer.subarray(0, headerEnd).toString('utf-8');
|
|
261
|
+
const match = /content-length:\s*(\d+)/i.exec(header);
|
|
262
|
+
if (!match) {
|
|
263
|
+
// A frame with no length is unrecoverable — there is no way to know
|
|
264
|
+
// where it ends. Drop the header and resynchronise rather than
|
|
265
|
+
// spinning on the same bytes forever.
|
|
266
|
+
this.buffer = this.buffer.subarray(headerEnd + 4);
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
const length = Number(match[1]);
|
|
270
|
+
const start = headerEnd + 4;
|
|
271
|
+
if (this.buffer.length < start + length)
|
|
272
|
+
return;
|
|
273
|
+
const body = this.buffer.subarray(start, start + length).toString('utf-8');
|
|
274
|
+
this.buffer = this.buffer.subarray(start + length);
|
|
275
|
+
this.deliver(body);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
deliver(body) {
|
|
279
|
+
let message;
|
|
280
|
+
try {
|
|
281
|
+
message = JSON.parse(body);
|
|
282
|
+
}
|
|
283
|
+
catch {
|
|
284
|
+
// A malformed body is one lost message, not a lost connection: the
|
|
285
|
+
// framing already told us where it ended, so the stream is still in
|
|
286
|
+
// step and the next frame is readable.
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
if (message.id === undefined)
|
|
290
|
+
return;
|
|
291
|
+
const waiting = this.pending.get(message.id);
|
|
292
|
+
if (!waiting)
|
|
293
|
+
return;
|
|
294
|
+
this.pending.delete(message.id);
|
|
295
|
+
clearTimeout(waiting.timer);
|
|
296
|
+
if (message.error) {
|
|
297
|
+
waiting.reject(new Error(message.error.message ?? `error ${message.error.code ?? 'unknown'}`));
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
waiting.resolve(message.result);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
async dispose() {
|
|
304
|
+
if (this.disposed)
|
|
305
|
+
return;
|
|
306
|
+
this.disposed = true;
|
|
307
|
+
const child = this.child;
|
|
308
|
+
this.child = undefined;
|
|
309
|
+
for (const waiting of this.pending.values()) {
|
|
310
|
+
clearTimeout(waiting.timer);
|
|
311
|
+
waiting.reject(new Error('The code navigation provider was disposed.'));
|
|
312
|
+
}
|
|
313
|
+
this.pending.clear();
|
|
314
|
+
if (!child)
|
|
315
|
+
return;
|
|
316
|
+
// The handshake FIRST, so a server with unsaved index state gets to
|
|
317
|
+
// finish. A `kill` alone leaves whatever it was writing half-written,
|
|
318
|
+
// and some servers hold a lock file.
|
|
319
|
+
const exited = new Promise((resolve) => {
|
|
320
|
+
child.once('exit', () => resolve());
|
|
321
|
+
});
|
|
322
|
+
try {
|
|
323
|
+
this.child = child;
|
|
324
|
+
this.write({ jsonrpc: '2.0', id: ++this.seq, method: 'shutdown', params: {} });
|
|
325
|
+
this.write({ jsonrpc: '2.0', method: 'exit', params: {} });
|
|
326
|
+
}
|
|
327
|
+
catch {
|
|
328
|
+
// The pipe is already gone. Falling through to the kill is right.
|
|
329
|
+
}
|
|
330
|
+
this.child = undefined;
|
|
331
|
+
child.stdin?.end();
|
|
332
|
+
// Bounded, because a server that ignores `exit` must not keep the run
|
|
333
|
+
// alive. This is the same trade `kill-tree` makes: ask, then insist.
|
|
334
|
+
await Promise.race([
|
|
335
|
+
exited,
|
|
336
|
+
new Promise((resolve) => {
|
|
337
|
+
const timer = setTimeout(() => {
|
|
338
|
+
child.kill('SIGKILL');
|
|
339
|
+
resolve();
|
|
340
|
+
}, 2_000);
|
|
341
|
+
timer.unref?.();
|
|
342
|
+
}),
|
|
343
|
+
]);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
function isLocation(value) {
|
|
347
|
+
if (typeof value !== 'object' || value === null)
|
|
348
|
+
return false;
|
|
349
|
+
const candidate = value;
|
|
350
|
+
return typeof candidate.uri === 'string' && typeof candidate.range?.start === 'object';
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* A thrown error as the right member of a result union.
|
|
354
|
+
*
|
|
355
|
+
* The two `unsupported`/`failed` arms are identical across all three result
|
|
356
|
+
* types, so this returns that shared shape and each caller widens it. A
|
|
357
|
+
* generic that claimed to produce `T` would be asserting into a union it
|
|
358
|
+
* cannot construct.
|
|
359
|
+
*/
|
|
360
|
+
function toFailure(err, command, method) {
|
|
361
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
362
|
+
// A method the server does not implement is `unsupported`, not `failed`:
|
|
363
|
+
// a caller can fall back and say why the answer is approximate, where a
|
|
364
|
+
// failure means the answer is unknown.
|
|
365
|
+
if (/method not found|-32601/i.test(message)) {
|
|
366
|
+
return { kind: 'unsupported', reason: `${command} does not implement ${method}.` };
|
|
367
|
+
}
|
|
368
|
+
return { kind: 'failed', error: message };
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* The wire's several hover shapes, as one string.
|
|
372
|
+
*
|
|
373
|
+
* `contents` has been a string, a `{ language, value }` pair, an array of
|
|
374
|
+
* either, and a `{ kind, value }` markup object across revisions of the
|
|
375
|
+
* protocol, and servers in the field still send all of them. A reader that
|
|
376
|
+
* handled only the newest returns empty for a server that answered — which
|
|
377
|
+
* is indistinguishable, at the call site, from a symbol with no type.
|
|
378
|
+
*/
|
|
379
|
+
function hoverText(result) {
|
|
380
|
+
if (result === null || result === undefined)
|
|
381
|
+
return '';
|
|
382
|
+
const contents = result.contents;
|
|
383
|
+
return flattenHover(contents).join('\n').trim();
|
|
384
|
+
}
|
|
385
|
+
function flattenHover(value) {
|
|
386
|
+
if (value === null || value === undefined)
|
|
387
|
+
return [];
|
|
388
|
+
if (typeof value === 'string')
|
|
389
|
+
return [value];
|
|
390
|
+
if (Array.isArray(value))
|
|
391
|
+
return value.flatMap(flattenHover);
|
|
392
|
+
if (typeof value === 'object') {
|
|
393
|
+
const record = value;
|
|
394
|
+
if (typeof record.value === 'string')
|
|
395
|
+
return [record.value];
|
|
396
|
+
}
|
|
397
|
+
return [];
|
|
398
|
+
}
|
|
399
|
+
/** `workspace/symbol` and `textDocument/documentSymbol` answer differently. */
|
|
400
|
+
function toSymbols(result, fallbackPath) {
|
|
401
|
+
if (!Array.isArray(result))
|
|
402
|
+
return [];
|
|
403
|
+
const out = [];
|
|
404
|
+
for (const entry of result) {
|
|
405
|
+
if (typeof entry !== 'object' || entry === null)
|
|
406
|
+
continue;
|
|
407
|
+
const item = entry;
|
|
408
|
+
if (typeof item.name !== 'string')
|
|
409
|
+
continue;
|
|
410
|
+
// `workspace/symbol` carries a `location`; `documentSymbol` carries a
|
|
411
|
+
// `range` and leaves the file implied by the request. Both are handled
|
|
412
|
+
// because the fallback path produces the second shape.
|
|
413
|
+
const location = item.location
|
|
414
|
+
? toSourceLocation(item.location)
|
|
415
|
+
: item.selectionRange || item.range
|
|
416
|
+
? toSourceLocation({
|
|
417
|
+
uri: fallbackPath ? pathToFileURL(fallbackPath).href : '',
|
|
418
|
+
range: (item.selectionRange ?? item.range),
|
|
419
|
+
})
|
|
420
|
+
: undefined;
|
|
421
|
+
if (location) {
|
|
422
|
+
out.push({
|
|
423
|
+
...location,
|
|
424
|
+
name: item.name,
|
|
425
|
+
...(typeof item.kind === 'number' ? { symbolKind: item.kind } : {}),
|
|
426
|
+
...(typeof item.containerName === 'string' ? { containerName: item.containerName } : {}),
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
// `documentSymbol` is a TREE. A reader that took only the top level
|
|
430
|
+
// would miss every method, which is most of what somebody searching by
|
|
431
|
+
// name is looking for.
|
|
432
|
+
if (Array.isArray(item.children))
|
|
433
|
+
out.push(...toSymbols(item.children, fallbackPath));
|
|
434
|
+
}
|
|
435
|
+
return out;
|
|
436
|
+
}
|
|
437
|
+
//# sourceMappingURL=stdio.js.map
|
|
@@ -0,0 +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,CA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,CAAC,CAAC,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK;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
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code navigation an agent can trust, which grep is not.
|
|
3
|
+
*
|
|
4
|
+
* The whole code-navigation surface this kernel had was `grep` (regex over
|
|
5
|
+
* file text) and `glob` (filename patterns). An agent asked to find every
|
|
6
|
+
* call site of a function got every textual occurrence — the comment
|
|
7
|
+
* mentioning it, the string literal naming it, the unrelated same-named
|
|
8
|
+
* symbol in another scope — and MISSED the call sites that arrive through a
|
|
9
|
+
* re-export or a destructure. That last half is the one a rename has to get
|
|
10
|
+
* right, and it is exactly the half a regex cannot see.
|
|
11
|
+
*
|
|
12
|
+
* Two operations, deliberately. A provider interface with twenty methods
|
|
13
|
+
* and one implementation is a guess at what a consumer needs; these two are
|
|
14
|
+
* what the failure above actually requires, and the shape is the same one
|
|
15
|
+
* `Sandbox` uses — a host constructs one and hands it over, with no
|
|
16
|
+
* `registerProvider()`-with-discovery indirection in between.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Re-exported from `@namzu/sdk`, never re-declared.
|
|
20
|
+
*
|
|
21
|
+
* The dependency direction is `sdk ← lsp`, so the kernel owns the shape a
|
|
22
|
+
* tool programs against and this package implements it. A second
|
|
23
|
+
* declaration here would compile — the shapes are structural — and would be
|
|
24
|
+
* a copy that can drift, with the drifted one deciding whether the `lsp`
|
|
25
|
+
* builtin accepts this provider at all.
|
|
26
|
+
*/
|
|
27
|
+
export type { CodeNavigationProvider, CodeNavigationResult, HoverResult, SourceLocation, SymbolLocation, SymbolSearchResult, } from '@namzu/sdk';
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +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"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code navigation an agent can trust, which grep is not.
|
|
3
|
+
*
|
|
4
|
+
* The whole code-navigation surface this kernel had was `grep` (regex over
|
|
5
|
+
* file text) and `glob` (filename patterns). An agent asked to find every
|
|
6
|
+
* call site of a function got every textual occurrence — the comment
|
|
7
|
+
* mentioning it, the string literal naming it, the unrelated same-named
|
|
8
|
+
* symbol in another scope — and MISSED the call sites that arrive through a
|
|
9
|
+
* re-export or a destructure. That last half is the one a rename has to get
|
|
10
|
+
* right, and it is exactly the half a regex cannot see.
|
|
11
|
+
*
|
|
12
|
+
* Two operations, deliberately. A provider interface with twenty methods
|
|
13
|
+
* and one implementation is a guess at what a consumer needs; these two are
|
|
14
|
+
* what the failure above actually requires, and the shape is the same one
|
|
15
|
+
* `Sandbox` uses — a host constructs one and hands it over, with no
|
|
16
|
+
* `registerProvider()`-with-discovery indirection in between.
|
|
17
|
+
*/
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@namzu/lsp",
|
|
3
|
+
"version": "0.2.0",
|
|
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
|
+
"license": "FSL-1.1-MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"homepage": "https://github.com/cogitave/namzu#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/cogitave/namzu.git",
|
|
11
|
+
"directory": "packages/lsp"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/cogitave/namzu/issues"
|
|
15
|
+
},
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"!dist/**/*.test.*",
|
|
27
|
+
"!dist/**/*.proc-test.*",
|
|
28
|
+
"!dist/**/__tests__",
|
|
29
|
+
"!dist/**/__fixtures__",
|
|
30
|
+
"!dist/**/test-setup.*",
|
|
31
|
+
"src",
|
|
32
|
+
"!src/**/*.test.*",
|
|
33
|
+
"!src/**/*.proc-test.*",
|
|
34
|
+
"!src/**/__tests__",
|
|
35
|
+
"!src/**/__fixtures__",
|
|
36
|
+
"!src/**/test-setup.*",
|
|
37
|
+
"LICENSE.md",
|
|
38
|
+
"README.md",
|
|
39
|
+
"CHANGELOG.md"
|
|
40
|
+
],
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public",
|
|
43
|
+
"provenance": true
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsc --build",
|
|
47
|
+
"dev": "tsc --build --watch",
|
|
48
|
+
"lint": "biome check src/",
|
|
49
|
+
"lint:fix": "biome check --write src/",
|
|
50
|
+
"format": "biome format --write src/",
|
|
51
|
+
"test": "vitest run --passWithNoTests",
|
|
52
|
+
"typecheck": "tsc --noEmit",
|
|
53
|
+
"prepublishOnly": "pnpm lint && pnpm typecheck && pnpm build"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"@namzu/sdk": ">=1.0.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@biomejs/biome": "^1.9.4",
|
|
60
|
+
"@namzu/sdk": "workspace:^",
|
|
61
|
+
"@types/node": "^22.19.17",
|
|
62
|
+
"typescript": "^5.5.0",
|
|
63
|
+
"vitest": "^3.2.6"
|
|
64
|
+
}
|
|
65
|
+
}
|