We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 1479dd6 + 137a878 commit 4d0d113Copy full SHA for 4d0d113
crates/ra_lsp_server/src/main_loop.rs
@@ -635,12 +635,13 @@ fn on_check_task(
635
636
CheckTask::AddDiagnostic { url, diagnostic, fixes } => {
637
let path = url.to_file_path().map_err(|()| format!("invalid uri: {}", url))?;
638
- let file_id = world_state
639
- .vfs
640
- .read()
641
- .path2file(&path)
642
- .map(|it| FileId(it.0))
643
- .ok_or_else(|| format!("unknown file: {}", path.to_string_lossy()))?;
+ let file_id = match world_state.vfs.read().path2file(&path) {
+ Some(file) => FileId(file.0),
+ None => {
+ log::error!("File with cargo diagnostic not found in VFS: {}", path.display());
+ return Ok(());
+ }
644
+ };
645
646
task_sender
647
.send(Task::Diagnostic(DiagnosticTask::AddCheck(file_id, diagnostic, fixes)))?;
0 commit comments