mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-25 19:03:30 +04:00
Use binary_search when looking up diagnostics
They're sorted by range so they should also be sorted by line
This commit is contained in:
parent
cab09093dd
commit
a2b22ec152
@ -22,7 +22,7 @@ pub fn diagnostic<'doc>(
|
||||
|
||||
Box::new(move |line: usize, _selected: bool, out: &mut String| {
|
||||
use helix_core::diagnostic::Severity;
|
||||
if let Some(diagnostic) = diagnostics.iter().find(|d| d.line == line) {
|
||||
if let Some(diagnostic) = diagnostics.binary_search_by_key(&line, |d| d.line) {
|
||||
write!(out, "●").unwrap();
|
||||
return Some(match diagnostic.severity {
|
||||
Some(Severity::Error) => error,
|
||||
|
Loading…
Reference in New Issue
Block a user