⏪ Revert the LSP notes in testing.md
The protocol cross-link and the TS-internal shutdown-race explanation were too detailed for the category doc. The helper comment keeps a short, self-contained note on the stdin-EOF workaround.
This commit is contained in:
1 parent
eea2fbb17d
commit
947eac8089
2 files changed
+6
-15
No files matched your search
+3
-11
@@ -134,10 +134,7 @@ The script prints the labels the server offers at a `/*COMPLETE*/` marker inside
|
|||||||
is imported by `src/util/__tests__/lsp-completion.test.ts` — which tests the
|
is imported by `src/util/__tests__/lsp-completion.test.ts` — which tests the
|
||||||
helper itself against inline documents, never the library's code — and by
|
helper itself against inline documents, never the library's code — and by
|
||||||
`src/primitive.test.ts`, where the same probe asserts the matcher's popup;
|
`src/primitive.test.ts`, where the same probe asserts the matcher's popup;
|
||||||
the CLI is for manual inspection. It speaks to the server through
|
the CLI is for manual inspection.
|
||||||
`vscode-languageserver-protocol`'s message connection and typed requests, so the
|
|
||||||
transport and protocol plumbing are not hand-rolled (see
|
|
||||||
[tooling.md § `vscode-languageserver-protocol` backs the autocomplete helper](./tooling.md#vscode-languageserver-protocol-backs-the-autocomplete-helper)).
|
|
||||||
|
|
||||||
#### Why
|
#### Why
|
||||||
|
|
||||||
@@ -165,13 +162,8 @@ transport and protocol plumbing are not hand-rolled (see
|
|||||||
any order; the file is an integration test (~1.6 s) that needs `node_modules`.
|
any order; the file is an integration test (~1.6 s) that needs `node_modules`.
|
||||||
`didOpen` is handled in order before the completion request, so no settle
|
`didOpen` is handled in order before the completion request, so no settle
|
||||||
delay is needed.
|
delay is needed.
|
||||||
- The TS 7 Go server has a shutdown race: `handleExit` returns `io.EOF`, which
|
- The server answers some requests with a string id (`client/registerCapability`);
|
||||||
cancels the background context while `Session.updateWatches` is still running
|
the client must tolerate `string | number` ids or the server stalls.
|
||||||
(`internal/project/session.go`), so the bare `context canceled` error is
|
|
||||||
flushed straight to stderr once the outgoing queue is closed, and the server
|
|
||||||
exits 1 even though LSP expects 0 after `shutdown`. The helper therefore sends
|
|
||||||
`shutdown` and then closes stdin instead of sending `exit`; EOF makes the
|
|
||||||
server exit cleanly (code 0, no output), and the kill is kept as a fallback.
|
|
||||||
|
|
||||||
## Known issues
|
## Known issues
|
||||||
|
|
||||||
|
|||||||
@@ -145,10 +145,9 @@ export class LspSession {
|
|||||||
return (
|
return (
|
||||||
this.#connection
|
this.#connection
|
||||||
.sendRequest(ShutdownRequest.type)
|
.sendRequest(ShutdownRequest.type)
|
||||||
// The TS 7 Go server races a background task against the `exit`
|
// The TS 7 Go server logs a bare `context canceled` to stderr
|
||||||
// notification and logs a bare `context canceled` to stderr as it
|
// when it handles `exit`; EOF on stdin shuts it down cleanly
|
||||||
// tears down (see development/testing.md § Autocomplete). EOF on
|
// (exit 0, no output) instead.
|
||||||
// stdin shuts it down cleanly instead: exit 0, no output.
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.#child.stdin.end();
|
this.#child.stdin.end();
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in new issue
Block a user