discard outdated diagnostics recived by the LS

pull/2883/head
Pascal Kuthe 2 years ago committed by Blaž Hrastnik
parent 2a27d1b505
commit 3c9d5d0215

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

@ -709,7 +709,16 @@ impl Application {
return; 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 { if let Some(doc) = doc {
let lang_conf = doc.language_config(); let lang_conf = doc.language_config();

Loading…
Cancel
Save