File tree 2 files changed +10
-5
lines changed
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,12 @@ export function setup({ document }) {
22
22
code_view . handleDiagnostics ( params . diagnostics ) ;
23
23
} ,
24
24
) ;
25
-
26
- lspc . start ( ) . catch ( console . error ) ;
25
+ const cacheDir = GLib . get_user_cache_dir ( ) ;
26
+ const rustAnalyzerCache = `${ cacheDir } /rust_analyzer_cache` ;
27
+ // It shouldn't be necessary to disable `useRustcWrapper`, stop doing that as soon as that issue is fixed
28
+ // https://github.com/rust-lang/rust-analyzer/issues/16565#issuecomment-1944354758
29
+ const initializationOptions = { "cargo" : { "buildScripts" : { "useRustcWrapper" : false } } , "rust" : { "analyzerTargetDir" : rustAnalyzerCache } } ;
30
+ lspc . start ( initializationOptions ) . catch ( console . error ) ;
27
31
28
32
buffer . connect ( "modified-changed" , ( ) => {
29
33
if ( ! buffer . get_modified ( ) ) return ;
Original file line number Diff line number Diff line change @@ -45,10 +45,10 @@ export default class LSPClient {
45
45
} ;
46
46
}
47
47
48
- async start ( ) {
48
+ async start ( initializationOptions = { } ) {
49
49
this . _start_process ( ) ;
50
50
51
- await this . _initialize ( ) ;
51
+ await this . _initialize ( initializationOptions ) ;
52
52
await this . _didOpen ( ) ;
53
53
54
54
this . ready = true ;
@@ -65,7 +65,7 @@ export default class LSPClient {
65
65
return once ( this , "ready" ) ;
66
66
}
67
67
68
- async _initialize ( ) {
68
+ async _initialize ( initializationOptions = { } ) {
69
69
const { capabilities, rootUri } = this ;
70
70
71
71
// https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#initialize
@@ -74,6 +74,7 @@ export default class LSPClient {
74
74
clientInfo,
75
75
capabilities,
76
76
rootUri,
77
+ initializationOptions,
77
78
locale : "en" ,
78
79
} ) ;
79
80
You can’t perform that action at this time.
0 commit comments