VS 代码: 禁用打开的文件和资源管理器之间的链接

我可以在 VisualStudio 代码中用编辑器禁用函数链接吗?

我的项目有很多文件,所以资源管理器树很长,但是当我打开一个编辑器选项卡,这个文件将自动聚焦在资源管理器面板上。我怎样才能禁用这个功能?

日食的同样特征:

This function in eclipse

20444 次浏览

Can I disable the function link with editor in visual code?

Yep, just add "explorer.autoReveal": false to your VS Code configuration.

  1. CTRL+SHIFT+P , and open User Settings

enter image description here

  1. Type Auto Reveal in the search box

  2. Uncheck the auto reveal property as highlighted below

enter image description here

Using VSCode in 2021

A solution similar as a Toggle Button is disabling the Auto Reveal, and choosing to Reveal when you desire, actually, it's better than a Toggle Button

Step 1:

Type: CTRL+, , and open User Settings
Or go to the menu File -> Preferences -> Settings

enter image description here

Type Auto Reveal in the search box

enter image description here

Step 2:

Click on file's tab with the right button and choose Reveal in Side Bar
And the file will be synchronized in the Explorer Side Bar

enter image description here

enter image description here



Adicional Step:

You can add a keyboard shortcut to use the keyboard to synchronize the editor window with file explorer:

enter image description here

I found the combination of setting the "explorer.autoReveal" to false and installing the locate this document extension very productive.

locate this document extension vscode

Interesting new feautre with VSCode 1.74 (Nov. 2022)

Issue 87956 "Allow to set explorer.autoReveal per specific folder "

Example/Use case:

node_modules will constantly expand itself in the Explorer, especially if your defining definitions.
I typically never want this, I think an exception should be made for showing what file is open if its in node_modules to keep the folder collapsed unless I explicitly expand it.

The reason it's a problem is because there are so many files in node_modules you have to collapse it to keep developing, as it's completely useless in most cases to have it expanded and it pushes your work files off screen.

It is now implemented in PR 136905 with the new explorer.autorevealExclude

  • Inherits from files.exclude
  • Defaults to same values as search.exclude: **/node_modules, **/bower_components, **/*.code-search
  • Calls to refresh, selectResource and calls from ExplorerView are all routed to ExplorerService.select(), where the reveal check occurs
  • Recursively checks from the file up to the first root child, if any of them match a pattern then the file is not revealed.

https://user-images.githubusercontent.com/20613660/141199536-da5da6ce-b94d-4d07-9472-c61ab3fe0638.gif

This is available today in VSCode Insiders.