aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer/src/main_loop.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-06-26 11:02:59 +0100
committerAleksey Kladov <[email protected]>2020-06-26 11:06:08 +0100
commit12831b74af457ddfc06ebeb929e350574e2f35d5 (patch)
treec3df9665d7b6e84389d5b1f45413b45c1fc99bb1 /crates/rust-analyzer/src/main_loop.rs
parentb039f0d1baa34b7d53117085438769cc3402e112 (diff)
Cleanup
Diffstat (limited to 'crates/rust-analyzer/src/main_loop.rs')
-rw-r--r--crates/rust-analyzer/src/main_loop.rs20
1 files changed, 9 insertions, 11 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 162c0057e..8fc816cbd 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -16,7 +16,7 @@ use crate::{
16 config::Config, 16 config::Config,
17 dispatch::{NotificationDispatcher, RequestDispatcher}, 17 dispatch::{NotificationDispatcher, RequestDispatcher},
18 from_proto, 18 from_proto,
19 global_state::{file_id_to_url, GlobalState, Status}, 19 global_state::{file_id_to_url, url_to_file_id, GlobalState, Status},
20 handlers, lsp_ext, 20 handlers, lsp_ext,
21 lsp_utils::{apply_document_changes, is_canceled, notification_is, notification_new}, 21 lsp_utils::{apply_document_changes, is_canceled, notification_is, notification_new},
22 Result, 22 Result,
@@ -200,18 +200,16 @@ impl GlobalState {
200 &workspace_root, 200 &workspace_root,
201 ); 201 );
202 for diag in diagnostics { 202 for diag in diagnostics {
203 let path = from_proto::vfs_path(&diag.location.uri)?; 203 match url_to_file_id(&self.vfs.read().0, &diag.location.uri) {
204 let file_id = match self.vfs.read().0.file_id(&path) { 204 Ok(file_id) => self.diagnostics.add_check_diagnostic(
205 Some(file) => FileId(file.0), 205 file_id,
206 None => { 206 diag.diagnostic,
207 log::error!( 207 diag.fixes,
208 "File with cargo diagnostic not found in VFS: {}", 208 ),
209 path 209 Err(err) => {
210 ); 210 log::error!("File with cargo diagnostic not found in VFS: {}", err);
211 return Ok(());
212 } 211 }
213 }; 212 };
214 self.diagnostics.add_check_diagnostic(file_id, diag.diagnostic, diag.fixes)
215 } 213 }
216 } 214 }
217 215