menu

Questions & Answers

How can I show ignored files in visual studio code?

My tree view hides all of the ignored files that are listed in .gitignore. I cannot find anything in settings.json to show ignored files in my project. How do I show files ignored because of .gitignore?

Answers(8) :

For me, the only way I could get the Explorer to show ignored files is using this setting:

      "explorer.excludeGitIgnore": false

I have file .env ignored, but would like to see it in the Explorer. The above setting addressed it.

The defaults of VS Code puzzle me, but fortunately there is a way to override them. I spent hours searching for a way to expose these files in the Explorer view, and only found it through experimenting based on what I already had for the search:

"search.useIgnoreFiles": false,
"files.useIgnoreFiles": false,
Comments:
2023-01-11 09:15:36
files.useIgnoreFiles does not seem to exist (anymore?). all settings
2023-01-11 09:15:36
You can use the files.exclude configuration to tell VSCode what to exclude from the file explorer. It does not use the gitignore file for determining what is visible in the explorer.
2023-01-11 09:15:36
This answer didn't work for me in 1.72 (09/2022), but zumalifeguard's answer did, allowing me to show folders/files in the explorer sidebar otherwise hidden by .gitignore by setting "explorer.excludeGitIgnore": false (aka uncheck "Explorer: Exclude Git Ignore").

This is not currently possible in VS Code but there is discussion in this github issue about making it possible.

I suggest that you give a thumbs up reaction to the issue (click on the thumbs up in the bottom left of the initial post) to voice your support and follow the issue so you can find out if something changes.

Comments:
2023-01-11 09:15:36
yes it is possible: go to Preferences > Settings, and edit the User Settings file to comment out excluded files in the "files.exclude" section - like node_modules etc.
2023-01-11 09:15:36
THIS IS FALSE: See my answer below

One interesting work around I found is that in VsCode's file browser, if you right click and create the file or directory you need (ex: right click -> create file -> .gitignore), it will show up. Not the best solution especially if things are nested but gives a quick and dirty way to do it. Also added this answer to the Github issue.

Comments:
2023-01-11 09:15:36
This is for displaying the file named .gitignore itself, but the OP is trying to display the files that are listed inside .gitignore

On the root of your project update the following file: .vscode/settings.json

{
  "files.exclude": {
    "**/.gitignore": false,
    "**/.git": true,
    "**/.vscode": false
  }
}

this is possible - go to Preferences > Settings, and edit the User Settings file to comment out excluded files in the "files.exclude" section - like node_modules etc. Here are my settings for example:

"files.exclude": {
  "**/.git": true, // this is a default value
  "**/.DS_Store": true, // this is a default value
  // "**/node_modules": true,
  "**/jspm_packages": true,
  "**/coverage": true,
  "**/public": true,
  "**/.cache": true,
  "**/.bundles": true,
  "**/es": true,
  // "**/dist": true,
  // "**/lib": true,
  "**/umd": true
},
Comments:
2023-01-11 09:15:36
Great solution! Maybe VSCode will create a menu item to make it easier, but commenting out is brilliant!

go to Preferences > Settings, uncheck the option search:Use Ignore Files, then it works

Comments:
2023-01-11 09:15:36
this one works for me, above and accepted answer fails to address my issue

I'm use VSCodium, so i don't know if it will help you. Put it in settings.json:

"explorer.excludeGitIgnore": false,