Add back toggle sidebar key bindings

This commit is contained in:
Max Brunsfeld 2022-04-13 11:08:21 -07:00
parent 1e0182f6c7
commit 2ea2ba358f
2 changed files with 22 additions and 9 deletions

View file

@ -53,7 +53,21 @@
"cmd-t": "project_symbols::Toggle",
"cmd-p": "file_finder::Toggle",
"alt-shift-D": "diagnostics::Deploy",
"ctrl-alt-cmd-j": "journal::NewJournalEntry"
"ctrl-alt-cmd-j": "journal::NewJournalEntry",
"cmd-1": [
"workspace::ToggleSidebarItemFocus",
{
"side": "Left",
"item_index": 0
}
],
"cmd-shift-!": [
"workspace::ToggleSidebarItem",
{
"side": "Left",
"item_index": 0
}
]
},
"ProjectSearchBar": {
"enter": "project_search::Search",

View file

@ -1,7 +1,6 @@
use super::Workspace;
use gpui::{
elements::*, impl_internal_actions, platform::CursorStyle, AnyViewHandle, RenderContext,
};
use gpui::{elements::*, impl_actions, platform::CursorStyle, AnyViewHandle, RenderContext};
use serde::Deserialize;
use std::{cell::RefCell, rc::Rc};
use theme::Theme;
@ -12,7 +11,7 @@ pub struct Sidebar {
width: Rc<RefCell<f32>>,
}
#[derive(Clone, Copy)]
#[derive(Clone, Copy, Deserialize)]
pub enum Side {
Left,
Right,
@ -23,15 +22,15 @@ struct Item {
view: AnyViewHandle,
}
#[derive(Clone)]
#[derive(Clone, Deserialize)]
pub struct ToggleSidebarItem(pub SidebarItemId);
#[derive(Clone)]
#[derive(Clone, Deserialize)]
pub struct ToggleSidebarItemFocus(pub SidebarItemId);
impl_internal_actions!(workspace, [ToggleSidebarItem, ToggleSidebarItemFocus]);
impl_actions!(workspace, [ToggleSidebarItem, ToggleSidebarItemFocus]);
#[derive(Clone)]
#[derive(Clone, Deserialize)]
pub struct SidebarItemId {
pub side: Side,
pub item_index: usize,