Skip to content

Commit 5369714

Browse files
wdcocqtraxys
authored andcommitted
plugins/rustaceanvim: update options
1 parent d844ac1 commit 5369714

File tree

1 file changed

+103
-69
lines changed

1 file changed

+103
-69
lines changed

plugins/languages/rustaceanvim.nix

Lines changed: 103 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -27,92 +27,124 @@ in
2727
example = null;
2828
};
2929

30-
tools = {
31-
executor = helpers.defaultNullOpts.mkNullable (
32-
with helpers.nixvimTypes;
33-
either strLuaFn (enum [
30+
tools =
31+
let
32+
executors = [
3433
"termopen"
3534
"quickfix"
3635
"toggleterm"
3736
"vimux"
38-
])
39-
) "termopen" "How to execute terminal commands.";
40-
41-
onInitialized = helpers.mkNullOrLuaFn ''
42-
`fun(health:RustAnalyzerInitializedStatus)`
43-
Function that is invoked when the LSP server has finished initializing.
44-
'';
37+
"neotest"
38+
];
39+
testExecutors = executors ++ [ "background" ];
40+
in
41+
{
42+
executor = helpers.defaultNullOpts.mkEnum executors "termopen" ''
43+
`{execute_command} (fun(cmd:string,args:string[],cwd:string|nil,opts?:RustaceanExecutorOpts))`
44+
The executor to use for runnables/debuggables.
4545
46-
reloadWorkspaceFromCargoToml = helpers.defaultNullOpts.mkBool true ''
47-
Automatically call `RustReloadWorkspace` when writing to a `Cargo.toml` file.
48-
'';
46+
Example:
47+
```lua
48+
{
49+
execute_command = function(command, args, cwd, _)
50+
require('toggleterm.terminal').Terminal
51+
:new({
52+
dir = cwd,
53+
cmd = require('rustaceanvim.shell').make_command_from_args(command, args),
54+
close_on_exit = false,
55+
direction = 'vertical',
56+
})
57+
:toggle()
58+
end
59+
}
60+
```
61+
'';
4962

50-
hoverActions = {
51-
replaceBuiltinHover = helpers.defaultNullOpts.mkBool true ''
52-
Whether to replace Neovim's built-in `vim.lsp.buf.hover` with hover actions.
63+
testExecutor = helpers.defaultNullOpts.mkEnum testExecutors "termopen" ''
64+
`{execute_command} (fun(cmd:string,args:string[],cwd:string|nil,opts?:RustaceanExecutorOpts))`
65+
The executor to use for runnables that are tests/testables
5366
'';
54-
};
5567

56-
floatWinConfig = helpers.defaultNullOpts.mkAttrsOf types.anything ''
57-
{
58-
border = [
59-
["╭" "FloatBorder"]
60-
["─" "FloatBorder"]
61-
["╮" "FloatBorder"]
62-
["│" "FloatBorder"]
63-
["╯" "FloatBorder"]
64-
["─" "FloatBorder"]
65-
["╰" "FloatBorder"]
66-
["│" "FloatBorder"]
67-
];
68-
max_width = null;
69-
max_height = null;
70-
auto_focus = false;
71-
}
72-
'' "Options applied to floating windows. See |api-win_config|.";
73-
74-
crateGraph = {
75-
backend = helpers.defaultNullOpts.mkStr "x11" ''
76-
Backend used for displaying the graph.
77-
See: https://graphviz.org/docs/outputs
68+
crateTestExecutor = helpers.defaultNullOpts.mkEnum testExecutors "termopen" ''
69+
`{execute_command} (fun(cmd:string,args:string[],cwd:string|nil,opts?:RustaceanExecutorOpts))`
70+
The executor to use for runnables that are crate test suites (--all-targets)
7871
'';
7972

80-
output = helpers.mkNullOrStr ''
81-
Where to store the output.
82-
No output if unset.
83-
Relative path from `cwd`.
73+
onInitialized = helpers.mkNullOrLuaFn ''
74+
`fun(health:RustAnalyzerInitializedStatus)`
75+
Function that is invoked when the LSP server has finished initializing.
8476
'';
8577

86-
full = helpers.defaultNullOpts.mkBool true ''
87-
`true` for all crates.io and external crates, false only the local crates.
78+
reloadWorkspaceFromCargoToml = helpers.defaultNullOpts.mkBool true ''
79+
Automatically call `RustReloadWorkspace` when writing to a `Cargo.toml` file.
8880
'';
8981

90-
enabledGraphvizBackends =
91-
helpers.defaultNullOpts.mkListOf types.str
92-
''
93-
[
94-
"bmp" "cgimage" "canon" "dot" "gv" "xdot" "xdot1.2" "xdot1.4" "eps" "exr" "fig" "gd"
95-
"gd2" "gif" "gtk" "ico" "cmap" "ismap" "imap" "cmapx" "imap_np" "cmapx_np" "jpg"
96-
"jpeg" "jpe" "jp2" "json" "json0" "dot_json" "xdot_json" "pdf" "pic" "pct" "pict"
97-
"plain" "plain-ext" "png" "pov" "ps" "ps2" "psd" "sgi" "svg" "svgz" "tga" "tiff"
98-
"tif" "tk" "vml" "vmlz" "wbmp" "webp" "xlib" "x11"
99-
]
100-
''
101-
''
102-
Override the enabled graphviz backends list, used for input validation and autocompletion.
103-
'';
104-
105-
pipe = helpers.mkNullOrStr ''
106-
Override the pipe symbol in the shell command.
107-
Useful if using a shell that is not supported by this plugin.
82+
hoverActions = {
83+
replaceBuiltinHover = helpers.defaultNullOpts.mkBool true ''
84+
Whether to replace Neovim's built-in `vim.lsp.buf.hover` with hover actions.
85+
'';
86+
};
87+
88+
floatWinConfig = helpers.defaultNullOpts.mkAttrsOf types.anything ''
89+
{
90+
border = [
91+
["╭" "FloatBorder"]
92+
["─" "FloatBorder"]
93+
["╮" "FloatBorder"]
94+
["│" "FloatBorder"]
95+
["╯" "FloatBorder"]
96+
["─" "FloatBorder"]
97+
["╰" "FloatBorder"]
98+
["│" "FloatBorder"]
99+
];
100+
max_width = null;
101+
max_height = null;
102+
auto_focus = false;
103+
}
104+
'' "Options applied to floating windows. See |api-win_config|.";
105+
106+
crateGraph = {
107+
backend = helpers.defaultNullOpts.mkStr "x11" ''
108+
Backend used for displaying the graph.
109+
See: https://graphviz.org/docs/outputs
110+
'';
111+
112+
output = helpers.mkNullOrStr ''
113+
Where to store the output.
114+
No output if unset.
115+
Relative path from `cwd`.
116+
'';
117+
118+
full = helpers.defaultNullOpts.mkBool true ''
119+
`true` for all crates.io and external crates, false only the local crates.
120+
'';
121+
122+
enabledGraphvizBackends =
123+
helpers.defaultNullOpts.mkListOf types.str
124+
''
125+
[
126+
"bmp" "cgimage" "canon" "dot" "gv" "xdot" "xdot1.2" "xdot1.4" "eps" "exr" "fig" "gd"
127+
"gd2" "gif" "gtk" "ico" "cmap" "ismap" "imap" "cmapx" "imap_np" "cmapx_np" "jpg"
128+
"jpeg" "jpe" "jp2" "json" "json0" "dot_json" "xdot_json" "pdf" "pic" "pct" "pict"
129+
"plain" "plain-ext" "png" "pov" "ps" "ps2" "psd" "sgi" "svg" "svgz" "tga" "tiff"
130+
"tif" "tk" "vml" "vmlz" "wbmp" "webp" "xlib" "x11"
131+
]
132+
''
133+
''
134+
Override the enabled graphviz backends list, used for input validation and autocompletion.
135+
'';
136+
137+
pipe = helpers.mkNullOrStr ''
138+
Override the pipe symbol in the shell command.
139+
Useful if using a shell that is not supported by this plugin.
140+
'';
141+
};
142+
143+
openUrl = helpers.defaultNullOpts.mkLuaFn "require('rustaceanvim.os').open_url" ''
144+
If set, overrides how to open URLs.
108145
'';
109146
};
110147

111-
openUrl = helpers.defaultNullOpts.mkLuaFn "require('rustaceanvim.os').open_url" ''
112-
If set, overrides how to open URLs.
113-
'';
114-
};
115-
116148
server = {
117149
autoAttach = helpers.mkNullOrStrLuaFnOr types.bool ''
118150
Whether to automatically attach the LSP client.
@@ -238,6 +270,8 @@ in
238270
{
239271
tools = with tools; {
240272
inherit executor;
273+
test_executor = testExecutor;
274+
crate_test_executor = crateTestExecutor;
241275
on_initialized = onInitialized;
242276
reload_workspace_from_cargo_toml = reloadWorkspaceFromCargoToml;
243277
hover_actions = {

0 commit comments

Comments
 (0)