diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 8 |
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(¶ms.text_document.uri) { | 505 | if let Ok(path) = from_proto::vfs_path(¶ms.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(); |