diff options
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop.rs | 16 |
1 files changed, 10 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..fcae37bb7 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs | |||
@@ -635,12 +635,16 @@ 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!( |
642 | .map(|it| FileId(it.0)) | 642 | "File with cargo diagnostic not found in VFS: {}", |
643 | .ok_or_else(|| format!("unknown file: {}", path.to_string_lossy()))?; | 643 | path.to_string_lossy() |
644 | ); | ||
645 | return Ok(()); | ||
646 | } | ||
647 | }; | ||
644 | 648 | ||
645 | task_sender | 649 | task_sender |
646 | .send(Task::Diagnostic(DiagnosticTask::AddCheck(file_id, diagnostic, fixes)))?; | 650 | .send(Task::Diagnostic(DiagnosticTask::AddCheck(file_id, diagnostic, fixes)))?; |