Remove unnecessary finding of primary diagnostic for diagnostic hover (#22697)
No need to find or store the primary range ahead of time as it's found by `activate_diagnostics`. Not entirely sure we should still even have the special case when the popover is visible. It does support the keyboard interaction of opening hover followed by jumping to the primary position, but that seems pretty undiscoverable. Support for clicking the hover to navigate to the primary diagnostic was removed in https://github.com/zed-industries/zed/pull/3408 Release Notes: - N/A
This commit is contained in:
parent
2a9fa0e2dc
commit
fcb03989d2
2 changed files with 22 additions and 36 deletions
|
@ -9148,11 +9148,12 @@ impl Editor {
|
|||
// If there is an active Diagnostic Popover jump to its diagnostic instead.
|
||||
if direction == Direction::Next {
|
||||
if let Some(popover) = self.hover_state.diagnostic_popover.as_ref() {
|
||||
let (group_id, jump_to) = popover.activation_info();
|
||||
if self.activate_diagnostics(group_id, cx) {
|
||||
self.activate_diagnostics(popover.group_id(), cx);
|
||||
if let Some(active_diagnostics) = self.active_diagnostics.as_ref() {
|
||||
let primary_range_start = active_diagnostics.primary_range.start;
|
||||
self.change_selections(Some(Autoscroll::fit()), cx, |s| {
|
||||
let mut new_selection = s.newest_anchor().clone();
|
||||
new_selection.collapse_to(jump_to, SelectionGoal::None);
|
||||
new_selection.collapse_to(primary_range_start, SelectionGoal::None);
|
||||
s.select_anchors(vec![new_selection.clone()]);
|
||||
});
|
||||
}
|
||||
|
@ -9224,7 +9225,8 @@ impl Editor {
|
|||
});
|
||||
|
||||
if let Some((primary_range, group_id)) = group {
|
||||
if self.activate_diagnostics(group_id, cx) {
|
||||
self.activate_diagnostics(group_id, cx);
|
||||
if self.active_diagnostics.is_some() {
|
||||
self.change_selections(Some(Autoscroll::fit()), cx, |s| {
|
||||
s.select(vec![Selection {
|
||||
id: selection.id,
|
||||
|
@ -10326,7 +10328,7 @@ impl Editor {
|
|||
}
|
||||
}
|
||||
|
||||
fn activate_diagnostics(&mut self, group_id: usize, cx: &mut ViewContext<Self>) -> bool {
|
||||
fn activate_diagnostics(&mut self, group_id: usize, cx: &mut ViewContext<Self>) {
|
||||
self.dismiss_diagnostics(cx);
|
||||
let snapshot = self.snapshot(cx);
|
||||
self.active_diagnostics = self.display_map.update(cx, |display_map, cx| {
|
||||
|
@ -10388,7 +10390,6 @@ impl Editor {
|
|||
is_valid: true,
|
||||
})
|
||||
});
|
||||
self.active_diagnostics.is_some()
|
||||
}
|
||||
|
||||
fn dismiss_diagnostics(&mut self, cx: &mut ViewContext<Self>) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue