5

There is an option to exclude generated files with the "when" keyword, .e.g:

"files.exclude": {
  "**/*.js": { "when": "$(basename).ts"},
}

I want to also exclude .js files that where generated from .tsx files. neither

"**/*.js": { "when": "$(basename).ts, $(basename).tsx"}

nor

"**/*.js": { "when": "$(basename).ts"},
"**/*.js": { "when": "$(basename).tsx"}

worked.

I also tried "**/*.js": { "when": "$(basename).ts*"} and "**/*.js": { "when": "$(basename).ts | $(basename).tsx"} in vain.

Is there a way to do it?

GSerg
  • 76,472
  • 17
  • 159
  • 346
ziv
  • 3,641
  • 3
  • 21
  • 26
  • 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:24
  • This Q&A is a **DUPLICATE OF:** _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:25

2 Answers2

12

Try this:

"**/*.js": { "when": "$(basename).ts"},
"**/*?.js": { "when": "$(basename).tsx"}

Source: Microsoft/vscode#1214

Louay Alakkad
  • 7,132
  • 2
  • 22
  • 45
2

These are my settings if they help. It is quite a mess in creating these. I think that a regexp would be great, but we live in hard times ....

"files.exclude": {
"**/*.js": { "when": "$(basename).tsx"},
"**/*?.js": { "when": "$(basename).ts"},
"**/*.js.map": true
}