27

I am using vscode, and I would like to exclude some directories (with webpack bundles) from 'go to file' option in vscode.

I tried to exclude them by "search.exclude" and "files.exclude". That worked in files tree and in search, but I still can find these files by 'go to file'.

Do you know how to do this?

adamesque
  • 1,906
  • 19
  • 24
Artur Słomowski
  • 291
  • 1
  • 3
  • 4

4 Answers4

22

As @adamesque stated, to exclude files from quick open you can either add them to files.exclude or search.exclude setting.
The issue then is that Quick Open also stores recent items, even from excluded paths.

Fortunately, VSCode now have a command File: Clear Recently Opened!

EDIT: As I needed to replace a Disk path while keeping my recent files I found where they are stored. It's in the storage.json file which is under /Users/imac/Library/Application Support/Code/storage.json on macOS and AppData\Roaming\Code\storage.json on Windows.

melMass
  • 3,813
  • 1
  • 31
  • 30
11

I thought I had this exact problem, and all the relevant issues I could find in the VS Code GitHub project seemed to have been fixed (see https://github.com/Microsoft/vscode/issues/19029, https://github.com/Microsoft/vscode/issues/6502).

In my case, because I had previously opened some of the files in those excluded directories, they still showed up in "Go To File" in the "Recently Opened" section, which made me think the exclusion feature wasn't working.

Turns out I just had to manually remove those items from history to keep them from showing up. Open the Command Palette, run Remove from History, and then select the a file to remove. You may need to do this for each file you'd previously opened from an "excluded" dir, but after this is done, they shouldn't show up anymore in the "Go to File" menu.

Hope this helps!

adamesque
  • 1,906
  • 19
  • 24
7

Version 1.44:

now we have an option in the settings.

If you tipe "Goto file" in the setting search bar, the editor opens up a Search:Exclude section, and you can add a folder or files.

enter image description here

Fjordo
  • 768
  • 3
  • 18
  • 40
1

enter image description here

CTRL + SHIFT + P, then select File: Clear Recently Opened

KimchiMan
  • 4,836
  • 6
  • 35
  • 41