rap*_*aic 2 keyboard-shortcuts visual-studio-code
我想在侧边栏关闭时使用“视图:显示资源管理器”命令。并在侧边栏打开时用相同的键关闭侧边栏。
所以基本上我想让我的侧边栏默认使用资源管理器打开(并且默认情况下也将焦点更改为资源管理器),但也使用相同的键关闭侧边栏。这可以使用 vscode 键盘快捷键中的 when 函数来完成,但我没有找到代表侧边栏何时打开的函数。
已经尝试过:workbench.SideBar.visible: true 'sideBar.isOpen || 侧边栏已打开'
VSCode 文档中列出的所有这些 while 函数在哪里?
需要明确的是:这是一个键,用于两个不同的快捷操作 - 一个是打开+焦点资源管理器,另一个是切换侧边栏(但仅当其打开时) - 因此它也可以被命名为“关闭侧边栏”。
在您的中尝试这些键绑定keybindings.json:
{
"key": "ctrl+shift+e", // when Explorer not open
// "command": "workbench.view.explorer", // either of these commands works
"command": "workbench.files.action.focusFilesExplorer",
"when": "!explorerViewletVisible"
},
{
"key": "ctrl+shift+e", // when Explorer open
"command": "workbench.action.toggleSidebarVisibility",
"when": "explorerViewletVisible"
}
Run Code Online (Sandbox Code Playgroud)
我是怎么找到那些的context keys?请参阅检查上下文键实用程序。
Developer: Inspect Context Keys from the Command Palette and click anywhere in the vscode windowfind input. For me, this appears at the very bottom and is tricky to see.explorerViewletVisible看起来最有前途。然后我浏览了键盘快捷键“查看资源管理器”,然后“侧边栏”来查找我认为可行的命令。
| 归档时间: |
|
| 查看次数: |
678 次 |
| 最近记录: |