Search code examples
webstormjetbrains-ide

How do I set the file mask for find in path for [.ts,.tsx] not for [.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

screenshot


Solution

  • 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:
    enter image description here

    With that mask enabled the IDE finds only 2 files:
    enter image description here


    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