on master help sign in
discard outdated diagnostics recived by the LS
3c9d5d0Pascal Kuthe
helix-lsp/src/client.rs+1
@@ -387,6 +387,7 @@ impl Client {
387 ..Default::default()
387 ..Default::default()
388 }),
388 }),
389 publish_diagnostics: Some(lsp::PublishDiagnosticsClientCapabilities {
389 publish_diagnostics: Some(lsp::PublishDiagnosticsClientCapabilities {
390+ version_support: Some(true),
390 ..Default::default()
391 ..Default::default()
391 }),
392 }),
392 inlay_hint: Some(lsp::InlayHintClientCapabilities {
393 inlay_hint: Some(lsp::InlayHintClientCapabilities {
helix-term/src/application.rs+10−1
@@ -709,7 +709,16 @@ impl Application {
709 return;
709 return;
710 }
710 }
711 };
711 };
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+ });
713
722
714 if let Some(doc) = doc {
723 if let Some(doc) = doc {
715 let lang_conf = doc.language_config();
724 let lang_conf = doc.language_config();