Pregunta
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();
Solución
Edit (June 2016): Erik255's answer below is better now that Sublime Text 3 is out. Please upvote his. Since this is currently the accepted answer, these are the steps repeated:
- Use "File > Open Folder" or "Project > Add folder to project" (you may need to create a project first)
- 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)
Otros consejos
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.
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
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.
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.