Sergey
Sergey

Reputation: 65

How to search for text in entire IntelliJ project?

I'm looking to replace every instance of a variable in my IntelliJ project. I know that it is present in quite a few files within the project, but I can't find a way to find them all. Is the some way to search for a variable in all of the files I have at once? I am on Windows.

Upvotes: 2

Views: 3354

Answers (2)

Konstantin Annikov
Konstantin Annikov

Reputation: 12865

While the cursor is on the variable, press Shift + F6 or from the main menu, select Refactor | Rename action.

IntelliJ IDEA will search and rename other code-occurrences automatically. It can also rename those occurrences in comments, strings and texts if wanted.

See: Rename refactorings | IntelliJ IDEA Documentation

Upvotes: 1

MCI
MCI

Reputation: 922

Press Ctrl + Shift + F to open the Find in Files modal dialog and search all file contents.

Press Ctrl + Shift + R to open the Replace in Path modal dialog.

See: Search and replace a target within a project | IntelliJ IDEA Documentation.

Upvotes: 3

Related Questions