Skip to content

Commit

Permalink
Clear diagnostics when recycling build logs
Browse files Browse the repository at this point in the history
  • Loading branch information
pfoerster committed Nov 1, 2023
1 parent 3cdd71c commit a67d340
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `texlab.inlayHints.labelDefinitions` and `texlab.inlayHints.labelReferences` options ([#753](https://github.com/latex-lsp/texlab/issues/753))
- Display inlay hints for label references by default ([#753](https://github.com/latex-lsp/texlab/issues/753))

### Fixed

- Moving the build logs to the recycle bin will now clear the diagnostics ([texlab-vscode/#825](https://github.com/latex-lsp/texlab-vscode/issues/825))

## [5.10.1] - 2023-10-10

### Fixed
Expand Down
23 changes: 12 additions & 11 deletions crates/texlab/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use diagnostics::{DiagnosticManager, DiagnosticSource};
use distro::{Distro, Language};
use lsp_server::{Connection, ErrorCode, Message, RequestId};
use lsp_types::{notification::*, request::*, *};
use notify::event::ModifyKind;
use notify_debouncer_full::{DebouncedEvent, Debouncer, FileIdMap};
use parking_lot::{Mutex, RwLock};
use rowan::ast::AstNode;
Expand Down Expand Up @@ -878,6 +879,17 @@ impl Server {

let mut workspace = self.workspace.write();
match event.kind {
notify::EventKind::Remove(_) | notify::EventKind::Modify(ModifyKind::Name(_)) => {
for path in event.paths {
if let Some(document) = workspace.lookup_path(&path) {
if document.owner == Owner::Server {
let uri = document.uri.clone();
workspace.remove(&uri);
changed = true;
}
}
}
}
notify::EventKind::Create(_) | notify::EventKind::Modify(_) => {
for path in event.paths {
if workspace
Expand All @@ -894,17 +906,6 @@ impl Server {
}
}
}
notify::EventKind::Remove(_) => {
for path in event.paths {
if let Some(document) = workspace.lookup_path(&path) {
if document.owner == Owner::Server {
let uri = document.uri.clone();
workspace.remove(&uri);
changed = true;
}
}
}
}
notify::EventKind::Any | notify::EventKind::Access(_) | notify::EventKind::Other => {}
};

Expand Down

0 comments on commit a67d340

Please sign in to comment.