refactor: nest Ruby LSP actions under core.lsp
This commit is contained in:
+1
-1
@@ -39,7 +39,7 @@ Set VAMP_RUBY to choose the Ruby executable.
|
||||
Native LSP is disabled by default: config.lsp[\"rust\"] = true enables a preset
|
||||
Custom languages: config.lsp[\"my-language\"] = { command: [...], extensions: [...] }
|
||||
LSP commands: :lsp_definition, :lsp_diagnostics, :lsp_hover
|
||||
Hover binding: config.bind \"K\", config.core.lsp_hover (no default key)";
|
||||
Hover binding: config.bind \"K\", config.core.lsp.hover (no default key)";
|
||||
|
||||
struct Options {
|
||||
file: Option<PathBuf>,
|
||||
|
||||
+13
@@ -873,6 +873,19 @@ end
|
||||
.unwrap_err()
|
||||
.contains("must be a String")
|
||||
);
|
||||
for target in [
|
||||
"config.core.lsp_hover",
|
||||
"config.core.lsp_definition",
|
||||
"config.core.lsp_diagnostics",
|
||||
"config.core.lsp.hvoer",
|
||||
"config.core.lsp",
|
||||
] {
|
||||
let invalid = fixture.file(
|
||||
"invalid_action.rb",
|
||||
&format!("Vamp.configure {{ |config| config.bind 'K', {target} }}"),
|
||||
);
|
||||
assert!(load_config(&invalid).is_err(), "{target}");
|
||||
}
|
||||
let invalid = fixture.file("core.rb", "Vamp.plugin 'evil', core: true");
|
||||
assert!(RubyPlugin::start(&invalid, &serde_json::json!({})).is_err());
|
||||
let invalid = fixture.file("syntax.rb", "this is not valid ruby (");
|
||||
|
||||
+12
-1
@@ -64,11 +64,22 @@ 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 lsp_hover
|
||||
].each do |name|
|
||||
action = Action.new("core.#{name}".freeze).freeze
|
||||
define_singleton_method(name) { action }
|
||||
end
|
||||
|
||||
module Lsp
|
||||
%w[definition diagnostics hover].each do |name|
|
||||
action = Action.new("core.lsp_#{name}".freeze).freeze
|
||||
define_singleton_method(name) { action }
|
||||
end
|
||||
end
|
||||
Lsp.freeze
|
||||
|
||||
def self.lsp
|
||||
Lsp
|
||||
end
|
||||
end
|
||||
|
||||
module Modes
|
||||
|
||||
Reference in New Issue
Block a user