'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.



Solution 1:[1]

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.

Solution 2:[2]

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.

Solution 3:[3]

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 :)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Paul Blessing
Solution 2 Alejandra
Solution 3 FrankyHollywood