feat(workspace): allow alternative actions to open files and symbols in split

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
Alex Viscreanu 2023-07-14 21:41:23 +02:00
parent 369ccc725c
commit c7669317ec
No known key found for this signature in database
25 changed files with 277 additions and 80 deletions

View file

@ -104,7 +104,7 @@ impl PickerDelegate for ProjectSymbolsDelegate {
"Search project symbols...".into()
}
fn confirm(&mut self, cx: &mut ViewContext<ProjectSymbols>) {
fn confirm(&mut self, secondary: bool, cx: &mut ViewContext<ProjectSymbols>) {
if let Some(symbol) = self
.matches
.get(self.selected_match_index)
@ -122,7 +122,12 @@ impl PickerDelegate for ProjectSymbolsDelegate {
.read(cx)
.clip_point_utf16(symbol.range.start, Bias::Left);
let editor = workspace.open_project_item::<Editor>(buffer, cx);
let editor = if secondary {
workspace.split_project_item::<Editor>(buffer, cx)
} else {
workspace.open_project_item::<Editor>(buffer, cx)
};
editor.update(cx, |editor, cx| {
editor.change_selections(Some(Autoscroll::center()), cx, |s| {
s.select_ranges([position..position])