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
+14
View File
@@ -254,6 +254,8 @@ enum Action {
Palette,
FilePicker,
FileExplorer,
LspDefinition,
LspDiagnostics,
}
// Names and mode eligibility are shared by configured bindings and the palette.
@@ -431,6 +433,16 @@ const CORE_ACTIONS: &[(&str, Action, &[Mode])] = &[
Action::FileExplorer,
&[Mode::Normal, Mode::Visual],
),
(
"core.lsp_definition",
Action::LspDefinition,
&[Mode::Normal],
),
(
"core.lsp_diagnostics",
Action::LspDiagnostics,
&[Mode::Normal],
),
];
impl Action {
@@ -1977,6 +1989,8 @@ impl Editor {
}
Action::FilePicker => self.open_file_picker(FilePresentation::Floating),
Action::FileExplorer => self.open_file_picker(FilePresentation::Docked),
Action::LspDefinition => return self.execute("lsp_definition"),
Action::LspDiagnostics => return self.execute("lsp_diagnostics"),
Action::Insert
| Action::InsertFirstNonblank
| Action::AppendLineEnd
+1
View File
@@ -64,6 +64,7 @@ module Vamp
copy_system paste_system_before paste_system_after
select_lines clone_above clone_below select_next skip_occurrence select_all
file_picker file_explorer
lsp_definition lsp_diagnostics
].each do |name|
action = Action.new("core.#{name}".freeze).freeze
define_singleton_method(name) { action }