Restart a crashed language server per --restart never|always|N
The process is supervised: on exit after a successful initialize it is spawned again with exponential backoff (500ms to 30s), open documents are re-sent as didOpen before the new session is announced, and requests caught by the crash wait for it and retry. A crash more than a minute after the previous one starts a fresh streak; reaching the streak limit (default 3) ends restarting for good, after which every request fails with an LspError saying so. Restarts and give-ups are logged and forwarded to the MCP client. Writes to the child's stdin go through a PassThrough so a broken pipe ends the session instead of surfacing as an unhandled rejection.
This commit is contained in:
6 files changed
+441
-146
No files matched your search
Vendored
+3
-1
@@ -2,7 +2,8 @@
|
||||
* A miniature language server used by the tests. Words are symbols: hover
|
||||
* describes the word under the cursor, definition is its first occurrence,
|
||||
* references and rename cover every occurrence, and each line containing
|
||||
* "TODO" yields a warning. `fixture/state` reports open/close counts.
|
||||
* "TODO" yields a warning. `fixture/state` reports open/close counts and
|
||||
* `fixture/crash` kills the process.
|
||||
*/
|
||||
import {
|
||||
createConnection,
|
||||
@@ -136,6 +137,7 @@ connection.onDocumentSymbol(({ textDocument }) => {
|
||||
);
|
||||
});
|
||||
|
||||
connection.onNotification("fixture/crash", () => process.exit(1));
|
||||
connection.onRequest("fixture/state", () => ({
|
||||
open: documents.all().length,
|
||||
closes,
|
||||
|
||||
Reference in new issue
Block a user