Tom Tom - 3 months ago 32
TypeScript Question

WebStorm, PHPStorm, Jetbrains IDEs - Ignore JS and MAP files in Typescript Project

Is there a way to ignore

*.js
and
*.js.map
in TypeScript project in Jetbrains IDEs ?

Right now, I have a TypeScript project in my PHPStorm and when searching for a file
ctrl+shift+N
I get all files -
*.ts, *.js, *.js.map
Which forces me to select one the typescript file everytime I search, instead of just quickly jumping to file.

Is there a way to filter compiled files from search? I tried scopes etc, but it doesn't do the trick.

PS: I know working on TypeScript it would be recommended to use WebStorm, but I find that PHPStorm gives me the best experience out of their products.

Answer

Actually this functionality is included in my PhpStorm 2016.2 installation on Linux, but I would assume it's not different than in other operating systems as it's cross-platform.

Option 1: There should be a filter button at the Ctrl+Shift+N file search dialog at the right top. filter button on search dialog you can directly deselect JavaScript files and from now on they won't show up in the search anymore. As *.map is not registered as file type by default you won't find it in the list (at least not on my installation). To achieve also *.map filtering register the filetype Settings -> Editor -> File Types -> "Recognized File Types" add a new file type with the name map - no more options needed - and add as "Registered Pattern" *.map (you can see this in action also in picture 2). Now this file type should be available for excluding from search too.

Option 2: You can hide *.js files as well as *.map files totally from your project by Settings -> Editor -> File Types -> "Ignore files and folders" add here *.js;*.map; settings dialog for creating map file type from now on these file types won't not just be hidden in the project but also not showing up on file search (Ctrl+Shift+N). If you need to check your JS and map files you could open a second editor for such cases, but I think you wouldn't need to do that too often, right?