Merge pull request #226 from zed-industries/1d-block-map

Allow full diagnostic messages to be displayed in the editor
This commit is contained in:
Max Brunsfeld 2021-11-19 09:16:49 -08:00 committed by GitHub
commit 447f710570
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 4161 additions and 823 deletions

View file

@ -258,15 +258,12 @@ impl DiagnosticMessage {
fn update(&mut self, editor: ViewHandle<Editor>, cx: &mut ViewContext<Self>) {
let editor = editor.read(cx);
let cursor_position = editor
.selections::<usize>(cx)
.max_by_key(|selection| selection.id)
.unwrap()
.head();
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());
if new_diagnostic != self.diagnostic {