Sublime Forum

Follow symbols in project and libraries in Rust

#1

VS code allows following symbols through crates inside and outside the project - i.e. standard library via ctrl+click. The sublime editor allows to follow via F12 but doesn’t follow libraries symbol; instead on mouseover in sublime, have “references to” popup. How do we configure ctrl+click instead of f12 to follow both internal symbols and external libraries and documentation like in VS code? I can live with ctrl+key instead of click; may be even better.

0 Likes

#2

In ST, Ctrl + left click = place a new caret. But if you insist, a custom plugin can probably achieve what you want.

Other than that, native documentation support isn’t possible. Native “goto definition” and “goto reference” are not accurate (since ST doesn’t really “unstandand” codes). By the term “native”, I mean without any ST plugin.

I feel what you want are


As a note, I don’t write Rust, at least at this moment.

1 Like

#3

I do have both LSP and LSP-rust-analyzer installed and working, but they behave differently under VS Code - in VS Code with Rust-analyzer it’s possible to follow methods from standard library: i.e. clicking on

use std::collections::hash_map::Entry;

will lead to Enum entry inside the standard library, where hitting F12 would not do anything in ST.
If there is a settings or easy hack to make it work it will help my flow.

0 Likes

#4

Check LSP’s default keybindings file. There are many unbound functionailties that you will interested in. F12 is still ST’s goto definition unless you have something overwrite it.

Before you manually bind them, to check Enum entry’s goto definition, hover on it and press “Definition” in the popup.

0 Likes

#5

Yes, I needed to add LSP-Rust-analyzer and redefine:

{ "keys": ["shift+right"], "command": "goto_definition" },

I guess Definitions in Rust-Analyzer and goto_definitions are the same bindings.

0 Likes

#6

Thank you. How can I check LSP keybinding file?

0 Likes

#7

Nothing different from other plugins. Main menu > Preferences > Packages Settings > LSP > Keybindings.

0 Likes

#8

No. The correct one is

    // Goto Definition
    // {
    //     "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}
    //     ]
    // },

which you can find in LSP’s keybinding file but they are commented out.

0 Likes

#9

Thank you, this is exactly what I needed.

0 Likes