Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get Android Studio to stop returning generated code in search results?

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...

like image 737
Travis Avatar asked Jul 14 '14 18:07

Travis


People also ask

How to enable lint in Android Studio?

Configuring lint checking in Java and XML source files Tip: If you are using Android Studio, you can use the File > Settings > Project Settings > Inspections feature to manage the lint checking to your Java or XML source files.

How to create a search button in Android Studio?

Add the Search View to the App Bar To add a SearchView widget to the app bar, create a file named res/menu/options_menu. xml in your project and add the following code to the file. This code defines how to create the search item, such as the icon to use and the title of the item.


2 Answers

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:

enter image description here

14-October-2015 Update: I have improved the pattern by also excluding the !lib:*..* from the search. Thanks.

like image 69
Henrique de Sousa Avatar answered Oct 18 '22 04:10

Henrique de Sousa


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.

like image 27
Vinit Nayak Avatar answered Oct 18 '22 06:10

Vinit Nayak