Merge branch 'fragment-locators' into HEAD

This commit is contained in:
Max Brunsfeld
2021-12-09 14:49:04 -08:00
22 changed files with 1317 additions and 1280 deletions
+7 -8
View File
@@ -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();