mirror of
https://github.com/ilyakooo0/helix.git
synced 2024-08-16 19:40:27 +03:00
consistent diagnostic sorting
This commit is contained in:
parent
515ef17207
commit
783ff27b1b
@ -907,7 +907,9 @@ macro_rules! language_server {
|
|||||||
|
|
||||||
// Sort diagnostics first by severity and then by line numbers.
|
// Sort diagnostics first by severity and then by line numbers.
|
||||||
// Note: The `lsp::DiagnosticSeverity` enum is already defined in decreasing order
|
// Note: The `lsp::DiagnosticSeverity` enum is already defined in decreasing order
|
||||||
diagnostics.sort_unstable_by_key(|(d, _)| (d.severity, d.range.start));
|
diagnostics.sort_unstable_by_key(|(d, server_id)| {
|
||||||
|
(d.severity, d.range.start, *server_id)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Notification::ShowMessage(params) => {
|
Notification::ShowMessage(params) => {
|
||||||
log::warn!("unhandled window/showMessage: {:?}", params);
|
log::warn!("unhandled window/showMessage: {:?}", params);
|
||||||
|
@ -1240,8 +1240,13 @@ fn apply_impl(
|
|||||||
true
|
true
|
||||||
});
|
});
|
||||||
|
|
||||||
self.diagnostics
|
self.diagnostics.sort_unstable_by_key(|diagnostic| {
|
||||||
.sort_unstable_by_key(|diagnostic| diagnostic.range);
|
(
|
||||||
|
diagnostic.range,
|
||||||
|
diagnostic.severity,
|
||||||
|
diagnostic.language_server_id,
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
// Update the inlay hint annotations' positions, helping ensure they are displayed in the proper place
|
// Update the inlay hint annotations' positions, helping ensure they are displayed in the proper place
|
||||||
let apply_inlay_hint_changes = |annotations: &mut Rc<[InlineAnnotation]>| {
|
let apply_inlay_hint_changes = |annotations: &mut Rc<[InlineAnnotation]>| {
|
||||||
@ -1738,8 +1743,13 @@ pub fn replace_diagnostics(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
self.diagnostics.extend(diagnostics);
|
self.diagnostics.extend(diagnostics);
|
||||||
self.diagnostics
|
self.diagnostics.sort_unstable_by_key(|diagnostic| {
|
||||||
.sort_unstable_by_key(|diagnostic| diagnostic.range);
|
(
|
||||||
|
diagnostic.range,
|
||||||
|
diagnostic.severity,
|
||||||
|
diagnostic.language_server_id,
|
||||||
|
)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_diagnostics(&mut self, language_server_id: usize) {
|
pub fn clear_diagnostics(&mut self, language_server_id: usize) {
|
||||||
|
Loading…
Reference in New Issue
Block a user