mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 21:13:02 +00:00
In diagnostics editor, attempt to open excerpts in a different pane
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
747d9e8784
commit
a0a558318c
2 changed files with 13 additions and 1 deletions
|
@ -192,7 +192,9 @@ impl ProjectDiagnosticsEditor {
|
|||
workspace.update(cx, |workspace, cx| {
|
||||
for (buffer, ranges) in new_selections_by_buffer {
|
||||
let buffer = BufferItemHandle(buffer);
|
||||
workspace.activate_pane_for_item(&buffer, cx);
|
||||
if !workspace.activate_pane_for_item(&buffer, cx) {
|
||||
workspace.activate_next_pane(cx);
|
||||
}
|
||||
let editor = workspace
|
||||
.open_item(buffer, cx)
|
||||
.to_any()
|
||||
|
@ -561,6 +563,10 @@ impl workspace::ItemView for ProjectDiagnosticsEditor {
|
|||
unreachable!()
|
||||
}
|
||||
|
||||
fn should_activate_item_on_event(event: &Self::Event) -> bool {
|
||||
Editor::should_activate_item_on_event(event)
|
||||
}
|
||||
|
||||
fn should_update_tab_on_event(event: &Event) -> bool {
|
||||
matches!(
|
||||
event,
|
||||
|
|
|
@ -979,6 +979,12 @@ impl Workspace {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn activate_next_pane(&mut self, cx: &mut ViewContext<Self>) {
|
||||
let ix = self.panes.iter().position(|pane| pane == &self.active_pane).unwrap();
|
||||
let next_ix = (ix + 1) % self.panes.len();
|
||||
self.activate_pane(self.panes[next_ix].clone(), cx);
|
||||
}
|
||||
|
||||
fn activate_pane(&mut self, pane: ViewHandle<Pane>, cx: &mut ViewContext<Self>) {
|
||||
self.active_pane = pane;
|
||||
self.status_bar.update(cx, |status_bar, cx| {
|
||||
|
|
Loading…
Reference in a new issue