Refactor add_diagnostics

pull/11315/head
Sofus Addington 3 months ago
parent daede03dc6
commit 131574983a

@ -2169,19 +2169,21 @@ impl Editor {
document_version: Option<i32>,
result_id: Option<String>,
) {
let doc = self.documents.values_mut()
let Some(doc) = self
.documents
.values_mut()
.find(|doc| doc.uri().is_some_and(|u| u == uri))
.filter(|doc| {
else {
return;
};
if let Some(version) = document_version {
if version != doc.version() {
log::info!("Version ({version}) is out of date for {uri:?} (expected ({}), dropping PublishDiagnostic notification", doc.version());
return false;
return;
}
}
true
});
if let Some(doc) = doc {
let mut unchanged_diag_sources = Vec::new();
if let Some(old_diagnostics) = self.diagnostics.get(&uri) {
if let Some(lang_conf) = doc.language_config() {
@ -2246,7 +2248,6 @@ impl Editor {
helix_event::dispatch(crate::events::DiagnosticsDidChange { editor: self, doc });
}
}
}
fn try_restore_indent(doc: &mut Document, view: &mut View) {
use helix_core::{

Loading…
Cancel
Save