on master help sign in
discard outdated diagnostics recived by the LS
commit3c9d5d02153ca2d81e2780e1f6daeefc40de2706 authorPascal Kuthe <pascal.kuthe@semimod.de> dateSun 12 Mar 2023, 01:00 (4 years ago) parent2a27d1b
2 files changed+11−1
helix-lsp/src/client.rs+1 helix-term/src/application.rs+10−1
helix-lsp/src/client.rs+1
@@ -387,6 +387,7 @@ impl Client {
387387 ..Default::default()
388388 }),
389389 publish_diagnostics: Some(lsp::PublishDiagnosticsClientCapabilities {
390+ version_support: Some(true),
390391 ..Default::default()
391392 }),
392393 inlay_hint: Some(lsp::InlayHintClientCapabilities {
helix-term/src/application.rs+10−1
@@ -709,7 +709,16 @@ impl Application {
709709 return;
710710 }
711711 };
712− let doc = self.editor.document_by_path_mut(&path);
712+ let doc = self.editor.document_by_path_mut(&path).filter(|doc| {
713+ if let Some(version) = params.version {
714+ if version != doc.version() {
715+ log::info!("Version ({version}) is out of date for {path:?} (expected ({}), dropping PublishDiagnostic notification", doc.version());
716+ return false;
717+ }
718+ }
719+
720+ true
721+ });
713722
714723 if let Some(doc) = doc {
715724 let lang_conf = doc.language_config();