aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-11-24 00:41:08 +0000
committerGitHub <[email protected]>2020-11-24 00:41:08 +0000
commit2ff78cde31cb4f5a4e05ef51dc9347838f790898 (patch)
treee0e4b975cb2bb88873f143725d995eb899f80bcc
parent036ea6317c7e0a48acafcdcf8ece3a4816fa4036 (diff)
parent117c793e80f3b8a41b045cfa5d320ef157f2446c (diff)
Merge #6613
6613: Don't assume DidChangeTextDocument paths exist r=SomeoneToIgnore a=mjibson Fixes #5933 Co-authored-by: Matt Jibson <[email protected]>
-rw-r--r--crates/rust-analyzer/src/main_loop.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 6ea08adce..b34ff092d 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -503,7 +503,13 @@ impl GlobalState {
503 })? 503 })?
504 .on::<lsp_types::notification::DidChangeTextDocument>(|this, params| { 504 .on::<lsp_types::notification::DidChangeTextDocument>(|this, params| {
505 if let Ok(path) = from_proto::vfs_path(&params.text_document.uri) { 505 if let Ok(path) = from_proto::vfs_path(&params.text_document.uri) {
506 let doc = this.mem_docs.get_mut(&path).unwrap(); 506 let doc = match this.mem_docs.get_mut(&path) {
507 Some(doc) => doc,
508 None => {
509 log::error!("expected DidChangeTextDocument: {}", path);
510 return Ok(());
511 }
512 };
507 let vfs = &mut this.vfs.write().0; 513 let vfs = &mut this.vfs.write().0;
508 let file_id = vfs.file_id(&path).unwrap(); 514 let file_id = vfs.file_id(&path).unwrap();
509 let mut text = String::from_utf8(vfs.file_contents(file_id).to_vec()).unwrap(); 515 let mut text = String::from_utf8(vfs.file_contents(file_id).to_vec()).unwrap();