12

I'd like VSCode to automatically exclude files/folders based on my .gitignore configuration.

For the explorer exclusion I've found an extension (explorer-excluded-files which manages the files.exclude setting), but for the quick open file (cmd + p) I didn't find anything.

I guess I can try and tweak other *.exclude settings but I wonder why isn't there a global method to exclude .gitignore entries in all relevant places? Otherwise I have to manually sync the settings every time .gitignore changes.

krulik
  • 976
  • 1
  • 10
  • 31

1 Answers1

9

Regarding the explorer, in addition of the existing plugin you have found, there is a request in progress: Microsoft/vscode issue 38878

But regarding Quick Open, issue 41495 includes the comment:

Are those files covered by a gitignore pattern?
It now skips gitignored files by default.
You can disable this with "search.useIgnoreFiles": false if you prefer.

So are you using (with a current 2018 version of VSCode) the setting search.useIgnoreFiles?


Four years later (VSCode 1.68, May 2022), this issue is fixed with PR 149967 and the new setting explorer.excludeGitIgnore

Controls whether entries in .gitignore should be parsed and excluded from the explorer.
Similar to files.exclude.

PR 150848 mentions:

Since this setting only applies to the explorer it is being renamed from files.excludeGitIgnore to explorer.excludeGitIgnore.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Not working for me. I have the setting on but I still see ignored files in the search. – leonheess Sep 02 '22 at 10:39
  • @leonheess But [did you removed those ignored files from the index first](https://stackoverflow.com/a/43511646/6309)? Meaning, those files might be currently tracked, in which case they would bot be impacted by a `.gitignore` file. – VonC Sep 02 '22 at 14:32
  • I realized I'm facing this issue: https://github.com/microsoft/vscode/issues/26574 – leonheess Sep 02 '22 at 22:00
  • @leonheess Interesting. I will be monitoring this issue. – VonC Sep 02 '22 at 22:12