Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Go to method declaration

Tags:

sublimetext

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();
like image 533
Roman Newaza Avatar asked Mar 07 '12 01:03

Roman Newaza


People also ask

What is go to declaration?

As Go to Declaration (including its Ctrl -click access) is one of the most frequently used commands, JetBrains Rider streamlines your navigation experience letting you use this command in navigation scenarios related to usages of the declared symbol, so you can invoke Go to Declaration even if your caret is already at ...

How do I navigate to declaration in IntelliJ?

Press Ctrl+Shift+F11 or choose Navigate | Go to Type Declaration from the main menu . Alternatively, you can press Ctrl+Shift+A , start typing the command name in the popup, and then choose it there. If the command returns a single result, JetBrains Rider navigates directly there.

How do I get to the declaration in Visual Studio?

Go To Definition/Declaration You can navigate to the definition of a code symbol by right-clicking it in the editor and selecting Go To Definition, or by selecting F12. You can navigate to a declaration similarly by right-clicking to open the context menu, or by selecting Ctrl+F12.

How do you jump to method in IntelliJ?

Go to implementation To navigate to the super method, press Ctrl+U . To navigate to the implementation, press Ctrl+Alt+B .


4 Answers

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.

like image 59
Erik255 Avatar answered Oct 13 '22 19:10

Erik255


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)


like image 32
Jay Avatar answered Oct 13 '22 19:10

Jay


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

like image 14
ogrisel Avatar answered Oct 13 '22 18:10

ogrisel


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.
like image 3
sanjith edward Avatar answered Oct 13 '22 19:10

sanjith edward