Refactor add_diagnostics
This commit is contained in:
parent
daede03dc6
commit
131574983a
1 changed files with 72 additions and 71 deletions
|
@ -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| {
|
||||
if let Some(version) = document_version{
|
||||
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() {
|
||||
|
@ -2245,7 +2247,6 @@ impl Editor {
|
|||
|
||||
helix_event::dispatch(crate::events::DiagnosticsDidChange { editor: self, doc });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn try_restore_indent(doc: &mut Document, view: &mut View) {
|
||||
|
|
Loading…
Add table
Reference in a new issue