20

I am trying to find a plugin on Sublime Text 3. Using this plugin I can click a function and go to the definition of this function within my project.

Does this plugin exist? Can you please provide a link? Hope it works on Javascript file, which I am learning right now.

I found this one here, but it does not work. https://github.com/timdouglas/sublime-find-function-definition

I cannot find this plugin in Package Install.

Nicolas S.Xu
  • 13,794
  • 31
  • 84
  • 129

2 Answers2

36

This feature already exists in Sublime Text.

After you select a function you must use F12 and a list with available definitions will appear.

You could check out this answer too: Sublime 3 - Set Key map for function Goto Definition

Edit:

In Sublime Text 3, with Build 3124, the available function definitions are also shown when hovering the function name.

Community
  • 1
  • 1
Catalin MUNTEANU
  • 5,618
  • 2
  • 35
  • 43
  • 1
    In Sublime Text 3, Build 3126 Goto Definition is not working properly for javascript. It returns all found files calling the method. – Quyen Nguyen Tuan Feb 22 '17 at 10:44
  • @QuyenNguyenTuan, unless there's something wrong with your installation, the behavior that you have described doesn't seem to reproduce with 3126 build. Please check the items in the list again since they should be links to function definitions. – Catalin MUNTEANU Feb 23 '17 at 08:04
  • @CMN, probably, there may be something wrong with my upgrade, the previous version works well. But after upgrade: https://cloudup.com/cO83FYnTlge – Quyen Nguyen Tuan Feb 23 '17 at 10:09
  • I get exactly the same behaviour as @QuyenNguyenTuan – Mike Burton Nov 29 '17 at 15:57
1

To jump into declaration with the help of mouse. Do following:

Linux - create Default (Linux).sublime-mousemap in ~/.config/sublime-text-3/Packages/User

Mac - create Default (OSX).sublime-mousemap in ~/Library/ApplicationSupport/Sublime Text 3/Packages/User

Win - create Default (Windows).sublime-mousemap in %appdata%\Sublime Text 3\Packages\User

Copy following lines to the file.

[
    {
        "button": "button1", 
        "count": 1, 
        "modifiers": ["ctrl"],
        "press_command": "drag_select",
        "command": "goto_definition"
    }
]
Community
  • 1
  • 1
Sujin Shrestha
  • 1,203
  • 2
  • 13
  • 23