visual-studio-code - VSCode : keep focus in Source Control Viewlet when opening a file

标签 visual-studio-code

我希望仅使用键盘即可有效地浏览所有文件更改。

当我打开源代码控制 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/

相关文章:

尝试在 MAC 上克隆 GIT 时出现 javax.net.ssl.SSLHandshakeException

python - Visual Studio Code : run Python file with arguments

visual-studio-code - 每次 VSCode 重启时设置同步提示登录

visual-studio-code - Vscode的大小及其图标和文字都变小了,怎么办?

python - VS code向函数添加参数并将其添加到函数的每次调用中

visual-studio-code - VS代码: change font size of menu bars?

python - Azure Python SDK - 仅在 VS Code 中调试时代码才会失败

.net - 在 Mac 和 Windows 上打开相同的 .NET Core 解决方案

javascript - Visual Studio 代码清理任务

c++ - 进程启动时自动连接 VS Code C++ 调试器