File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,17 +30,24 @@ export async function createClient(
3030 } ,
3131 async configuration (
3232 params : lc . ConfigurationParams ,
33- token : vscode . CancellationToken ,
34- next : lc . ConfigurationRequest . HandlerSignature ,
33+ _token : vscode . CancellationToken ,
34+ _next : lc . ConfigurationRequest . HandlerSignature ,
3535 ) {
36- const resp = await next ( params , token ) ;
37- if ( resp && Array . isArray ( resp ) ) {
38- return resp . map ( ( val ) => {
39- return prepareVSCodeConfig ( val ) ;
40- } ) ;
41- } else {
42- return resp ;
36+ // The rust-analyzer LSP only ever asks for the "rust-analyzer"
37+ // section, so we only need to support that. Instead of letting
38+ // the vscode-languageclient handle it, use the `cfg` property
39+ // in the config.
40+ if (
41+ params . items . length !== 1 ||
42+ params . items [ 0 ] ?. section !== "rust-analyzer" ||
43+ params . items [ 0 ] ?. scopeUri !== undefined
44+ ) {
45+ return new lc . ResponseError (
46+ lc . ErrorCodes . InvalidParams ,
47+ 'Only the "rust-analyzer" config section is supported.' ,
48+ ) ;
4349 }
50+ return [ prepareVSCodeConfig ( config . cfg ) ] ;
4451 } ,
4552 } ,
4653 async handleDiagnostics (
You can’t perform that action at this time.
0 commit comments