1
0
mirror of https://github.com/helix-editor/helix synced 2024-11-10 10:34:45 +01:00

discard outdated diagnostics recived by the LS

This commit is contained in:
Pascal Kuthe 2023-03-12 01:00:24 +01:00 committed by Blaž Hrastnik
parent 2a27d1b505
commit 3c9d5d0215
2 changed files with 11 additions and 1 deletions

@ -387,6 +387,7 @@ impl Client {
..Default::default()
}),
publish_diagnostics: Some(lsp::PublishDiagnosticsClientCapabilities {
version_support: Some(true),
..Default::default()
}),
inlay_hint: Some(lsp::InlayHintClientCapabilities {

@ -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();