File tree Expand file tree Collapse file tree 5 files changed +22
-1
lines changed Expand file tree Collapse file tree 5 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ pub(crate) fn load_cargo(
7070 } )
7171 . collect :: < FxHashMap < _ , _ > > ( ) ;
7272
73- let proc_macro_client = if with_proc_macro {
73+ let proc_macro_client = if ! with_proc_macro {
7474 ProcMacroClient :: dummy ( )
7575 } else {
7676 ProcMacroClient :: extern_process ( Path :: new ( "ra_proc_macro_srv" ) ) . unwrap ( )
Original file line number Diff line number Diff line change @@ -131,6 +131,14 @@ impl Config {
131131 set ( value, "/cargo/allFeatures" , & mut self . cargo . all_features ) ;
132132 set ( value, "/cargo/features" , & mut self . cargo . features ) ;
133133 set ( value, "/cargo/loadOutDirsFromCheck" , & mut self . cargo . load_out_dirs_from_check ) ;
134+
135+ match get :: < bool > ( value, "/procMacro/enabled" ) {
136+ Some ( true ) => {
137+ set ( value, "/procMacro/serverPath" , & mut self . proc_macro_srv ) ;
138+ }
139+ _ => self . proc_macro_srv = None ,
140+ }
141+
134142 match get :: < Vec < String > > ( value, "/rustfmt/overrideCommand" ) {
135143 Some ( mut args) if !args. is_empty ( ) => {
136144 let command = args. remove ( 0 ) ;
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ pub struct WorldState {
6464 pub latest_requests : Arc < RwLock < LatestRequests > > ,
6565 pub flycheck : Option < Flycheck > ,
6666 pub diagnostics : DiagnosticCollection ,
67+ pub proc_macro_client : ProcMacroClient ,
6768}
6869
6970/// An immutable snapshot of the world's state at a point in time.
@@ -192,6 +193,7 @@ impl WorldState {
192193 latest_requests : Default :: default ( ) ,
193194 flycheck,
194195 diagnostics : Default :: default ( ) ,
196+ proc_macro_client,
195197 }
196198 }
197199
Original file line number Diff line number Diff line change 388388 "description" : " Enable logging of VS Code extensions itself" ,
389389 "type" : " boolean" ,
390390 "default" : false
391+ },
392+ "rust-analyzer.procMacro.enabled" : {
393+ "description" : " Enable Proc macro support, cargo.loadOutDirsFromCheck must be enabled." ,
394+ "type" : " boolean" ,
395+ "default" : false
396+ },
397+ "rust-analyzer.procMacro.serverPath" : {
398+ "description" : " Proc macro server path" ,
399+ "type" : " string" ,
400+ "default" : " ra_proc_macro_srv"
391401 }
392402 }
393403 },
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export class Config {
1212 private readonly requiresReloadOpts = [
1313 "serverPath" ,
1414 "cargo" ,
15+ "procMacro" ,
1516 "files" ,
1617 "highlighting" ,
1718 "updates.channel" ,
You can’t perform that action at this time.
0 commit comments