4

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
  • 73,524
  • 17
  • 153
  • 317
ziv
  • 3,114
  • 3
  • 20
  • 23
  • 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 D3V 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 D3V May 13 '22 at 08:25

2 Answers2

11

Try this:

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

Source: Microsoft/vscode#1214

Louay Alakkad
  • 6,824
  • 2
  • 21
  • 44
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
}