how to search for "apply"

assume i am looking for all apply-calls of something.

if it is an object i do a text search for "objectname(", but if it is a parameter or a local val, or a def, i will miss the calls.

find usages takes forever/a minute + usually locks up the ui.

will this be fixed eventually? i think the "common symbol seacrh takes long" problem exists since intellij 4.0 or so

5 comments
Comment actions Permalink
Official comment

Hi, Dennis,

Sorry for not responding to your ticket.

Find usages in general works in two steps. On the first step we use indices to find all text occurrences of the name of the element. After that we check if they are references to this element. Second step is much longer usually, because it requires type inference and can touch files where it was not cached yet. When name of the element is common in the codebase it can take a long time.

For apply/unapply methods we cannot use indices because they are not present in the text! For the same reason we have no Find Usages for implicits in the plugin. Current implementation for these methods is very naive and just checks all method calls or constructor patterns (we search on the possible use scope only, but it does not help much for public methods).

If you have any ideas how it can be improved or made differently please share. And I'll try to run the search in parallel, it should make things better.

Comment actions Permalink

There is an ticket that seems to address the issue you are describing: https://youtrack.jetbrains.com/issue/SCL-8987.

The developer responsible for 'find usages' has been notified. Feel free to comment/vote on the issue to make the fix arrive sooner.

0
Comment actions Permalink

I checked and found that it already runs concurrently. There was a related change in the IDEA platform in the Summer. If you still have it running on the single thread, we need to investigate it.

0
Comment actions Permalink

hm...

the only good answer i can come up with is "build a special index for commonly used names in advance or cache results somewhere so you don't have to repeat the entire search"

0
Comment actions Permalink

judging by the cpu load, it's running in parallel, but it does lock the ui easily if i start to edit the code while the search is running

0

Please sign in to leave a comment.