Go to method declaration

Sublimetext

Sublimetext Problem Overview


Is it possible to got to PHP method declaration through method call in Sublime Text?

// pressing some keys combination should navigate me
// to the method declaration. If it's defined in some other file,
// the file should be opened.
$foo->doSomething();

Sublimetext Solutions


Solution 1 - Sublimetext

Sublime 3 is the answer! It has a goto_definition function build in which works fine as long as you have a project with your source folder added (so that they can get indexed). I use it with scala+lift, PHP, Python.

Per default it is bound to F12 and without project setup it searches only in the actual file.

It was the missing feature to leave Eclipse and Netbeans.

Solution 2 - Sublimetext

Update (June 2016): @Erik255's answer is better now that Sublime Text 3 is out. Please upvote his. Since this is currently the accepted answer, these are the steps repeated:

  1. Use "File > Open Folder" or "Project > Add folder to project" (you may need to create a project first)
  2. F12 will jump to any symbol in the project

Original answer:

As of Sublime Text 2, you can use Goto anything (CTRL+R).

(searches only within the current page)


Solution 3 - Sublimetext

There is a CTags package for Sublime Text that makes it possible to use a project level .ctags .tags index file to jump to the definition of the symbol under the cursor by hitting ctrl+t twice: https://github.com/SublimeText/CTags

Solution 4 - Sublimetext

There is a great plugin called SublimeCodeIntel with the following features:

  • Jump to Symbol Definition - Jump to the file and line of the definition of a symbol.
  • Imports autocomplete - Shows autocomplete with the available modules/symbols in real time.
  • Function Call tooltips - Displays information in the status bar about the working function.

Solution 5 - Sublimetext

For Python,

I added the project to sublime.

I press CTRL+R and then start typing the name of my function. The cursor then points to the beginning of function definition.

Hope this helps.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRoman NewazaView Question on Stackoverflow
Solution 1 - SublimetextErik255View Answer on Stackoverflow
Solution 2 - SublimetextJayView Answer on Stackoverflow
Solution 3 - SublimetextogriselView Answer on Stackoverflow
Solution 4 - Sublimetextsanjith edwardView Answer on Stackoverflow
Solution 5 - SublimetextSwapnil B.View Answer on Stackoverflow