我希望仅使用键盘即可有效地浏览所有文件更改。
当我打开源代码控制 View 并使用箭头键浏览更改并按 enter
时,源代码控制 View 将失去焦点并打开文件。我希望能够预览文件更改,而不会失去源代码管理 View 的焦点。
例如:
按enter
→查看file-change-1.txt
→按key down
然后enter
→查看file-chang-2.txt
现在发生的情况是,当我在突出显示文件时按 Enter 键,文件差异已打开,但源代码管理的焦点丢失了。因此,当我按下并输入时,实际的 \n
就会写入打开的文件中。
我尝试将以下键盘快捷键添加到我的 keybindings.json
中,以便使用空格键预览文件
{
"key": "space",
"command":"filesExplorer.openFilePreserveFocus",
"when":"sideBarFocus && activeViewlet == 'workbench.view.scm'"
}
这行不通。我认为 filesExplorer.openFilePreserveFocus
仅适用于文件资源管理器 View 。
有可能实现这种行为吗?
最佳答案
另请参阅 v1.48 中的内容:
As you navigate the Source Control view, pressing Space on a change will now open it as a preview editor and keep the focus in the Source Control view, for easier keyboard navigation.
您向下箭头浏览 scm 文件更改,然后按空格键打开差异 View 。焦点仍保留在 SCM View 中,因此您可以继续执行此操作。
关于visual-studio-code - VSCode : keep focus in Source Control Viewlet when opening a file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63356001/