9

Using Microsoft's Visual Studio Code, how do I show only certain files and file patterns in the sidebar and exclude all other files?

I want to show .yml files to achieve editing only them and not to scroll through all files.

I tried this, but it didn't work.

"files.exclude": {
    "**/*": true,
    "**/*.yml": false
}

P.S. I understand there is a way to hide certain files, but I want to show only specific files. I don't mind using an extension to achieve this.

Mark
  • 143,421
  • 24
  • 428
  • 436
Sumit
  • 2,190
  • 23
  • 31
  • 2
    Unfortunately this has been an open issue since 2015. https://github.com/Microsoft/vscode/issues/869 – Alex Myers Sep 14 '18 at 13:19
  • Does this answer your question? [How do I hide certain files from the sidebar in Visual Studio Code?](https://stackoverflow.com/questions/30140112/how-do-i-hide-certain-files-from-the-sidebar-in-visual-studio-code) – JΛYDΞV May 13 '22 at 08:28

1 Answers1

4

This will get you pretty close:

"files.exclude": {

    "**/*.[^y]*": true,
    "**/*.y[^m]*": true,
    "**/*.ym[^l]*": true
}

It should exclude all files except those starting with a .ym(etc.) extension, like .yml, .ym, .ymabcdef, etc. I don't know if you have any other files besides .yml that match that pattern. I think right now this is as close as you can get to what you want. The last entry doesn't seem to actually do anything though it should!!

Mark
  • 143,421
  • 24
  • 428
  • 436