Skip to content

Commit

Permalink
discard outdated diagnostics recived by the LS
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalkuthe authored and archseer committed Mar 16, 2023
1 parent 2a27d1b commit 3c9d5d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions helix-lsp/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ impl Client {
..Default::default()
}),
publish_diagnostics: Some(lsp::PublishDiagnosticsClientCapabilities {
version_support: Some(true),
..Default::default()
}),
inlay_hint: Some(lsp::InlayHintClientCapabilities {
Expand Down
11 changes: 10 additions & 1 deletion helix-term/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,16 @@ impl Application {
return;
}
};
let doc = self.editor.document_by_path_mut(&path);
let doc = self.editor.document_by_path_mut(&path).filter(|doc| {
if let Some(version) = params.version {
if version != doc.version() {
log::info!("Version ({version}) is out of date for {path:?} (expected ({}), dropping PublishDiagnostic notification", doc.version());
return false;
}
}

true
});

if let Some(doc) = doc {
let lang_conf = doc.language_config();
Expand Down

0 comments on commit 3c9d5d0

Please sign in to comment.