Shorn
Shorn

Reputation: 21426

IntelliJ - How to find all method names matching a string pattern?

Trying to find any method name in my project matching a specific sub-string.

The example I'm currently looking for is "domain", so I'd want to see getDomain(), setDomain(), domainThing(), etc. in the results. Looking for static/instance methods of any visibility.

Find Symbol (Ctrl+Alt+Shift+N) comes close, but there's too many classes and fields cluttering up the results. Is there a way to restrict Find Symbol to only methods? Or at least group the results by symbol type?

Structural Search might be the answer, but it's comically unusable interface and documentation have defeated me once again.

Upvotes: 2

Views: 348

Answers (1)

CrazyCoder
CrazyCoder

Reputation: 401877

SSR is the way to go. There is an existing template for the methods of the class you can start with.

Click on $Method$, Edit filters, Add filter, Text.

Enter regex to match your methods, for example .*domain.*.

Uncheck the Match case checkbox.

The final result should look like this:

enter image description here

Upvotes: 4

Related Questions