How do I get Android Studio to stop returning generated code in search results?
AndroidAndroid StudioAndroid Problem Overview
Every time I use Search In Path
in Android Studio, I end up with generated code being returned as the first section of results.
I usually search for something in *.java,*.xml
, and usually investigate the first few results before I realize I'm looking at Generated Code
. Is there a way to omit the generated code results from being returned as part of the result list, while still allowing the search to read all of the *.java and *.xml files in my project?
I have a feeling this is something beyond ridiculously simple, but I just can't find the right button to toggle.
In the same vein, is it possible to ignore generated classes when loading files or types? I keep getting the generated MyClass$$ViewInjector
classes appearing first in open files, and it's just annoying...
Android Solutions
Solution 1 - Android
The way I've been doing to ignore generated classes in advanced search is adding !file:*intermediates*/&&!file:*generated*/&&!lib:*..*
to a new Custom Scope, like this:
14-October-2015 Update: I have improved the pattern by also excluding the !lib:*..*
from the search. Thanks.
Solution 2 - Android
I've seen this in IntelliJ, haven't checked in Android Studio. But when you do find in path (via ctrl+shift+F) there's a "File name filter" section in the search popup which has a checkbox called "File masks" which you might be able to filter desired file types.
Solution 3 - Android
For me, just to add to the answer, the scope !file:*intermediates*/&&!file:*generated*/&&!file:*build*/&&!lib:*..*
worked even better!