Code Intelligence
Rune's code intelligence is cross-language. The same lsp command drives
go to definition, find references, diagnostics, hover docs,
rename, formatting, and completion for every
first-class language. The keys
and workflow below are identical no matter which language server is
running underneath.
Each language layers its own dedicated command on top for
language-specific refactors and tooling. This page covers the shared
lsp command; the per-language guides cover the rest.
Code intelligence: the lsp command
lsp is the cross-language entry point for code intelligence. Run it as
lsp <subcommand>. Most subcommands act on the symbol under the cursor;
the navigation commands also accept an explicit symbol name as an
argument.
| Command | Argument | What it does | Preset key |
|---|---|---|---|
lsp hover | [<symbol>] | Show docs, types, and signatures for the symbol | <alt-t> |
lsp definition | [<symbol>] | Jump to where the symbol is defined | <alt-d> |
lsp declaration | [<symbol>] | Jump to the symbol's declaration | <alt-c> |
lsp type-definition | [<symbol>] | Jump to the symbol's type definition | <alt-y> |
lsp implementation | [<symbol>] | List implementations of the symbol | <alt-p> |
lsp references | [<symbol>] | List every use of the symbol | <alt-r> |
lsp complete | Show completions at the cursor | <ctrl-space> | |
lsp signature-help | Show the signature of the call at the cursor | <alt-g> | |
lsp rename | Rename the symbol at the cursor everywhere | not bound by selected preset | |
lsp format | Format the file, or the selection if text is selected | <alt-b> | |
lsp diagnostics | Open a picker with every diagnostic in the file | <alt-e> |
Go to definition
The everyday flow is to query whatever is under the cursor. Put the
cursor on a symbol and press <alt-d> to jump to where it is defined; no
argument, no typing. The same cursor-driven shortcut exists for each
navigation query:
| Key | Command | Jumps to |
|---|---|---|
<alt-d> | lsp definition | Where the symbol is defined |
<alt-t> | lsp hover | Its docs, type, and signature |
<alt-p> | lsp implementation | What implements it (or what it implements) |
<alt-r> | lsp references | Every use of it |
For hover, definition, declaration, type-definition,
implementation, and references, leaving the argument off always
targets the symbol you are sitting on. When you know the symbol's name
but not where it lives, use the by-name variant below instead.
Query any symbol by name
This is one of the most powerful ways to move around a codebase. You can
query a symbol (a function, type, variable, struct, interface, or method)
by name, without first having to find where it lives. If you remember
what something is called but not where it is defined, press
<alt-shift-d>, type the name,
and jump straight to its definition:
lsp definition NewServer
Each preset provides variants that pre-fill the prompt with the command and leave it open for you to type a name:
| Query | Preset key |
|---|---|
| Hover | <alt-shift-t> |
| Definition | <alt-shift-d> |
| References | <alt-shift-r> |
| Implementation | <alt-shift-p> |
This is the counterpart to Go to definition above: the plain keys act on the cursor, while these keys act on a name.
Diagnostics
lsp diagnostics (<alt-e>) opens a location picker listing every
diagnostic the language server reports for the file. To step through them
without the picker, use:
| Key | Action |
|---|---|
<ctrl-meta-l> | Jump to the next diagnostic |
<ctrl-meta-j> | Jump to the previous diagnostic |
These are aliases for jumptolocation next lsp-diagnostics and
jumptolocation previous lsp-diagnostics.
Highlighting occurrences
There is no command for this: Rune automatically highlights other occurrences of the symbol under the cursor shortly after the cursor settles. Move off the symbol and the highlight clears.
Preset key bindings
The selected editor preset binds the most common code-intelligence actions. See Key syntax for how the bindings are written.
| Key | Command | Target |
|---|---|---|
<alt-t> | lsp hover | Symbol under the cursor |
<alt-shift-t> | lsp hover | Symbol you fuzzy-search by name |
<alt-d> | lsp definition | Symbol under the cursor |
<alt-shift-d> | lsp definition | Symbol you fuzzy-search by name |
<alt-r> | lsp references | Symbol under the cursor |
<alt-shift-r> | lsp references | Symbol you fuzzy-search by name |
<alt-p> | lsp implementation | Symbol under the cursor |
<alt-shift-p> | lsp implementation | Symbol you fuzzy-search by name |
| not bound by selected preset | lsp rename | Symbol under the cursor |
<alt-b> | lsp format | The file, or the selection |
<alt-e> | lsp diagnostics | The whole file |
<ctrl-meta-l> | Next diagnostic | The whole file |
<ctrl-meta-j> | Previous diagnostic | The whole file |
<ctrl-space> | lsp complete | The cursor position |
On macOS, <ctrl-space>, used for completion by the Modal and Standard
presets, is reserved for input source switching. To use it for completion,
go to System Settings → Keyboard → Keyboard Shortcuts → Input Sources and
uncheck both entries.
Everything bound to a key is also available from the command
prompt, so you can run any lsp subcommand
by name even when it has no binding.