diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-06-13 13:35:44 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-13 13:35:44 +0100 |
commit | 246c66a7f7fd3f85d7d6e47a36f17bafb0ccb08a (patch) | |
tree | 106b31324ba619413a055a36bd61621b4ac1531a /crates/rust-analyzer/src/main_loop.rs | |
parent | d64b583e5a67e15db7151a7877871174655729a4 (diff) | |
parent | 50bbf7233dcda8a27255f123622bf57651c9f51c (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.rs | 18 |
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}; | |||
27 | use ra_ide::{Canceled, FileId, LibraryData, LineIndex, SourceRootId}; | 27 | use ra_ide::{Canceled, FileId, LibraryData, LineIndex, SourceRootId}; |
28 | use ra_prof::profile; | 28 | use ra_prof::profile; |
29 | use ra_project_model::{PackageRoot, ProjectWorkspace}; | 29 | use ra_project_model::{PackageRoot, ProjectWorkspace}; |
30 | use ra_vfs::{VfsFile, VfsTask, Watch}; | 30 | use ra_vfs::{VfsTask, Watch}; |
31 | use relative_path::RelativePathBuf; | 31 | use relative_path::RelativePathBuf; |
32 | use rustc_hash::FxHashSet; | 32 | use rustc_hash::FxHashSet; |
33 | use serde::{de::DeserializeOwned, Serialize}; | 33 | use serde::{de::DeserializeOwned, Serialize}; |
@@ -35,9 +35,9 @@ use threadpool::ThreadPool; | |||
35 | 35 | ||
36 | use crate::{ | 36 | use 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 | } |