Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ide sublime2 how to find method definition

I'm using Sublime 2 for Ruby On Rails programming. I need a ability to click a method name and jump to class where the method is defined. There are many IDE with similar capability...

like image 920
Lesha Pipiev Avatar asked Apr 23 '12 07:04

Lesha Pipiev


People also ask

How to go to function definition in sublime?

sublime-find-function-definitionHighlight a function and either hit F8 or right click and go to Find Function Definition . Plugin will search your project for the function and open a file up to it, or if multiple instances found display a list of files to open.

How do I search for a function in Sublime Text?

CTRL+SHIFT+R brings up the search panel for all indexed symbols.

Is Sublime Text an IDE?

Sublime can be used on Linux, Windows and Mac as an IDE for developing Chromium. Here's what works: Editing code works well (especially if you're used to it and get used to the shortcuts). Navigating around the code works well.


2 Answers

Goto symbol is Ctrl-R (linux), this gives a pop-up-list of all symbol and class definitions in the file, in definition order, and you can jump to what you're after. You could do the same thing with Goto Anything, Ctrl-P and then typing @ and the method name.

Also, there is a Goto Symbol plugin, which lets you jump straight to the definition of the method name your cursor is at, with a key binding or click.

However, both those methods are limited to the current file. If you need to jump to definitions in other files, probably the best solution is the SublimeCodeIntel plugin. It seems to be working pretty well and just by hitting Ctrl-f3 (linux) will open up the file at the definition you want.

like image 177
fraxel Avatar answered Nov 01 '22 18:11

fraxel


Another solution is CTags.

SublimeCodeIntel seems to be pretty buggy judging from unresolved issues on the Github tracker. Also it crashes for me, probably because the code base I'm working on is too big...

What I'm using now is the CTags package. There's no "intelligence" but it allows you to jump to definitions and back very easily and it is super fast.

like image 27
alienhard Avatar answered Nov 01 '22 19:11

alienhard