I would like to ignore JS files in my project when there's a matching TS _or_ matching TSX file. Right now I have to choose one or the other. Please support making the "when" directive in the "files.exclude" workspace setting use a regex, so I could do this:
{
"files.exclude": {
"**/*.js": { "when": "$(basename).tsx?"},
}
}
You may also want to add "when" to the docs.
There is a work around :smile:. Define define different regular expression that matches the same files:
{
"files.exclude": {
"**/*.js": { "when": "$(basename).ts"},
"**/*?.js": { "when": "$(basename).tsx"}
}
}
@bpasero can you pls check that we cover when in our docs.
It is here: https://code.visualstudio.com/docs/languages/typescript#_hiding-derived-javascript-files
+1 on this issue, although the workaround suggested by @egamma works for me
I would like to ignore *.d.ts when there is a corresponding .ts file. Unfortunately this rule just hides all d.ts files:
"src/**/*.d.ts": { "when": "$(basename).ts" },
Apparently, $(basename) doesn't match the * in *.d.ts but instead matches *.dt. This could be fixed using regular expressions (negative lookahead). A new variable like $(matchedname) might solve it but I see other problems with that approach.
+1 want this feature too.
and want search.exclude to support when too
@sparebytes seems like no further investigation has been made :( also looking forward to flexible exclusion
This would be extremely helpful in a lot of cases:
.d.ts files w/o a corresponding .ts.js.map files w/o a corresponding .tsIt is here: https://code.visualstudio.com/docs/languages/typescript#_hiding-derived-javascript-files
No more actual. Also for consistency reasons I would expect read about when on this page: https://code.visualstudio.com/docs/getstarted/settings
This is still an important issue that needs to be addressed. Being able to hide derived .ts and .tsx together is a common need.
Also, I've been searching for hours for any documentation about the when clause and have yet to find any.
+1
+1
Problem with mentioned workaround (use 2 glob patterns for js) is that it works only in Explorer but does not work in Search.
In Search it seems to find first glob pattern, then checks when and then breaks from loop, so it does not check the second glob/when combination.
Most helpful comment
There is a work around :smile:. Define define different regular expression that matches the same files:
@bpasero can you pls check that we cover
whenin our docs.