I have a class with lombok annotation (either @Value
or @Data
) and I am looking for an easy way to find usages of the auto generated constructor.
What I can do now is to find a one use of the constructor, put the cursor there and run 'Find usages' command and I get the results I want.
However I would like to do this directly from the class declaration. Is there a way to do that?
In the editor, select a symbol for which you want to see the usages. From the main menu, select Edit | Find Usages | Show Usages In Code Ctrl+Alt+F7 . The usages window shows the current scope and total count of usages. If you want to quickly switch to the default scope, press Ctrl+Alt+F7 .
Find generated class in folder target/././classname. class and open it in IntelliJ IDEA.
Press ⌥F7 (macOS), or Alt+F7 (Windows/Linux), to bring up the Find Usages tool window. You can search a single file, your whole project, or customise the scope. You can also configure the color of the usages highlighting or disable the automatic highlighting of usages.
I have finally found an acceptable solution to this:
@Builder
is present).Not as easy as Find Usages, but you could use Structural Search for this. Use the button Copy existing template...
and choose new expressions
:
new $Constructor$($Argument$)
Edit variables to set the text/regexp of Constructor
to your classname.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With