File tree 1 file changed +19
-3
lines changed
crates/rust-analyzer/src/cli
1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -60,10 +60,26 @@ pub fn load_workspace(
60
60
} ;
61
61
62
62
let proc_macro_client = if load_config. with_proc_macro {
63
- let path = AbsPathBuf :: assert ( std:: env:: current_exe ( ) ?) ;
64
- Ok ( ProcMacroServer :: spawn ( path, & [ "proc-macro" ] ) . unwrap ( ) )
63
+ let mut path = AbsPathBuf :: assert ( std:: env:: current_exe ( ) ?) ;
64
+ let mut args = vec ! [ "proc-macro" ] ;
65
+
66
+ if let ProjectWorkspace :: Cargo { sysroot, .. } | ProjectWorkspace :: Json { sysroot, .. } =
67
+ & ws
68
+ {
69
+ if let Some ( sysroot) = sysroot. as_ref ( ) {
70
+ let standalone_server_name =
71
+ format ! ( "rust-analyzer-proc-macro-srv{}" , std:: env:: consts:: EXE_SUFFIX ) ;
72
+ let server_path = sysroot. root ( ) . join ( "libexec" ) . join ( & standalone_server_name) ;
73
+ if std:: fs:: metadata ( & server_path) . is_ok ( ) {
74
+ path = server_path;
75
+ args = vec ! [ ] ;
76
+ }
77
+ }
78
+ }
79
+
80
+ ProcMacroServer :: spawn ( path. clone ( ) , args. clone ( ) ) . map_err ( |e| e. to_string ( ) )
65
81
} else {
66
- Err ( "proc macro server not started " . to_owned ( ) )
82
+ Err ( "proc macro server disabled " . to_owned ( ) )
67
83
} ;
68
84
69
85
let crate_graph = ws. to_crate_graph (
You can’t perform that action at this time.
0 commit comments