plugins/rustaceanvim: update options

This commit is contained in:
Wester de Cocq 2024-05-15 23:49:15 +02:00 committed by traxys
parent d844ac1a06
commit 53697141b5

View file

@ -27,92 +27,124 @@ in
example = null; example = null;
}; };
tools = { tools =
executor = helpers.defaultNullOpts.mkNullable ( let
with helpers.nixvimTypes; executors = [
either strLuaFn (enum [
"termopen" "termopen"
"quickfix" "quickfix"
"toggleterm" "toggleterm"
"vimux" "vimux"
]) "neotest"
) "termopen" "How to execute terminal commands."; ];
testExecutors = executors ++ [ "background" ];
in
{
executor = helpers.defaultNullOpts.mkEnum executors "termopen" ''
`{execute_command} (fun(cmd:string,args:string[],cwd:string|nil,opts?:RustaceanExecutorOpts))`
The executor to use for runnables/debuggables.
onInitialized = helpers.mkNullOrLuaFn '' Example:
`fun(health:RustAnalyzerInitializedStatus)` ```lua
Function that is invoked when the LSP server has finished initializing. {
''; execute_command = function(command, args, cwd, _)
require('toggleterm.terminal').Terminal
:new({
dir = cwd,
cmd = require('rustaceanvim.shell').make_command_from_args(command, args),
close_on_exit = false,
direction = 'vertical',
})
:toggle()
end
}
```
'';
reloadWorkspaceFromCargoToml = helpers.defaultNullOpts.mkBool true '' testExecutor = helpers.defaultNullOpts.mkEnum testExecutors "termopen" ''
Automatically call `RustReloadWorkspace` when writing to a `Cargo.toml` file. `{execute_command} (fun(cmd:string,args:string[],cwd:string|nil,opts?:RustaceanExecutorOpts))`
''; The executor to use for runnables that are tests/testables
'';
hoverActions = { crateTestExecutor = helpers.defaultNullOpts.mkEnum testExecutors "termopen" ''
replaceBuiltinHover = helpers.defaultNullOpts.mkBool true '' `{execute_command} (fun(cmd:string,args:string[],cwd:string|nil,opts?:RustaceanExecutorOpts))`
Whether to replace Neovim's built-in `vim.lsp.buf.hover` with hover actions. The executor to use for runnables that are crate test suites (--all-targets)
'';
onInitialized = helpers.mkNullOrLuaFn ''
`fun(health:RustAnalyzerInitializedStatus)`
Function that is invoked when the LSP server has finished initializing.
'';
reloadWorkspaceFromCargoToml = helpers.defaultNullOpts.mkBool true ''
Automatically call `RustReloadWorkspace` when writing to a `Cargo.toml` file.
'';
hoverActions = {
replaceBuiltinHover = helpers.defaultNullOpts.mkBool true ''
Whether to replace Neovim's built-in `vim.lsp.buf.hover` with hover actions.
'';
};
floatWinConfig = helpers.defaultNullOpts.mkAttrsOf types.anything ''
{
border = [
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
];
max_width = null;
max_height = null;
auto_focus = false;
}
'' "Options applied to floating windows. See |api-win_config|.";
crateGraph = {
backend = helpers.defaultNullOpts.mkStr "x11" ''
Backend used for displaying the graph.
See: https://graphviz.org/docs/outputs
'';
output = helpers.mkNullOrStr ''
Where to store the output.
No output if unset.
Relative path from `cwd`.
'';
full = helpers.defaultNullOpts.mkBool true ''
`true` for all crates.io and external crates, false only the local crates.
'';
enabledGraphvizBackends =
helpers.defaultNullOpts.mkListOf types.str
''
[
"bmp" "cgimage" "canon" "dot" "gv" "xdot" "xdot1.2" "xdot1.4" "eps" "exr" "fig" "gd"
"gd2" "gif" "gtk" "ico" "cmap" "ismap" "imap" "cmapx" "imap_np" "cmapx_np" "jpg"
"jpeg" "jpe" "jp2" "json" "json0" "dot_json" "xdot_json" "pdf" "pic" "pct" "pict"
"plain" "plain-ext" "png" "pov" "ps" "ps2" "psd" "sgi" "svg" "svgz" "tga" "tiff"
"tif" "tk" "vml" "vmlz" "wbmp" "webp" "xlib" "x11"
]
''
''
Override the enabled graphviz backends list, used for input validation and autocompletion.
'';
pipe = helpers.mkNullOrStr ''
Override the pipe symbol in the shell command.
Useful if using a shell that is not supported by this plugin.
'';
};
openUrl = helpers.defaultNullOpts.mkLuaFn "require('rustaceanvim.os').open_url" ''
If set, overrides how to open URLs.
''; '';
}; };
floatWinConfig = helpers.defaultNullOpts.mkAttrsOf types.anything ''
{
border = [
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
["" "FloatBorder"]
];
max_width = null;
max_height = null;
auto_focus = false;
}
'' "Options applied to floating windows. See |api-win_config|.";
crateGraph = {
backend = helpers.defaultNullOpts.mkStr "x11" ''
Backend used for displaying the graph.
See: https://graphviz.org/docs/outputs
'';
output = helpers.mkNullOrStr ''
Where to store the output.
No output if unset.
Relative path from `cwd`.
'';
full = helpers.defaultNullOpts.mkBool true ''
`true` for all crates.io and external crates, false only the local crates.
'';
enabledGraphvizBackends =
helpers.defaultNullOpts.mkListOf types.str
''
[
"bmp" "cgimage" "canon" "dot" "gv" "xdot" "xdot1.2" "xdot1.4" "eps" "exr" "fig" "gd"
"gd2" "gif" "gtk" "ico" "cmap" "ismap" "imap" "cmapx" "imap_np" "cmapx_np" "jpg"
"jpeg" "jpe" "jp2" "json" "json0" "dot_json" "xdot_json" "pdf" "pic" "pct" "pict"
"plain" "plain-ext" "png" "pov" "ps" "ps2" "psd" "sgi" "svg" "svgz" "tga" "tiff"
"tif" "tk" "vml" "vmlz" "wbmp" "webp" "xlib" "x11"
]
''
''
Override the enabled graphviz backends list, used for input validation and autocompletion.
'';
pipe = helpers.mkNullOrStr ''
Override the pipe symbol in the shell command.
Useful if using a shell that is not supported by this plugin.
'';
};
openUrl = helpers.defaultNullOpts.mkLuaFn "require('rustaceanvim.os').open_url" ''
If set, overrides how to open URLs.
'';
};
server = { server = {
autoAttach = helpers.mkNullOrStrLuaFnOr types.bool '' autoAttach = helpers.mkNullOrStrLuaFnOr types.bool ''
Whether to automatically attach the LSP client. Whether to automatically attach the LSP client.
@ -238,6 +270,8 @@ in
{ {
tools = with tools; { tools = with tools; {
inherit executor; inherit executor;
test_executor = testExecutor;
crate_test_executor = crateTestExecutor;
on_initialized = onInitialized; on_initialized = onInitialized;
reload_workspace_from_cargo_toml = reloadWorkspaceFromCargoToml; reload_workspace_from_cargo_toml = reloadWorkspaceFromCargoToml;
hover_actions = { hover_actions = {