mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-22 17:03:31 +02:00
plugins/rustaceanvim: Allow to add on_attach to rustaceanvim (#979)
* plugins/rustaceanvim: Add 'onAttach' * plugins/rustaceanvim: Put the configuration after the lsp setups to use __lspOnAttach
This commit is contained in:
parent
7164a89f72
commit
368f4d6a58
1 changed files with 40 additions and 33 deletions
|
@ -135,6 +135,8 @@ in {
|
||||||
```
|
```
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
onAttach = helpers.defaultNullOpts.mkLuaFn "__lspOnAttach" "Function to call on attach";
|
||||||
|
|
||||||
cmd = helpers.mkNullOrStrLuaFnOr (with types; listOf str) ''
|
cmd = helpers.mkNullOrStrLuaFnOr (with types; listOf str) ''
|
||||||
Command and arguments for starting rust-analyzer.
|
Command and arguments for starting rust-analyzer.
|
||||||
|
|
||||||
|
@ -241,7 +243,8 @@ in {
|
||||||
(cfg.rustAnalyzerPackage != null)
|
(cfg.rustAnalyzerPackage != null)
|
||||||
cfg.rustAnalyzerPackage;
|
cfg.rustAnalyzerPackage;
|
||||||
|
|
||||||
globals.rustaceanvim = with cfg;
|
plugins.lsp.postConfig = let
|
||||||
|
globalOptions = with cfg;
|
||||||
{
|
{
|
||||||
tools = with tools; {
|
tools = with tools; {
|
||||||
inherit executor;
|
inherit executor;
|
||||||
|
@ -265,6 +268,7 @@ in {
|
||||||
};
|
};
|
||||||
server = with server; {
|
server = with server; {
|
||||||
auto_attach = autoAttach;
|
auto_attach = autoAttach;
|
||||||
|
on_attach = onAttach;
|
||||||
inherit
|
inherit
|
||||||
cmd
|
cmd
|
||||||
settings
|
settings
|
||||||
|
@ -278,5 +282,8 @@ in {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// cfg.extraOptions;
|
// cfg.extraOptions;
|
||||||
|
in ''
|
||||||
|
vim.g.rustaceanvim = ${helpers.toLuaObject globalOptions}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue