diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-02 13:05:46 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-02 13:05:46 +0100 |
commit | 3c9e9d3f3ebbc7a22d932dd2a3fd63f1e44c4568 (patch) | |
tree | 0dbb6b8c37601a7d0c617a1d88a342b8f4c97a32 /crates/rust-analyzer/src/main_loop.rs | |
parent | 9ee96dcf4a2b47a6df0e3ea379d36aec2e6e1784 (diff) | |
parent | 7a4ebd2c8dfee8ca15dab7ba053a6521840aa5e3 (diff) |
Merge #3824
3824: New config names r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/rust-analyzer/src/main_loop.rs')
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 47fef59d4..95e676e0f 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -30,7 +30,7 @@ use serde::{de::DeserializeOwned, Serialize}; | |||
30 | use threadpool::ThreadPool; | 30 | use threadpool::ThreadPool; |
31 | 31 | ||
32 | use crate::{ | 32 | use crate::{ |
33 | config::Config, | 33 | config::{Config, FilesWatcher}, |
34 | diagnostics::DiagnosticTask, | 34 | diagnostics::DiagnosticTask, |
35 | main_loop::{ | 35 | main_loop::{ |
36 | pending_requests::{PendingRequest, PendingRequests}, | 36 | pending_requests::{PendingRequest, PendingRequests}, |
@@ -40,7 +40,6 @@ use crate::{ | |||
40 | world::{WorldSnapshot, WorldState}, | 40 | world::{WorldSnapshot, WorldState}, |
41 | Result, | 41 | Result, |
42 | }; | 42 | }; |
43 | use req::ConfigurationParams; | ||
44 | 43 | ||
45 | #[derive(Debug)] | 44 | #[derive(Debug)] |
46 | pub struct LspError { | 45 | pub struct LspError { |
@@ -122,12 +121,13 @@ pub fn main_loop(ws_roots: Vec<PathBuf>, config: Config, connection: Connection) | |||
122 | }; | 121 | }; |
123 | 122 | ||
124 | let globs = config | 123 | let globs = config |
125 | .exclude_globs | 124 | .files |
125 | .exclude | ||
126 | .iter() | 126 | .iter() |
127 | .map(|glob| crate::vfs_glob::Glob::new(glob)) | 127 | .map(|glob| crate::vfs_glob::Glob::new(glob)) |
128 | .collect::<std::result::Result<Vec<_>, _>>()?; | 128 | .collect::<std::result::Result<Vec<_>, _>>()?; |
129 | 129 | ||
130 | if config.use_client_watching { | 130 | if let FilesWatcher::Client = config.files.watcher { |
131 | let registration_options = req::DidChangeWatchedFilesRegistrationOptions { | 131 | let registration_options = req::DidChangeWatchedFilesRegistrationOptions { |
132 | watchers: workspaces | 132 | watchers: workspaces |
133 | .iter() | 133 | .iter() |
@@ -153,7 +153,7 @@ pub fn main_loop(ws_roots: Vec<PathBuf>, config: Config, connection: Connection) | |||
153 | workspaces, | 153 | workspaces, |
154 | config.lru_capacity, | 154 | config.lru_capacity, |
155 | &globs, | 155 | &globs, |
156 | Watch(!config.use_client_watching), | 156 | Watch(matches!(config.files.watcher, FilesWatcher::Notify)), |
157 | config, | 157 | config, |
158 | ) | 158 | ) |
159 | }; | 159 | }; |
@@ -607,7 +607,12 @@ fn on_notification( | |||
607 | let request_id = loop_state.next_request_id(); | 607 | let request_id = loop_state.next_request_id(); |
608 | let request = request_new::<req::WorkspaceConfiguration>( | 608 | let request = request_new::<req::WorkspaceConfiguration>( |
609 | request_id.clone(), | 609 | request_id.clone(), |
610 | ConfigurationParams::default(), | 610 | req::ConfigurationParams { |
611 | items: vec![req::ConfigurationItem { | ||
612 | scope_uri: None, | ||
613 | section: Some("rust-analyzer".to_string()), | ||
614 | }], | ||
615 | }, | ||
611 | ); | 616 | ); |
612 | msg_sender.send(request.into())?; | 617 | msg_sender.send(request.into())?; |
613 | loop_state.configuration_request_id = Some(request_id); | 618 | loop_state.configuration_request_id = Some(request_id); |
@@ -884,10 +889,9 @@ fn update_file_notifications_on_threadpool( | |||
884 | subscriptions: Vec<FileId>, | 889 | subscriptions: Vec<FileId>, |
885 | ) { | 890 | ) { |
886 | log::trace!("updating notifications for {:?}", subscriptions); | 891 | log::trace!("updating notifications for {:?}", subscriptions); |
887 | let publish_diagnostics = world.config.publish_diagnostics; | 892 | if world.config.publish_diagnostics { |
888 | pool.execute(move || { | 893 | pool.execute(move || { |
889 | for file_id in subscriptions { | 894 | for file_id in subscriptions { |
890 | if publish_diagnostics { | ||
891 | match handlers::publish_diagnostics(&world, file_id) { | 895 | match handlers::publish_diagnostics(&world, file_id) { |
892 | Err(e) => { | 896 | Err(e) => { |
893 | if !is_canceled(&e) { | 897 | if !is_canceled(&e) { |
@@ -899,8 +903,8 @@ fn update_file_notifications_on_threadpool( | |||
899 | } | 903 | } |
900 | } | 904 | } |
901 | } | 905 | } |
902 | } | 906 | }) |
903 | }); | 907 | } |
904 | } | 908 | } |
905 | 909 | ||
906 | pub fn show_message(typ: req::MessageType, message: impl Into<String>, sender: &Sender<Message>) { | 910 | pub fn show_message(typ: req::MessageType, message: impl Into<String>, sender: &Sender<Message>) { |