How to exclude a file extension from an IntelliJ IDEA search?

Is there a way to exclude a specific file extension from the results in IntelliJ IDEA Find In Path Dialog Box ( CTRL + SHIFT + F is called)? I want to exclude all .css files.

+88
intellij-idea
Mar 03 '14 at 10:13
source share
3 answers

Intellij 16 has a “File Name Filter” section to exclude the use of the !*.java extension. You can also give more detailed templates, for example, I use the template below to return only .java files, except for those whose name begins or ends with test. Template !*test.java,*.java,!Test*.java

enter image description here

In recent versions of Intellij, the GUI has been slightly updated, but the same applies, see "File mask" in the upper right corner, see Image below:

enter image description here

+129
Jun 13 '16 at 2:40
source share

There you can create your own area: in the Find on the Way dialog box, you can select the Custom radio button and open the areas window. There you can customize the path and search pattern.

enter image description here

Examples of patterns for the Pattern field:

  • !file:*.css - exclude CSS files
  • file[MyMod]:src/main/java/com/example/my_package//* - includes files from the directory in the project.
  • src[MyMod]:com.example.my_package..* - recursively include all files in the package.
  • file:*.js||file:*.coffee - includes all JavaScript and CoffeeScript files.
  • file:*js&&!file:*.min.* - includes all JavaScript files except those generated as a result of minification, which is indicated by the min extension.

Or check the official documentation.

Good luck

+42
03 Mar. '14 at 10:35
source share

This would exclude all js, css and twig, for example:

 !*.js, !*.css, !*.twig 

PhpStorm File Masks for Find in Path

0
Jun 05 '19 at 15:44 on
source share



All Articles