Sumit
Sumit

Reputation: 2270

How to exclude all but certain files in the sidebar in Visual Studio Code?

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.

Upvotes: 11

Views: 5310

Answers (1)

Mark
Mark

Reputation: 180885

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!!

Upvotes: 4

Related Questions