Merge branch 'fragment-locators' into HEAD
This commit is contained in:
@@ -324,14 +324,13 @@ impl DiagnosticMessage {
|
||||
|
||||
fn update(&mut self, editor: ViewHandle<Editor>, cx: &mut ViewContext<Self>) {
|
||||
let editor = editor.read(cx);
|
||||
let cursor_position = editor.newest_selection(cx).head();
|
||||
let new_diagnostic = editor
|
||||
.buffer()
|
||||
.read(cx)
|
||||
.diagnostics_in_range::<usize, usize>(cursor_position..cursor_position)
|
||||
.filter(|(range, _)| !range.is_empty())
|
||||
.min_by_key(|(range, diagnostic)| (diagnostic.severity, range.len()))
|
||||
.map(|(_, diagnostic)| diagnostic.clone());
|
||||
let cursor_position = editor.newest_selection::<usize>(cx).head();
|
||||
let buffer = editor.buffer().read(cx);
|
||||
let new_diagnostic = buffer
|
||||
.diagnostics_in_range::<_, usize>(cursor_position..cursor_position)
|
||||
.filter(|entry| !entry.range.is_empty())
|
||||
.min_by_key(|entry| (entry.diagnostic.severity, entry.range.len()))
|
||||
.map(|entry| entry.diagnostic);
|
||||
if new_diagnostic != self.diagnostic {
|
||||
self.diagnostic = new_diagnostic;
|
||||
cx.notify();
|
||||
|
||||
Reference in New Issue
Block a user