fix(lsp): replied to defined server requests with spec no-ops
handleServerRequest fell through to a JSON-RPC -32601 Method not found for several defined server -> client requests (window/showMessageRequest, window/showDocument, workspace/{semanticTokens,inlayHint,codeLens,codeAction,diagnostic}/refresh). Servers that block on a real reply -- the same failure class as the client/registerCapability hang fixed in #3029 -- could stall waiting for an acknowledgement that never came.
Reply with the spec no-op result instead: null for showMessageRequest / *Refresh, { success: false } for showDocument. Headless omp cannot honour the UI surface, but it still owes a defined response.
Fixes #3044
This commit is contained in:
@@ -482,6 +482,28 @@ async function handleServerRequest(client: LspClient, message: LspJsonRpcRequest
|
||||
await sendResponse(client, message.id, null, message.method);
|
||||
return;
|
||||
}
|
||||
if (message.method === "window/showMessageRequest") {
|
||||
// Headless: no UI to surface the prompt. Spec says null = "no action selected".
|
||||
await sendResponse(client, message.id, null, message.method);
|
||||
return;
|
||||
}
|
||||
if (message.method === "window/showDocument") {
|
||||
// Headless: nothing to display. Spec result is `{ success: boolean }`.
|
||||
await sendResponse(client, message.id, { success: false }, message.method);
|
||||
return;
|
||||
}
|
||||
if (
|
||||
message.method === "workspace/semanticTokens/refresh" ||
|
||||
message.method === "workspace/inlayHint/refresh" ||
|
||||
message.method === "workspace/codeLens/refresh" ||
|
||||
message.method === "workspace/codeAction/refresh" ||
|
||||
message.method === "workspace/diagnostic/refresh"
|
||||
) {
|
||||
// Void acknowledgement per spec; servers that stall waiting for a reply
|
||||
// (same failure mode as the dynamic-registration hang in #3029) move on.
|
||||
await sendResponse(client, message.id, null, message.method);
|
||||
return;
|
||||
}
|
||||
await sendResponse(client, message.id, null, message.method, {
|
||||
code: -32601,
|
||||
message: `Method not found: ${message.method}`,
|
||||
|
||||
Reference in New Issue
Block a user