From 947eac808901e0b7d05a44d8f6250ee90fb89045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 18 Sep 2026 07:43:36 +0000 Subject: [PATCH] :rewind: 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. --- development/testing.md | 14 +++----------- src/util/__tests__/lsp-completion.ts | 7 +++---- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/development/testing.md b/development/testing.md index 2b449a0..edcd407 100644 --- a/development/testing.md +++ b/development/testing.md @@ -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 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; -the CLI is for manual inspection. It speaks to the server through -`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)). +the CLI is for manual inspection. #### 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`. `didOpen` is handled in order before the completion request, so no settle delay is needed. -- The TS 7 Go server has a shutdown race: `handleExit` returns `io.EOF`, which - cancels the background context while `Session.updateWatches` is still running - (`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. +- The server answers some requests with a string id (`client/registerCapability`); + the client must tolerate `string | number` ids or the server stalls. ## Known issues diff --git a/src/util/__tests__/lsp-completion.ts b/src/util/__tests__/lsp-completion.ts index 30cb838..0dab224 100644 --- a/src/util/__tests__/lsp-completion.ts +++ b/src/util/__tests__/lsp-completion.ts @@ -145,10 +145,9 @@ export class LspSession { return ( this.#connection .sendRequest(ShutdownRequest.type) - // The TS 7 Go server races a background task against the `exit` - // notification and logs a bare `context canceled` to stderr as it - // tears down (see development/testing.md § Autocomplete). EOF on - // stdin shuts it down cleanly instead: exit 0, no output. + // The TS 7 Go server logs a bare `context canceled` to stderr + // when it handles `exit`; EOF on stdin shuts it down cleanly + // (exit 0, no output) instead. .then(() => { this.#child.stdin.end(); })