feat: expose typed core LSP binding actions

This commit is contained in:
Valdemar Lorenzen
2026-10-09 13:59:49 +02:00
parent e72f89a7ae
commit 529d1fd5b3
5 changed files with 27 additions and 5 deletions
+5 -1
View File
@@ -258,7 +258,8 @@ Vamp.configure do |config|
initialization_options: {},
settings: { "my-language-server" => { "exampleOption" => true } }
}
config.bind "leader d", "lsp_definition"
config.bind "leader d", config.core.lsp_definition
config.bind "leader D", config.core.lsp_diagnostics
end
```
@@ -272,6 +273,8 @@ The native module initializes each server, sends `initialization_options` as `in
`:lsp_definition` or the configured Space d binding requests a definition at the primary caret, once regardless of selection count. Both Location and LocationLink results are supported; multiple results use the first. Local-file navigation reuses loaded buffers without overwriting unsaved text. LSP UTF-16 positions and percent-encoded file URIs are translated to validated grapheme coordinates. Navigation is ignored if its source buffer, revision, caret, or latest request has changed.
For programmatic bindings, use `config.core.lsp_definition` and `config.core.lsp_diagnostics`, immutable Action objects eligible in Normal mode. Both route to the same native implementation as their Ex commands; no LSP keys are bound by default. These actions are also available in the command palette.
Diagnostics appear as severity-colored gutter numbers and text underlines; the primary caret's diagnostic appears in the message row. `:lsp_diagnostics` reports the current document's server state. Older versioned diagnostics are discarded; unversioned diagnostics can only be associated with the arrival-time document revision. Editing clears previous annotations immediately. Server startup/transport failures are reported and clear that server's diagnostics; other servers and native editing remain available. There are no automatic restarts.
Native LSP currently provides synchronization, diagnostics, and go-to-definition—not completion, hover, rename, formatting, code actions, workspace edits, or semantic highlighting. Tree-sitter remains the syntax highlighter. The former Ruby LSP plugin has been removed; migrate its `servers` entries to `config.lsp[language_id]` objects without the `language_id` field.
@@ -323,6 +326,7 @@ Key notation follows [Herdr's readable style](https://herdr.dev/docs/configurati
| Normal | `insert`, `append`, `open_below`, `open_above` |
| Normal, Visual | `insert_first_nonblank`, `append_line_end`, `clone_above`, `clone_below` |
| Normal | `join_lines`, `undo`, `redo`, `command` |
| Normal | `lsp_definition`, `lsp_diagnostics` |
| Normal | `search`, `paste_before`, `paste_after` |
| Normal | `paste_system_before`, `paste_system_after` |
| Normal, Visual | `select`, `search_next`, `search_previous` |