aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2020-04-12 17:05:33 +0100
committerEdwin Cheng <[email protected]>2020-04-16 12:28:06 +0100
commita4b0ce07f80773146c72004befc77be4e576c677 (patch)
tree0dec04c4667033b0115fae3be51e1e1202869abd /crates
parent22e33f308a7dfe924bf2d10f9041e91cec1349a0 (diff)
Add config for proc_macro
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/cli/load_cargo.rs2
-rw-r--r--crates/rust-analyzer/src/config.rs8
-rw-r--r--crates/rust-analyzer/src/world.rs2
3 files changed, 11 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/cli/load_cargo.rs b/crates/rust-analyzer/src/cli/load_cargo.rs
index f70d92c7f..dfda488fb 100644
--- a/crates/rust-analyzer/src/cli/load_cargo.rs
+++ b/crates/rust-analyzer/src/cli/load_cargo.rs
@@ -70,7 +70,7 @@ pub(crate) fn load_cargo(
70 }) 70 })
71 .collect::<FxHashMap<_, _>>(); 71 .collect::<FxHashMap<_, _>>();
72 72
73 let proc_macro_client = if with_proc_macro { 73 let proc_macro_client = if !with_proc_macro {
74 ProcMacroClient::dummy() 74 ProcMacroClient::dummy()
75 } else { 75 } else {
76 ProcMacroClient::extern_process(Path::new("ra_proc_macro_srv")).unwrap() 76 ProcMacroClient::extern_process(Path::new("ra_proc_macro_srv")).unwrap()
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 4734df16a..46a89b37e 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -131,6 +131,14 @@ impl Config {
131 set(value, "/cargo/allFeatures", &mut self.cargo.all_features); 131 set(value, "/cargo/allFeatures", &mut self.cargo.all_features);
132 set(value, "/cargo/features", &mut self.cargo.features); 132 set(value, "/cargo/features", &mut self.cargo.features);
133 set(value, "/cargo/loadOutDirsFromCheck", &mut self.cargo.load_out_dirs_from_check); 133 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
134 match get::<Vec<String>>(value, "/rustfmt/overrideCommand") { 142 match get::<Vec<String>>(value, "/rustfmt/overrideCommand") {
135 Some(mut args) if !args.is_empty() => { 143 Some(mut args) if !args.is_empty() => {
136 let command = args.remove(0); 144 let command = args.remove(0);
diff --git a/crates/rust-analyzer/src/world.rs b/crates/rust-analyzer/src/world.rs
index 6c42e1d76..b7142e83b 100644
--- a/crates/rust-analyzer/src/world.rs
+++ b/crates/rust-analyzer/src/world.rs
@@ -64,6 +64,7 @@ pub struct WorldState {
64 pub latest_requests: Arc<RwLock<LatestRequests>>, 64 pub latest_requests: Arc<RwLock<LatestRequests>>,
65 pub flycheck: Option<Flycheck>, 65 pub flycheck: Option<Flycheck>,
66 pub diagnostics: DiagnosticCollection, 66 pub diagnostics: DiagnosticCollection,
67 pub proc_macro_client: ProcMacroClient,
67} 68}
68 69
69/// An immutable snapshot of the world's state at a point in time. 70/// An immutable snapshot of the world's state at a point in time.
@@ -192,6 +193,7 @@ impl WorldState {
192 latest_requests: Default::default(), 193 latest_requests: Default::default(),
193 flycheck, 194 flycheck,
194 diagnostics: Default::default(), 195 diagnostics: Default::default(),
196 proc_macro_client,
195 } 197 }
196 } 198 }
197 199