mirror of
https://github.com/helix-editor/helix
synced 2024-11-10 10:34:45 +01:00
stable sort diagnostics to avoid flickering
This commit is contained in:
parent
839f4d758d
commit
39b3d81abf
@ -771,7 +771,7 @@ impl Application {
|
||||
// Note: The `lsp::DiagnosticSeverity` enum is already defined in decreasing order
|
||||
params
|
||||
.diagnostics
|
||||
.sort_unstable_by_key(|d| (d.severity, d.range.start));
|
||||
.sort_by_key(|d| (d.severity, d.range.start));
|
||||
}
|
||||
for source in &lang_conf.persistent_diagnostic_sources {
|
||||
let new_diagnostics = params
|
||||
@ -812,9 +812,8 @@ impl Application {
|
||||
|
||||
// Sort diagnostics first by severity and then by line numbers.
|
||||
// Note: The `lsp::DiagnosticSeverity` enum is already defined in decreasing order
|
||||
diagnostics.sort_unstable_by_key(|(d, server_id)| {
|
||||
(d.severity, d.range.start, *server_id)
|
||||
});
|
||||
diagnostics
|
||||
.sort_by_key(|(d, server_id)| (d.severity, d.range.start, *server_id));
|
||||
|
||||
if let Some(doc) = doc {
|
||||
let diagnostic_of_language_server_and_not_in_unchanged_sources =
|
||||
|
@ -99,7 +99,6 @@ impl Serialize for Mode {
|
||||
serializer.collect_str(self)
|
||||
}
|
||||
}
|
||||
|
||||
/// A snapshot of the text of a document that we want to write out to disk
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DocumentSavedEvent {
|
||||
@ -1321,7 +1320,7 @@ impl Document {
|
||||
true
|
||||
});
|
||||
|
||||
self.diagnostics.sort_unstable_by_key(|diagnostic| {
|
||||
self.diagnostics.sort_by_key(|diagnostic| {
|
||||
(diagnostic.range, diagnostic.severity, diagnostic.provider)
|
||||
});
|
||||
|
||||
@ -1911,9 +1910,8 @@ impl Document {
|
||||
});
|
||||
}
|
||||
self.diagnostics.extend(diagnostics);
|
||||
self.diagnostics.sort_unstable_by_key(|diagnostic| {
|
||||
(diagnostic.range, diagnostic.severity, diagnostic.provider)
|
||||
});
|
||||
self.diagnostics
|
||||
.sort_by_key(|diagnostic| (diagnostic.range, diagnostic.severity, diagnostic.provider));
|
||||
}
|
||||
|
||||
/// clears diagnostics for a given language server id if set, otherwise all diagnostics are cleared
|
||||
|
Loading…
Reference in New Issue
Block a user