英文:
How do I set the file mask for find in path for [.ts,.tsx] not for [.d.ts]?
问题
我想在WebStorm中对ts和tsx文件使用“在路径中查找”,但它给了我不需要的.d.ts文件。
我尝试在文件掩码中设置*.tsx,*(^.d).ts,但不起作用。
*.tsx,*.ts ->  .tsx+.ts+.d.ts,不需要.d.ts
*.tsx,*(^.d).ts -> 不起作用
英文:
I want to use Find in Path for ts and tsx files in WebStorm, but it gives me .d.ts files I didn't need.
I tried to set *.tsx,*(^.d).ts in file mask, but it doesn't work.
*.tsx,*.ts ->  .tsx+.ts+.d.ts, .d.ts is not needed
*.tsx,*(^.d).ts -> doesn't work
答案1
得分: 1
使用!在文件名部分的开头用于否定,例如尝试以下操作:!*.d.ts,*.tsx,*.ts
这是我在.php文件中搜索但忽略.d.php的方式--!*.d.php,*.php(我在实验中使用了.php文件而不是.js文件)。
正如您可以看到,它找到了所有3个结果:
启用了该掩码后,IDE只会找到2个文件:
另一种方法是创建一个自定义范围,该范围将包括具有所需文件扩展名的文件,然后在进行搜索时选择它。
英文:
Use ! at the start of the file name part for negating, e.g. try the following: !*.d.ts,*.tsx,*.ts
Here is me searching in .php file but ignoring .d.php -- !*.d.php,*.php (I've simply used .php file instead of .js in my experiment).
As you may see it finds all 3 results:
![如何为查找路径中的[.ts, .tsx] 设置文件掩码,而不是[.d.ts]?](https://i.stack.imgur.com/c3T3K.png)
With that mask enabled the IDE finds only 2 files:
![如何为查找路径中的[.ts, .tsx] 设置文件掩码,而不是[.d.ts]?](https://i.stack.imgur.com/HOW3S.png)
Another approach is to make a Custom Scope that will include files with desired file extensions and then selecting it when doing a search.
https://www.jetbrains.com/help/webstorm/configuring-scopes-and-file-colors.html
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论