diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-06 12:40:34 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-06 12:40:34 +0000 |
commit | 66c575659e17035a747d3e4e10bcf4f3669a7143 (patch) | |
tree | 55a3d19d015d13c7507d8ea7ea5f80ce0e2d7df2 /crates/rust-analyzer/src/main_loop.rs | |
parent | bb56c55c4e02f159605d55cbfd8586ccf93674c7 (diff) | |
parent | f7a15b5cd1df58e46066bbd27c90cb1ad7f9c316 (diff) |
Merge #7172
7172: refactor config to be lossless & precise r=matklad a=matklad
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 | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 8eca79f7e..53f9546b8 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -99,7 +99,8 @@ impl fmt::Debug for Event { | |||
99 | 99 | ||
100 | impl GlobalState { | 100 | impl GlobalState { |
101 | fn run(mut self, inbox: Receiver<lsp_server::Message>) -> Result<()> { | 101 | fn run(mut self, inbox: Receiver<lsp_server::Message>) -> Result<()> { |
102 | if self.config.linked_projects.is_empty() && self.config.notifications.cargo_toml_not_found | 102 | if self.config.linked_projects().is_empty() |
103 | && self.config.notifications().cargo_toml_not_found | ||
103 | { | 104 | { |
104 | self.show_message( | 105 | self.show_message( |
105 | lsp_types::MessageType::Error, | 106 | lsp_types::MessageType::Error, |
@@ -296,7 +297,7 @@ impl GlobalState { | |||
296 | flycheck::Message::AddDiagnostic { workspace_root, diagnostic } => { | 297 | flycheck::Message::AddDiagnostic { workspace_root, diagnostic } => { |
297 | let diagnostics = | 298 | let diagnostics = |
298 | crate::diagnostics::to_proto::map_rust_diagnostic_to_lsp( | 299 | crate::diagnostics::to_proto::map_rust_diagnostic_to_lsp( |
299 | &self.config.diagnostics_map, | 300 | &self.config.diagnostics_map(), |
300 | &diagnostic, | 301 | &diagnostic, |
301 | &workspace_root, | 302 | &workspace_root, |
302 | ); | 303 | ); |
@@ -365,13 +366,13 @@ impl GlobalState { | |||
365 | self.update_file_notifications_on_threadpool(); | 366 | self.update_file_notifications_on_threadpool(); |
366 | 367 | ||
367 | // Refresh semantic tokens if the client supports it. | 368 | // Refresh semantic tokens if the client supports it. |
368 | if self.config.semantic_tokens_refresh { | 369 | if self.config.semantic_tokens_refresh() { |
369 | self.semantic_tokens_cache.lock().clear(); | 370 | self.semantic_tokens_cache.lock().clear(); |
370 | self.send_request::<lsp_types::request::SemanticTokensRefesh>((), |_, _| ()); | 371 | self.send_request::<lsp_types::request::SemanticTokensRefesh>((), |_, _| ()); |
371 | } | 372 | } |
372 | 373 | ||
373 | // Refresh code lens if the client supports it. | 374 | // Refresh code lens if the client supports it. |
374 | if self.config.code_lens_refresh { | 375 | if self.config.code_lens_refresh() { |
375 | self.send_request::<lsp_types::request::CodeLensRefresh>((), |_, _| ()); | 376 | self.send_request::<lsp_types::request::CodeLensRefresh>((), |_, _| ()); |
376 | } | 377 | } |
377 | } | 378 | } |
@@ -658,7 +659,7 @@ impl GlobalState { | |||
658 | .collect::<Vec<_>>(); | 659 | .collect::<Vec<_>>(); |
659 | 660 | ||
660 | log::trace!("updating notifications for {:?}", subscriptions); | 661 | log::trace!("updating notifications for {:?}", subscriptions); |
661 | if self.config.publish_diagnostics { | 662 | if self.config.publish_diagnostics() { |
662 | let snapshot = self.snapshot(); | 663 | let snapshot = self.snapshot(); |
663 | self.task_pool.handle.spawn(move || { | 664 | self.task_pool.handle.spawn(move || { |
664 | let diagnostics = subscriptions | 665 | let diagnostics = subscriptions |