diff options
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 41 | ||||
-rw-r--r-- | editors/code/src/config.ts | 6 |
2 files changed, 24 insertions, 23 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index f81f43930..c990a3951 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -40,6 +40,7 @@ use crate::{ | |||
40 | world::{Options, WorldSnapshot, WorldState}, | 40 | world::{Options, WorldSnapshot, WorldState}, |
41 | Result, ServerConfig, | 41 | Result, ServerConfig, |
42 | }; | 42 | }; |
43 | use req::ConfigurationParams; | ||
43 | 44 | ||
44 | #[derive(Debug)] | 45 | #[derive(Debug)] |
45 | pub struct LspError { | 46 | pub struct LspError { |
@@ -336,10 +337,10 @@ struct LoopState { | |||
336 | in_flight_libraries: usize, | 337 | in_flight_libraries: usize, |
337 | pending_libraries: Vec<(SourceRootId, Vec<(FileId, RelativePathBuf, Arc<String>)>)>, | 338 | pending_libraries: Vec<(SourceRootId, Vec<(FileId, RelativePathBuf, Arc<String>)>)>, |
338 | workspace_loaded: bool, | 339 | workspace_loaded: bool, |
339 | |||
340 | roots_progress_reported: Option<usize>, | 340 | roots_progress_reported: Option<usize>, |
341 | roots_scanned: usize, | 341 | roots_scanned: usize, |
342 | roots_total: usize, | 342 | roots_total: usize, |
343 | configuration_request_id: Option<RequestId>, | ||
343 | } | 344 | } |
344 | 345 | ||
345 | impl LoopState { | 346 | impl LoopState { |
@@ -397,15 +398,14 @@ fn loop_turn( | |||
397 | req, | 398 | req, |
398 | )?, | 399 | )?, |
399 | Message::Notification(not) => { | 400 | Message::Notification(not) => { |
400 | on_notification( | 401 | on_notification(&connection.sender, world_state, loop_state, not)?; |
401 | &connection.sender, | ||
402 | world_state, | ||
403 | &mut loop_state.pending_requests, | ||
404 | &mut loop_state.subscriptions, | ||
405 | not, | ||
406 | )?; | ||
407 | } | 402 | } |
408 | Message::Response(resp) => { | 403 | Message::Response(resp) => { |
404 | if Some(&resp.id) == loop_state.configuration_request_id.as_ref() { | ||
405 | loop_state.configuration_request_id.take(); | ||
406 | eprintln!("!!!!!!!!!!!!!!1"); | ||
407 | dbg!(&resp); | ||
408 | } | ||
409 | let removed = loop_state.pending_responses.remove(&resp.id); | 409 | let removed = loop_state.pending_responses.remove(&resp.id); |
410 | if !removed { | 410 | if !removed { |
411 | log::error!("unexpected response: {:?}", resp) | 411 | log::error!("unexpected response: {:?}", resp) |
@@ -569,8 +569,7 @@ fn on_request( | |||
569 | fn on_notification( | 569 | fn on_notification( |
570 | msg_sender: &Sender<Message>, | 570 | msg_sender: &Sender<Message>, |
571 | state: &mut WorldState, | 571 | state: &mut WorldState, |
572 | pending_requests: &mut PendingRequests, | 572 | loop_state: &mut LoopState, |
573 | subs: &mut Subscriptions, | ||
574 | not: Notification, | 573 | not: Notification, |
575 | ) -> Result<()> { | 574 | ) -> Result<()> { |
576 | let not = match notification_cast::<req::Cancel>(not) { | 575 | let not = match notification_cast::<req::Cancel>(not) { |
@@ -579,7 +578,7 @@ fn on_notification( | |||
579 | NumberOrString::Number(id) => id.into(), | 578 | NumberOrString::Number(id) => id.into(), |
580 | NumberOrString::String(id) => id.into(), | 579 | NumberOrString::String(id) => id.into(), |
581 | }; | 580 | }; |
582 | if pending_requests.cancel(&id) { | 581 | if loop_state.pending_requests.cancel(&id) { |
583 | let response = Response::new_err( | 582 | let response = Response::new_err( |
584 | id, | 583 | id, |
585 | ErrorCode::RequestCanceled as i32, | 584 | ErrorCode::RequestCanceled as i32, |
@@ -598,7 +597,7 @@ fn on_notification( | |||
598 | if let Some(file_id) = | 597 | if let Some(file_id) = |
599 | state.vfs.write().add_file_overlay(&path, params.text_document.text) | 598 | state.vfs.write().add_file_overlay(&path, params.text_document.text) |
600 | { | 599 | { |
601 | subs.add_sub(FileId(file_id.0)); | 600 | loop_state.subscriptions.add_sub(FileId(file_id.0)); |
602 | } | 601 | } |
603 | return Ok(()); | 602 | return Ok(()); |
604 | } | 603 | } |
@@ -629,7 +628,7 @@ fn on_notification( | |||
629 | let uri = params.text_document.uri; | 628 | let uri = params.text_document.uri; |
630 | let path = uri.to_file_path().map_err(|()| format!("invalid uri: {}", uri))?; | 629 | let path = uri.to_file_path().map_err(|()| format!("invalid uri: {}", uri))?; |
631 | if let Some(file_id) = state.vfs.write().remove_file_overlay(path.as_path()) { | 630 | if let Some(file_id) = state.vfs.write().remove_file_overlay(path.as_path()) { |
632 | subs.remove_sub(FileId(file_id.0)); | 631 | loop_state.subscriptions.remove_sub(FileId(file_id.0)); |
633 | } | 632 | } |
634 | let params = | 633 | let params = |
635 | req::PublishDiagnosticsParams { uri, diagnostics: Vec::new(), version: None }; | 634 | req::PublishDiagnosticsParams { uri, diagnostics: Vec::new(), version: None }; |
@@ -641,15 +640,17 @@ fn on_notification( | |||
641 | }; | 640 | }; |
642 | let not = match notification_cast::<req::DidChangeConfiguration>(not) { | 641 | let not = match notification_cast::<req::DidChangeConfiguration>(not) { |
643 | Ok(_params) => { | 642 | Ok(_params) => { |
644 | dbg!(_params); | 643 | let request_id = loop_state.next_request_id(); |
645 | // let request = request_new::<req::WorkspaceConfiguration>( | 644 | let request = request_new::<req::WorkspaceConfiguration>( |
646 | // loop_state.next_request_id(), | 645 | request_id.clone(), |
647 | // ConfigurationParams::default(), | 646 | ConfigurationParams::default(), |
648 | // ); | 647 | ); |
649 | // let zz = connection.sender.send(request.into()).unwrap(); | 648 | msg_sender.send(request.into()).unwrap(); |
649 | loop_state.configuration_request_id.replace(request_id); | ||
650 | |||
650 | return Ok(()); | 651 | return Ok(()); |
651 | } | 652 | } |
652 | Err(not) => dbg!(not), | 653 | Err(not) => not, |
653 | }; | 654 | }; |
654 | let not = match notification_cast::<req::DidChangeWatchedFiles>(not) { | 655 | let not = match notification_cast::<req::DidChangeWatchedFiles>(not) { |
655 | Ok(params) => { | 656 | Ok(params) => { |
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index e77462c1b..501997fef 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts | |||
@@ -12,9 +12,9 @@ export class Config { | |||
12 | private readonly requiresReloadOpts = [ | 12 | private readonly requiresReloadOpts = [ |
13 | "serverPath", | 13 | "serverPath", |
14 | "cargoFeatures", | 14 | "cargoFeatures", |
15 | "cargo-watch", | 15 | "excludeGlobs", |
16 | "highlighting.semanticTokens", | 16 | "useClientWatching", |
17 | "inlayHints", | 17 | "highlighting", |
18 | "updates.channel", | 18 | "updates.channel", |
19 | ] | 19 | ] |
20 | .map(opt => `${this.rootSection}.${opt}`); | 20 | .map(opt => `${this.rootSection}.${opt}`); |