JavaScriptEnhancements icon indicating copy to clipboard operation
JavaScriptEnhancements copied to clipboard

Click go to definition

Open arnsa opened this issue 6 years ago • 4 comments

Is it possible to somehow add a shortcut (e.g. ctrl+click) to go to definition? The default one from Sublime doesn't work. :(

arnsa avatar May 12 '18 07:05 arnsa

To add a custom key binding go to Preferences > Key Bindings and add your keys. For example:

[
  {
    "keys": ["super+alt+g"], // This is the default key binding for Go to definition feature!
    "command": "javascript_enhancements_go_to_definition"
  }
]

Here the docs: http://docs.sublimetext.info/en/latest/reference/key_bindings.html

pichillilorenzo avatar May 12 '18 08:05 pichillilorenzo

@pichillilorenzo but what about ctrl+click? I've tried to set it up like this in Default (OSX).sublime-mousemap file, but it doesn't work :(

[ { "button": "button1", "count": 1, "modifiers": ["ctrl"], "press_command": "drag_select", "command": "javascript_enhancements_go_to_definition" } ]

arnsa avatar May 12 '18 09:05 arnsa

@arnsa works for me:

[
     {
      "button": "button1",
      "count": 1,
      "modifiers": ["super"], // "super" is cmd button. "ctrl" also works fine
      "press_command": "drag_select",
      "command": "javascript_enhancements_go_to_definition",
      "context": [
           { "key": "selector", "operator": "equal", "operand": "source.js, source.jsx" }
      ]
   }
]

helsus avatar Jul 13 '18 10:07 helsus

@helsus thanks, it didn't work with super (probably because cmd+click adds new cursor on sublime, but it worked with ctrl! It doesn't open a file when I click on an import :(, any ideas why?

arnsa avatar Aug 09 '18 10:08 arnsa