From e1c9eacc65779195ef3e2ab814587569e3650dff Mon Sep 17 00:00:00 2001 From: Michael Gruenewald Date: Wed, 17 Dec 2025 14:20:43 +0100 Subject: [PATCH] Fix LSP configuration request handling --- editors/code/src/client.ts | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index cb71a01138b3..5b358e3211fb 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts @@ -30,17 +30,24 @@ export async function createClient( }, async configuration( params: lc.ConfigurationParams, - token: vscode.CancellationToken, - next: lc.ConfigurationRequest.HandlerSignature, + _token: vscode.CancellationToken, + _next: lc.ConfigurationRequest.HandlerSignature, ) { - const resp = await next(params, token); - if (resp && Array.isArray(resp)) { - return resp.map((val) => { - return prepareVSCodeConfig(val); - }); - } else { - return resp; + // The rust-analyzer LSP only ever asks for the "rust-analyzer" + // section, so we only need to support that. Instead of letting + // the vscode-languageclient handle it, use the `cfg` property + // in the config. + if ( + params.items.length !== 1 || + params.items[0]?.section !== "rust-analyzer" || + params.items[0]?.scopeUri !== undefined + ) { + return new lc.ResponseError( + lc.ErrorCodes.InvalidParams, + 'Only the "rust-analyzer" config section is supported.', + ); } + return [prepareVSCodeConfig(config.cfg)]; }, }, async handleDiagnostics(