feat: expose typed core LSP binding actions
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user