diff options
author | kjeremy <[email protected]> | 2020-07-20 22:25:48 +0100 |
---|---|---|
committer | kjeremy <[email protected]> | 2020-07-20 22:42:48 +0100 |
commit | adc4bb54062bd0bdff8bfaecce238990f4225bac (patch) | |
tree | aebb71b2cfd4528f487edeae75685610cf205d1f /crates | |
parent | 76c1fac9c3ed9fa3f784e5cdde7dd770c9fac6c1 (diff) |
Allow client to respond to workspace/configuration with null values
This is allowed per the spec if the client doesn't know about the configuration
we've requested.
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 5 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 68b2a2abd..3a0aa4183 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -177,6 +177,11 @@ impl Config { | |||
177 | 177 | ||
178 | pub fn update(&mut self, json: serde_json::Value) { | 178 | pub fn update(&mut self, json: serde_json::Value) { |
179 | log::info!("Config::update({:#})", json); | 179 | log::info!("Config::update({:#})", json); |
180 | |||
181 | if json.is_null() { | ||
182 | return; | ||
183 | } | ||
184 | |||
180 | let data = ConfigData::from_json(json); | 185 | let data = ConfigData::from_json(json); |
181 | 186 | ||
182 | self.with_sysroot = data.withSysroot; | 187 | self.with_sysroot = data.withSysroot; |
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index a41f7f564..bb7c4c0c6 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -468,6 +468,8 @@ impl GlobalState { | |||
468 | } | 468 | } |
469 | (None, Some(mut configs)) => { | 469 | (None, Some(mut configs)) => { |
470 | if let Some(json) = configs.get_mut(0) { | 470 | if let Some(json) = configs.get_mut(0) { |
471 | // Note that json can be null according to the spec if the client can't | ||
472 | // provide a configuration. This is handled in Config::update below. | ||
471 | let mut config = this.config.clone(); | 473 | let mut config = this.config.clone(); |
472 | config.update(json.take()); | 474 | config.update(json.take()); |
473 | this.update_configuration(config); | 475 | this.update_configuration(config); |