on master help sign in
LSP: Discard publishDiagnostic from uninitialized servers (#7467)
d3f8e05Michael Davis
helix-term/src/application.rs+6−1
@@ -746,7 +746,12 @@ impl Application {
746 return;
746 return;
747 }
747 }
748 };
748 };
749− let offset_encoding = language_server!().offset_encoding();
749+ let language_server = language_server!();
750+ if !language_server.is_initialized() {
751+ log::error!("Discarding publishDiagnostic notification sent by an uninitialized server: {}", language_server.name());
752+ return;
753+ }
754+ let offset_encoding = language_server.offset_encoding();
750 let doc = self.editor.document_by_path_mut(&path).filter(|doc| {
755 let doc = self.editor.document_by_path_mut(&path).filter(|doc| {
751 if let Some(version) = params.version {
756 if let Some(version) = params.version {
752 if version != doc.version() {
757 if version != doc.version() {