当通过导航选项卡打开文件时,如何在 VSCode Explorer 面板中禁用文件自动聚焦? [英] How to disable file auto-focus in VSCode Explorer panel when file is opened by navigating tabs?

查看:32
本文介绍了当通过导航选项卡打开文件时,如何在 VSCode Explorer 面板中禁用文件自动聚焦?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否应该为以下内容提交设置或功能请求:

I wonder if there is a setting or a feature request should be submitted for the following:

目前,如果您从项目资源管理器中选择一个文件,它会进入自己的选项卡.如果您打开了多个选项卡,当您聚焦其中任何一个时,文件本身也会聚焦在项目资源管理器中.对于较大的项目,您需要浏览项目中的大量文件并在这里​​和那里打开文件,这实际上可能会分散注意力 - 对于某些人来说,最好不要将当前文件集中在项目资源管理器中,也不要忽视您实际打开的最后一个文件及其邻居文件.

Currently, if you pick a file from the project explorer, it goes into its own tab. If you have several tabs opened, as you focus any one of them, the file itself also gets focused in the project explorer. For larger projects where you navigate through a lot of files in the project and open files here and there this could actually be a distraction - for some people it would be better not to focus the current file in the project explorer and not lose sight of the last file you actually opened and its neighbour-files.

另一种情况是当您调试 node.js 应用程序并需要使用 F11 重复调试时 - 很多时候您会发现自己位于某个接管整个项目资源管理器的超深 node_modules 文件夹中 - 您需要关闭稍后手动执行此操作以使项目浏览器正常运行.

Another scenario is when you debug a node.js app and need to debug repeatedly with F11 - a lot of times you could find yourself in some ultra-deep node_modules folder that takes over the whole project explorer - and you need to close this manually later to bring the project explorer to order.

推荐答案

回答第一部分,如果你把它添加到你的工作区或用户设置中,vscode 将不再自动在文件资源管理器中显示当前活动的文件.

To answer the first part, if you add this to your workspace or user settings, vscode will no longer automatically show the currently active file in the file explorer.

"explorer.autoReveal": false

回答第二部分,如果您希望关注当前文件但不喜欢将资源管理器部分扩展到所有地方,那么有一个命令可以帮助您.如果你在你的按键绑定中放了这样的东西,那么每当你觉得资源管理器变得不守规矩时,你就可以使用键盘命令.它也可以在命令面板中使用(文件:在资源管理器中折叠文件夹"),并且文件资源管理器中有一个如下所示的图标:[-]

To answer the second part, if you like to have the current file focused but you don't like having the explorer section expanded all over the place, there is a command that can help you. If you put something like this in your keybindings, then whenever you feel the explorer has become unruly you can use the keyboard command. It is also available in the command palette ("Files: Collapse folders in explorer") and there is an icon in the file explorer that looks like this: [-]

{
    "key": "ctrl+shift+t",
    "command": "workbench.files.action.collapseExplorerFolders",
    "when": ""
}

我还创建了一个扩展,可以自动执行此操作.

I have also created an extension that can automate this.

这篇关于当通过导航选项卡打开文件时,如何在 VSCode Explorer 面板中禁用文件自动聚焦?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆