diff options
author | Aleksey Kladov <aleksey.kladov@gmail.com> | 2020-06-13 10:00:06 +0100 |
---|---|---|
committer | Aleksey Kladov <aleksey.kladov@gmail.com> | 2020-06-13 13:15:38 +0100 |
commit | 50bbf7233dcda8a27255f123622bf57651c9f51c (patch) | |
tree | 183d011ed6a2f5fc5917d7bcd2763e7896a47a4f /crates/rust-analyzer/src/main_loop.rs | |
parent | b56ad148db0c69eb279c225f45d324b4e80e7367 (diff) |
Cleanup URL handling
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 | } |