Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions editors/code/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down