diff options
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 12961ba37..ceff82fda 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs | |||
@@ -635,12 +635,13 @@ fn on_check_task( | |||
635 | 635 | ||
636 | CheckTask::AddDiagnostic { url, diagnostic, fixes } => { | 636 | CheckTask::AddDiagnostic { url, diagnostic, fixes } => { |
637 | let path = url.to_file_path().map_err(|()| format!("invalid uri: {}", url))?; | 637 | let path = url.to_file_path().map_err(|()| format!("invalid uri: {}", url))?; |
638 | let file_id = world_state | 638 | let file_id = match world_state.vfs.read().path2file(&path) { |
639 | .vfs | 639 | Some(file) => FileId(file.0), |
640 | .read() | 640 | None => { |
641 | .path2file(&path) | 641 | log::error!("File with cargo diagnostic not found in VFS: {}", path.display()); |
642 | .map(|it| FileId(it.0)) | 642 | return Ok(()); |
643 | .ok_or_else(|| format!("unknown file: {}", path.to_string_lossy()))?; | 643 | } |
644 | }; | ||
644 | 645 | ||
645 | task_sender | 646 | task_sender |
646 | .send(Task::Diagnostic(DiagnosticTask::AddCheck(file_id, diagnostic, fixes)))?; | 647 | .send(Task::Diagnostic(DiagnosticTask::AddCheck(file_id, diagnostic, fixes)))?; |