Sublime Forum

Javascript GoTo variable?

#1

Hi! I am trying to use the GoTo Definition shortcut F12 to get to a variable.

{ "keys": ["f12"], "command": "goto_definition" },

I am trying to jump from where I am using the variable to the definition
48%20PM

In other editors I use the same goto definitions as I would for functions. I read that sublime does not index variables. Is there a trick for getting to a variable definition quickly with the keyboard?

0 Likes

#2

After some research I think I now understand how to do this! You need a language processor

  1. Install Package-Control
  2. Install Package: LSP
  3. Install Package: LSP-typescript
  4. Open Keybindings LSP
    • Copy the LSP GoTo Definition shortcut
[
  {
        "keys": ["f12"],
        "command": "lsp_symbol_definition",
        "args": {"side_by_side": false, "force_group": true, "fallback": false, "group": -1},
        "context": [
            {"key": "lsp.session_with_capability", "operand": "definitionProvider"},
            {"key": "auto_complete_visible", "operand": false}
        ]
    },	
]

sublime-goto

I am still a bit curious is this the sublime way to get to a definition?

0 Likes