Question

If there is a method like def cookie_monster somewhere in the project and I'm in a file which is using cookie_monster, how do I quickly find the file and line where cookie_monster is defined?

I saw "Navigate Code, Not Text: How to Navigate Effectively in RubyMine" from PivotalLabs which says I can use command + option/alt + O but perhaps my key mappings are different (default RubyMine 6). That does nothing for me.

Était-ce utile?

La solution

Well I see you got your answer, but that isn't really the best solution, rubymine already caches all the function names and index it to find it fast without doing a search, try this method instead, it should be faster

Navigate -> Symbol

You'll get a small popup search bar, as soon as you write cook you should probably find your function in an auto complete, depending on your layout settings you'll find a nice shortcut to open it.

As a plus there's also

Navigate -> File

I never search for a file on the side bar to navigate, use this, it's always faster and will list all files with auto complete

The normal find function mentioned is used when you're trying to find a normal line of code, not a name of a function or a file.

Note that in both these popups you don't need to write the full name, for example to open the cookie_monster function, you can search for it as this comon ( co for cookie, and mon for monster ) you'll find it fun and very fast.

As for the find usages it's common usage for me is to find where a certain partial is called, or a certain function is used.

Autres conseils

Select the word.

Edit -> Find -> Find Usages

or

Edit -> Find -> Find in Path

For keyboard shortcut, use the one against the menu.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top