outline_panel: Rename outline_panel::Open to outline_panel::OpenSelectedEntry (#28890)

Closes #27171

The `outline_panel::Open` action seems to open the outline panel, but
instead, it moves the editor's cursor to the position of the selected
entry in the outline panel. This PR renames it to
`outline_panel::OpenSelectedEntry` for better clarity.

Meanwhile, there is an existing action, `outline_panel::ToggleFocus`,
that should be used for opening the outline panel.

Todo:
- [x] Added migration

Release Notes:

- Renamed `outline_panel::Open` to `outline_panel::OpenSelectedEntry`
for better clarity.
This commit is contained in:
Smit Barmase 2025-04-17 01:44:00 +05:30 committed by GitHub
parent 56856fb992
commit 94cf1b0353
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 55 additions and 9 deletions

View file

@ -70,7 +70,7 @@ actions!(
ExpandAllEntries,
ExpandSelectedEntry,
FoldDirectory,
Open,
OpenSelectedEntry,
RevealInFileManager,
SelectParent,
ToggleActiveEditorPin,
@ -922,7 +922,12 @@ impl OutlinePanel {
self.update_cached_entries(None, window, cx);
}
fn open(&mut self, _: &Open, window: &mut Window, cx: &mut Context<Self>) {
fn open_selected_entry(
&mut self,
_: &OpenSelectedEntry,
window: &mut Window,
cx: &mut Context<Self>,
) {
if self.filter_editor.focus_handle(cx).is_focused(window) {
cx.propagate()
} else if let Some(selected_entry) = self.selected_entry().cloned() {
@ -4906,7 +4911,7 @@ impl Render for OutlinePanel {
}
}))
.key_context(self.dispatch_context(window, cx))
.on_action(cx.listener(Self::open))
.on_action(cx.listener(Self::open_selected_entry))
.on_action(cx.listener(Self::cancel))
.on_action(cx.listener(Self::select_next))
.on_action(cx.listener(Self::select_previous))
@ -5677,7 +5682,7 @@ mod tests {
});
outline_panel.update_in(cx, |outline_panel, window, cx| {
outline_panel.open(&Open, window, cx);
outline_panel.open_selected_entry(&OpenSelectedEntry, window, cx);
});
outline_panel.update(cx, |_outline_panel, cx| {
assert_eq!(
@ -5852,7 +5857,7 @@ mod tests {
outline_panel.update_in(cx, |outline_panel, window, cx| {
outline_panel.select_previous(&SelectPrevious, window, cx);
outline_panel.open(&Open, window, cx);
outline_panel.open_selected_entry(&OpenSelectedEntry, window, cx);
});
cx.executor()
.advance_clock(UPDATE_DEBOUNCE + Duration::from_millis(100));
@ -5876,7 +5881,7 @@ mod tests {
outline_panel.update_in(cx, |outline_panel, window, cx| {
outline_panel.select_next(&SelectNext, window, cx);
outline_panel.open(&Open, window, cx);
outline_panel.open_selected_entry(&OpenSelectedEntry, window, cx);
});
cx.executor()
.advance_clock(UPDATE_DEBOUNCE + Duration::from_millis(100));
@ -5897,7 +5902,7 @@ mod tests {
});
outline_panel.update_in(cx, |outline_panel, window, cx| {
outline_panel.open(&Open, window, cx);
outline_panel.open_selected_entry(&OpenSelectedEntry, window, cx);
});
cx.executor()
.advance_clock(UPDATE_DEBOUNCE + Duration::from_millis(100));