aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-02-07 11:41:25 +0000
committerGitHub <[email protected]>2020-02-07 11:41:25 +0000
commit4d0d113c7d17483f3a6e0d09db7cc0cb5ed145c4 (patch)
tree7451de0b1195b90c6c74be4a1acb477591f4dc94 /crates/ra_lsp_server/src
parent1479dd6f2df1eecdd432cf72c91c4ee988b54c77 (diff)
parent137a878461662b7bf7f1acf3855b166c1c19fc2f (diff)
Merge #3044
3044: Don't crash when recieving unkown file for cargo diagnostic. r=matklad a=kiljacken Fixes #3014 Co-authored-by: Emil Lauridsen <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r--crates/ra_lsp_server/src/main_loop.rs13
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)))?;