DEV Community

Pacharapol Withayasakpunt
Pacharapol Withayasakpunt

Posted on

How to prevent VSCode from expanding treeview on Goto definition

You know, that Ctrl+Click or Cmd+Click.

Especially for larger folders, like node_modules/ or .venv/.

Apparently, while I am trying to find the right question to ask, I can finally google to find an answer...

It's in Feature Request as well.

Allow to set explorer.autoReveal per specific folder #87956

Issue Type: Feature Request

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.

Proposition:

  • Never expand node_modules implicitly
  • If goto definition is used into a node_module, go there but do not older current folder state (if its collapsed keep it collapsed, if it was explicitly expanded by user keep it).
  • This behavior applies very specifically to node_modules only.

VS Code version: Code - Insiders 1.42.0-insider (7c0095ee2d064033fc13184127a9adc603454729, 2019-12-20T07:58:23.119Z) OS version: Linux x64 5.3.0-24-generic

Top comments (0)