Ray
Ray

Reputation: 6115

intellij find usages behaving strangely

Is there a way to search a project for all uses of some text, without highlighting that text first. I.e. bring up a search interface, and then type in the text I want to find? I'm not seeing how to do this in the Intellij docs.

Note, when I select some text in a file and I do a Search->Find Usages, it responds by giving a little popup "Cannot find usages. Position to an element which usages you wish to find and try again". I get this whether I search on a variable name in a groovy file, or some text in a comment. So for some strange reason, this isn't working at all.

I'm using Intellij Ultimate 10.5 (version 10.5.1)

Thanks for any help or workarounds.

Upvotes: 3

Views: 3784

Answers (3)

FrankyHollywood
FrankyHollywood

Reputation: 1773

make sure project configuration is allright

  • File -> Project Structure -> Project -> set correct SDK
  • File -> Project Structure -> Projects Settings -> Modules -> + -> Import Module -> import your gradle or maven projects

now clear all existing cache

  • File -> Invalidate Caches

restart Intellij and wait until the indexes are rebuild. Worked for me :)

Upvotes: 0

Alejandra
Alejandra

Reputation: 882

I was having the exact same problem searching strings in strings.xml but the project wasn't compiled against that file. So make sure you have compiled against that build variant, module, flavour, etc.

Upvotes: 0

Paul Blessing
Paul Blessing

Reputation: 3845

Is Search->Find in Path what you're looking for? (Ctrl-Shift-F on Windows) You can find text in the whole project, a certain directory, or a custom scope.

Upvotes: 7

Related Questions