How to exclude a file extension from IntelliJ IDEA search?
Clash Royale CLAN TAG#URR8PPP
How to exclude a file extension from IntelliJ IDEA search?
Is there a way to exclude particular file extension from the results in IntelliJ IDEA's "Find in Path" dialog (invoked by CTRL + SHIFT + F)? I want to exclude all .css
files.
.css
2 Answers
2
In intellij 16 there is a section "File name Filter" to exclude an extension use !*.java
. You can give more detailed patterns as well for example I use the pattern below to only return .java files except those with a name starting or ending with test.
Pattern: !*test.java,*.java,!Test*.java
!*.java
!*test.java,*.java,!Test*.java
In recent versions of Intellij the GUI has been updated a bit but the same still applies see the "File mask" on the top right hand corner see image below:
Can I not mention !mocks/*.json in the File Masks filter ?
– CodeTweetie
Oct 23 '17 at 10:12
@CodeTweetie what are your doing to do with the '/' not sure why its needed (i thought '/' is just a delimiter in regex). without it your filter would say exclude any file that starts with "mock"s followed by anything ending in ".json"
– Marquis Blount
Oct 27 '17 at 17:13
This "File name Filter" dialogue doesn't seem to exist in recent versions (2018.1, etc.).
– J Woodchuck
Aug 6 at 20:39
@JWoodchuck please see my updated answer
– Marquis Blount
Aug 8 at 2:48
You can create custom scope there:
In 'Find in Path' dialog you can check radio button 'Custom' and open scopes window.
There you can customize path and search pattern.
Examples of Patterns for Pattern
field:
Pattern
file[MyMod]:src/main/java/com/example/my_package//*
src[MyMod]:com.example.my_package..*
file:*.js||file:*.coffee
file:*js&&!file:*.min.*
Or check the official documentation.
Good luck!
So what is the pattern to exclude all CSS style sheets?
– Robert Kusznier
Mar 3 '14 at 11:15
Sorry, it's in IntelliJ's documentation: jetbrains.com/idea/webhelp/scope-language-syntax-reference.html. For excluding CSS it's: !file:*.css.
– Robert Kusznier
Mar 3 '14 at 11:20
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
This should be the accepted answer, at least for Eclipse converts ;)
– Giovanni
Mar 28 '17 at 12:55