mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-16 14:07:04 +00:00
Do not erase Cargo diagnostics from the closed documents
This commit is contained in:
parent
2e52d6ea93
commit
8ed9724413
@ -633,11 +633,9 @@ impl GlobalState {
|
||||
Ok(())
|
||||
})?
|
||||
.on::<lsp_types::notification::DidCloseTextDocument>(|this, params| {
|
||||
let mut version = None;
|
||||
if let Ok(path) = from_proto::vfs_path(¶ms.text_document.uri) {
|
||||
match this.mem_docs.remove(&path) {
|
||||
Some(doc) => version = Some(doc.version),
|
||||
None => log::error!("orphan DidCloseTextDocument: {}", path),
|
||||
if this.mem_docs.remove(&path).is_none() {
|
||||
log::error!("orphan DidCloseTextDocument: {}", path);
|
||||
}
|
||||
|
||||
this.semantic_tokens_cache.lock().remove(¶ms.text_document.uri);
|
||||
@ -646,17 +644,6 @@ impl GlobalState {
|
||||
this.loader.handle.invalidate(path.to_path_buf());
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the diagnostics for the previously known version of the file.
|
||||
// This prevents stale "cargo check" diagnostics if the file is
|
||||
// closed, "cargo check" is run and then the file is reopened.
|
||||
this.send_notification::<lsp_types::notification::PublishDiagnostics>(
|
||||
lsp_types::PublishDiagnosticsParams {
|
||||
uri: params.text_document.uri,
|
||||
diagnostics: Vec::new(),
|
||||
version,
|
||||
},
|
||||
);
|
||||
Ok(())
|
||||
})?
|
||||
.on::<lsp_types::notification::DidSaveTextDocument>(|this, params| {
|
||||
|
Loading…
Reference in New Issue
Block a user