How to search inside a specific block of code in IntelliJ IDEA?

How can I search in a specific block of code or in IntelliJ IDEA?

I'm used to using this feature in Eclipse. In Eclipse, you can simply double-click on the top of the curly brace and select the entire block of code. Then you can do Command + f
( Ctrl + f on Windows) to search ONLY in the selected block, or you can simply select everything you need and search for this particular block of code.

+4
source share
2 answers

Go to Settings | Keymap , find the Find ... action in the Other group. This action should have the following description:

Find a line in the active editor, show a modal dialog

Assign a key combination for this action (you need to make a copy of the map by default to change it), for example Ctrl + Alt + Shift + F.

When in the editor select any block of text, then click this shortcut, a dialog will open with Sphere automatically set to Selected text :

Find text

To quickly select the body of a method, standing on an open curly brace, use Ctrl + W.

+5
source

First select some text and press Ctrl + R to open the dialog box, then check the "in selection" option:

enter image description here

0
source

All Articles