What happens
In src/server.ts, the configuration-change handler revalidates every open document but discards every returned promise:
documents.all().forEach(validateTextDocument);
validateTextDocument is async (line 163). Array#forEach ignores return values, so each invocation's promise is dropped on the floor. If validation of any open document rejects — getDocumentSettings transport error, sendDiagnostics failure, parser exception — the rejection becomes an unhandledRejection on Node, which under Node 18+ default --unhandled-rejections=throw terminates the server process.
Same defect family as the document-change handler at lines 213-215, but multiplied across every open document on every configuration change.
What should happen
Wrap the calls in Promise.allSettled so every validation runs to completion and every rejection is caught individually:
Promise.allSettled(
documents.all().map(doc =>
validateTextDocument(doc).catch(err =>
connection.console.error(`Validation failed for ${doc.uri}: ${err}`)
)
)
);
Result: a configuration change that triggers one bad document no longer kills the LSP server, and individual validation failures surface as log entries.
What happens
In
src/server.ts, the configuration-change handler revalidates every open document but discards every returned promise:validateTextDocumentis async (line 163).Array#forEachignores return values, so each invocation's promise is dropped on the floor. If validation of any open document rejects —getDocumentSettingstransport error,sendDiagnosticsfailure, parser exception — the rejection becomes anunhandledRejectionon Node, which under Node 18+ default--unhandled-rejections=throwterminates the server process.Same defect family as the document-change handler at lines 213-215, but multiplied across every open document on every configuration change.
What should happen
Wrap the calls in
Promise.allSettledso every validation runs to completion and every rejection is caught individually:Result: a configuration change that triggers one bad document no longer kills the LSP server, and individual validation failures surface as log entries.