Skip to content

Commit 5c79bc8

Browse files
committed
Fix: Overwrite cached diagnostics to correctly update any subsequent diagnostics
1 parent 8917ae3 commit 5c79bc8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

vhdl_ls/src/vhdl_server/diagnostics.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl VHDLServer {
2626

2727
let mut by_uri = diagnostics_by_uri(diagnostics);
2828
for (file_uri, cached_diagnostics) in self.diagnostic_cache.iter_mut() {
29-
let Some(new_diagnostics) = by_uri.remove(file_uri) else {
29+
let Some(mut new_diagnostics) = by_uri.remove(file_uri) else {
3030
// Diagnostics are in the cache, but not in the newly created diagnostics.
3131
// This means that there are no longer any diagnostics in the given file.
3232
// As a consequence, the client needs to be updated
@@ -54,6 +54,8 @@ impl VHDLServer {
5454
};
5555
self.rpc
5656
.send_notification("textDocument/publishDiagnostics", publish_diagnostics);
57+
cached_diagnostics.clear();
58+
cached_diagnostics.append(&mut new_diagnostics);
5759
}
5860
// else: diagnostics are the same in the cache and the new analysis state.
5961
// No need to update.

0 commit comments

Comments
 (0)