Sublime Forum

Javascript GoTo variable?


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

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?



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}


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