From 14a3a713c74108626fe356dad21d93b84792878a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 24 Jul 2020 16:28:19 +0200 Subject: Revert "Merge #5516" This reverts commit 5b13c2411f025a16495f5828afe2def6e9220102, reversing changes made to c3defe2532ba6ffd12a13bcbc8fdeda037665efc. --- crates/rust-analyzer/src/config.rs | 8 ----- crates/rust-analyzer/src/main_loop.rs | 67 +++++++++++++++++------------------ 2 files changed, 32 insertions(+), 43 deletions(-) (limited to 'crates') diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index ad62571ef..8947ccf07 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -128,7 +128,6 @@ pub struct ClientCapsConfig { pub hover_actions: bool, pub status_notification: bool, pub signature_help_label_offsets: bool, - pub dynamic_watched_files: bool, } impl Config { @@ -291,13 +290,6 @@ impl Config { } pub fn update_caps(&mut self, caps: &ClientCapabilities) { - if let Some(ws_caps) = caps.workspace.as_ref() { - if let Some(did_change_watched_files) = ws_caps.did_change_watched_files.as_ref() { - self.client_caps.dynamic_watched_files = - did_change_watched_files.dynamic_registration.unwrap_or(false); - } - } - if let Some(doc_caps) = caps.text_document.as_ref() { if let Some(value) = doc_caps.definition.as_ref().and_then(|it| it.link_support) { self.client_caps.location_link = value; diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index b44fd9eb4..e95d4157c 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -106,41 +106,38 @@ impl GlobalState { ); }; - if self.config.client_caps.dynamic_watched_files { - let save_registration_options = lsp_types::TextDocumentSaveRegistrationOptions { - include_text: Some(false), - text_document_registration_options: lsp_types::TextDocumentRegistrationOptions { - document_selector: Some(vec![ - lsp_types::DocumentFilter { - language: None, - scheme: None, - pattern: Some("**/*.rs".into()), - }, - lsp_types::DocumentFilter { - language: None, - scheme: None, - pattern: Some("**/Cargo.toml".into()), - }, - lsp_types::DocumentFilter { - language: None, - scheme: None, - pattern: Some("**/Cargo.lock".into()), - }, - ]), - }, - }; - - let registration = lsp_types::Registration { - id: "textDocument/didSave".to_string(), - method: "textDocument/didSave".to_string(), - register_options: Some(serde_json::to_value(save_registration_options).unwrap()), - }; - - self.send_request::( - lsp_types::RegistrationParams { registrations: vec![registration] }, - |_, _| (), - ); - } + let save_registration_options = lsp_types::TextDocumentSaveRegistrationOptions { + include_text: Some(false), + text_document_registration_options: lsp_types::TextDocumentRegistrationOptions { + document_selector: Some(vec![ + lsp_types::DocumentFilter { + language: None, + scheme: None, + pattern: Some("**/*.rs".into()), + }, + lsp_types::DocumentFilter { + language: None, + scheme: None, + pattern: Some("**/Cargo.toml".into()), + }, + lsp_types::DocumentFilter { + language: None, + scheme: None, + pattern: Some("**/Cargo.lock".into()), + }, + ]), + }, + }; + + let registration = lsp_types::Registration { + id: "textDocument/didSave".to_string(), + method: "textDocument/didSave".to_string(), + register_options: Some(serde_json::to_value(save_registration_options).unwrap()), + }; + self.send_request::( + lsp_types::RegistrationParams { registrations: vec![registration] }, + |_, _| (), + ); self.fetch_workspaces(); -- cgit v1.2.3