aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer/src/main_loop.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-06-13 13:35:44 +0100
committerGitHub <[email protected]>2020-06-13 13:35:44 +0100
commit246c66a7f7fd3f85d7d6e47a36f17bafb0ccb08a (patch)
tree106b31324ba619413a055a36bd61621b4ac1531a /crates/rust-analyzer/src/main_loop.rs
parentd64b583e5a67e15db7151a7877871174655729a4 (diff)
parent50bbf7233dcda8a27255f123622bf57651c9f51c (diff)
Merge #4867
4867: Cleanup URL handling 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.rs18
1 files changed, 5 insertions, 13 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 752dbf145..8ec571b70 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -27,7 +27,7 @@ use ra_flycheck::{CheckTask, Status};
27use ra_ide::{Canceled, FileId, LibraryData, LineIndex, SourceRootId}; 27use ra_ide::{Canceled, FileId, LibraryData, LineIndex, SourceRootId};
28use ra_prof::profile; 28use ra_prof::profile;
29use ra_project_model::{PackageRoot, ProjectWorkspace}; 29use ra_project_model::{PackageRoot, ProjectWorkspace};
30use ra_vfs::{VfsFile, VfsTask, Watch}; 30use ra_vfs::{VfsTask, Watch};
31use relative_path::RelativePathBuf; 31use relative_path::RelativePathBuf;
32use rustc_hash::FxHashSet; 32use rustc_hash::FxHashSet;
33use serde::{de::DeserializeOwned, Serialize}; 33use serde::{de::DeserializeOwned, Serialize};
@@ -35,9 +35,9 @@ use threadpool::ThreadPool;
35 35
36use crate::{ 36use crate::{
37 config::{Config, FilesWatcher, LinkedProject}, 37 config::{Config, FilesWatcher, LinkedProject},
38 diagnostics::{to_proto::url_from_path_with_drive_lowercasing, DiagnosticTask}, 38 diagnostics::DiagnosticTask,
39 from_proto, 39 from_proto,
40 global_state::{GlobalState, GlobalStateSnapshot}, 40 global_state::{file_id_to_url, GlobalState, GlobalStateSnapshot},
41 lsp_ext, 41 lsp_ext,
42 main_loop::{ 42 main_loop::{
43 pending_requests::{PendingRequest, PendingRequests}, 43 pending_requests::{PendingRequest, PendingRequests},
@@ -801,17 +801,9 @@ fn on_diagnostic_task(task: DiagnosticTask, msg_sender: &Sender<Message>, state:
801 let subscriptions = state.diagnostics.handle_task(task); 801 let subscriptions = state.diagnostics.handle_task(task);
802 802
803 for file_id in subscriptions { 803 for file_id in subscriptions {
804 let path = state.vfs.read().file2path(VfsFile(file_id.0)); 804 let url = file_id_to_url(&state.vfs.read(), file_id);
805 let uri = match url_from_path_with_drive_lowercasing(&path) {
806 Ok(uri) => uri,
807 Err(err) => {
808 log::error!("Couldn't convert path to url ({}): {}", err, path.display());
809 continue;
810 }
811 };
812
813 let diagnostics = state.diagnostics.diagnostics_for(file_id).cloned().collect(); 805 let diagnostics = state.diagnostics.diagnostics_for(file_id).cloned().collect();
814 let params = lsp_types::PublishDiagnosticsParams { uri, diagnostics, version: None }; 806 let params = lsp_types::PublishDiagnosticsParams { uri: url, diagnostics, version: None };
815 let not = notification_new::<lsp_types::notification::PublishDiagnostics>(params); 807 let not = notification_new::<lsp_types::notification::PublishDiagnostics>(params);
816 msg_sender.send(not.into()).unwrap(); 808 msg_sender.send(not.into()).unwrap();
817 } 809 }