diff options
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 04f5bb473..b6a015790 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -120,12 +120,10 @@ impl Config { | |||
120 | set(value, "/withSysroot", &mut self.with_sysroot); | 120 | set(value, "/withSysroot", &mut self.with_sysroot); |
121 | set(value, "/featureFlags/lsp.diagnostics", &mut self.publish_diagnostics); | 121 | set(value, "/featureFlags/lsp.diagnostics", &mut self.publish_diagnostics); |
122 | set(value, "/lruCapacity", &mut self.lru_capacity); | 122 | set(value, "/lruCapacity", &mut self.lru_capacity); |
123 | if let Some(watcher) = get::<String>(value, "/files/watcher") { | 123 | self.files.watcher = match get(value, "/files/watcher") { |
124 | self.files.watcher = match watcher.as_str() { | 124 | Some("client") => FilesWatcher::Client, |
125 | "client" => FilesWatcher::Client, | 125 | Some("notify") | _ => FilesWatcher::Notify |
126 | "notify"| _ => FilesWatcher::Notify, | 126 | }; |
127 | } | ||
128 | } | ||
129 | set(value, "/notifications/workspaceLoaded", &mut self.notifications.workspace_loaded); | 127 | set(value, "/notifications/workspaceLoaded", &mut self.notifications.workspace_loaded); |
130 | set(value, "/notifications/cargoTomlNotFound", &mut self.notifications.cargo_toml_not_found); | 128 | set(value, "/notifications/cargoTomlNotFound", &mut self.notifications.cargo_toml_not_found); |
131 | 129 | ||
@@ -144,8 +142,9 @@ impl Config { | |||
144 | } else if let RustfmtConfig::Rustfmt { extra_args } = &mut self.rustfmt { | 142 | } else if let RustfmtConfig::Rustfmt { extra_args } = &mut self.rustfmt { |
145 | set(value, "/rustfmt/extraArgs", extra_args); | 143 | set(value, "/rustfmt/extraArgs", extra_args); |
146 | } | 144 | } |
145 | |||
147 | if let Some(false) = get(value, "/checkOnSave/enable") { | 146 | if let Some(false) = get(value, "/checkOnSave/enable") { |
148 | self.check = None | 147 | self.check = None; |
149 | } else { | 148 | } else { |
150 | if let Some(mut args) = get::<Vec<String>>(value, "/checkOnSave/overrideCommand") { | 149 | if let Some(mut args) = get::<Vec<String>>(value, "/checkOnSave/overrideCommand") { |
151 | if !args.is_empty() { | 150 | if !args.is_empty() { |
@@ -153,7 +152,7 @@ impl Config { | |||
153 | self.check = Some(FlycheckConfig::CustomCommand { | 152 | self.check = Some(FlycheckConfig::CustomCommand { |
154 | command, | 153 | command, |
155 | args, | 154 | args, |
156 | }) | 155 | }); |
157 | } | 156 | } |
158 | 157 | ||
159 | } else if let Some(FlycheckConfig::CargoCommand { command, extra_args, all_targets }) = &mut self.check | 158 | } else if let Some(FlycheckConfig::CargoCommand { command, extra_args, all_targets }) = &mut self.check |
@@ -179,7 +178,7 @@ impl Config { | |||
179 | value.pointer(pointer).and_then(|it| T::deserialize(it).ok()) | 178 | value.pointer(pointer).and_then(|it| T::deserialize(it).ok()) |
180 | } | 179 | } |
181 | 180 | ||
182 | fn set<'a, T: Deserialize<'a> + std::fmt::Debug>(value: &'a serde_json::Value, pointer: &str, slot: &mut T) { | 181 | fn set<'a, T: Deserialize<'a>>(value: &'a serde_json::Value, pointer: &str, slot: &mut T) { |
183 | if let Some(new_value) = get(value, pointer) { | 182 | if let Some(new_value) = get(value, pointer) { |
184 | *slot = new_value | 183 | *slot = new_value |
185 | } | 184 | } |