aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/main_loop.rs18
1 files changed, 13 insertions, 5 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 0ab5b9ef5..79ea90cc9 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -414,18 +414,23 @@ fn loop_turn(
414 log::error!("unexpected response: {:?}", resp) 414 log::error!("unexpected response: {:?}", resp)
415 } 415 }
416 416
417 if Some(resp.id) == loop_state.configuration_request_id { 417 if Some(&resp.id) == loop_state.configuration_request_id.as_ref() {
418 loop_state.configuration_request_id = None; 418 loop_state.configuration_request_id = None;
419 log::debug!("config update response: '{:?}", resp);
419 let Response { error, result, .. } = resp; 420 let Response { error, result, .. } = resp;
420 match (error, result) { 421
422 match (
423 error,
424 result.map(|result| serde_json::from_value::<Vec<ServerConfig>>(result)),
425 ) {
421 (Some(err), _) => { 426 (Some(err), _) => {
422 log::error!("failed to fetch the server settings: {:?}", err) 427 log::error!("failed to fetch the server settings: {:?}", err)
423 } 428 }
424 (None, Some(result)) => { 429 (None, Some(Ok(new_config))) => {
425 let new_config = serde_json::from_value::<Vec<ServerConfig>>(result)? 430 let new_config = new_config
426 .first() 431 .first()
427 .expect( 432 .expect(
428 "The client is expected to always send a non-empty config data", 433 "the client is expected to always send a non-empty config data",
429 ) 434 )
430 .to_owned(); 435 .to_owned();
431 world_state.update_configuration( 436 world_state.update_configuration(
@@ -434,6 +439,9 @@ fn loop_turn(
434 get_feature_flags(&new_config, connection), 439 get_feature_flags(&new_config, connection),
435 ); 440 );
436 } 441 }
442 (None, Some(Err(e))) => {
443 log::error!("failed to parse client config response: {}", e)
444 }
437 (None, None) => { 445 (None, None) => {
438 log::error!("received empty server settings response from the client") 446 log::error!("received empty server settings response from the client")
439 } 447 }