2024-05-17 14:06:15 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
helpers,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib;
|
2024-12-22 09:58:27 +00:00
|
|
|
lib.nixvim.plugins.mkNeovimPlugin {
|
2024-05-17 14:06:15 +02:00
|
|
|
name = "rustaceanvim";
|
|
|
|
|
|
|
|
maintainers = [ maintainers.GaetanLepage ];
|
|
|
|
|
|
|
|
# TODO: introduced 2024-05-17, remove on 2024-02-17
|
|
|
|
deprecateExtraOptions = true;
|
|
|
|
optionsRenamedToSettings = import ./renamed-options.nix;
|
|
|
|
|
2025-04-27 09:53:12 +02:00
|
|
|
dependencies = [ "rust-analyzer" ];
|
2025-04-07 23:46:17 +02:00
|
|
|
imports = [
|
|
|
|
# TODO: added 2025-04-07, remove after 25.05
|
|
|
|
(lib.nixvim.mkRemovedPackageOptionModule {
|
|
|
|
plugin = "godot";
|
|
|
|
packageName = "rust-analyzer";
|
|
|
|
oldPackageName = "rustAnalyzer";
|
|
|
|
})
|
|
|
|
];
|
2024-05-17 14:06:15 +02:00
|
|
|
|
|
|
|
settingsOptions = import ./settings-options.nix { inherit lib helpers pkgs; };
|
|
|
|
|
|
|
|
settingsExample = {
|
|
|
|
server = {
|
|
|
|
standalone = false;
|
|
|
|
cmd = [
|
|
|
|
"rustup"
|
|
|
|
"run"
|
|
|
|
"nightly"
|
|
|
|
"rust-analyzer"
|
|
|
|
];
|
2024-07-10 22:30:09 +02:00
|
|
|
default_settings = {
|
2024-05-17 14:06:15 +02:00
|
|
|
rust-analyzer = {
|
|
|
|
inlayHints = {
|
|
|
|
lifetimeElisionHints = {
|
|
|
|
enable = "always";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
check = {
|
|
|
|
command = "clippy";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
callSetup = false;
|
2024-12-09 20:40:02 +01:00
|
|
|
hasLuaConfig = false;
|
2025-05-07 14:13:13 +01:00
|
|
|
extraConfig = cfg: {
|
|
|
|
globals.rustaceanvim = cfg.settings;
|
2024-08-20 22:52:34 -05:00
|
|
|
|
2025-05-07 14:13:13 +01:00
|
|
|
assertions = lib.nixvim.mkAssertions "plugins.rustaceanvim" {
|
|
|
|
assertion = cfg.enable -> !config.plugins.lsp.servers.rust_analyzer.enable;
|
|
|
|
message = ''
|
|
|
|
Both `plugins.rustaceanvim.enable` and `plugins.lsp.servers.rust_analyzer.enable` are true.
|
|
|
|
Disable one of them otherwise you will have multiple clients attached to each buffer.
|
|
|
|
'';
|
|
|
|
};
|
2024-09-08 22:19:02 -05:00
|
|
|
|
2025-05-07 14:13:13 +01:00
|
|
|
# TODO: remove after 24.11
|
|
|
|
warnings = lib.nixvim.mkWarnings "plugins.rustaceanvim" {
|
|
|
|
when = hasAttrByPath [
|
|
|
|
"settings"
|
|
|
|
"server"
|
|
|
|
"settings"
|
|
|
|
] cfg;
|
|
|
|
message = ''
|
|
|
|
The `settings.server.settings' option has been renamed to `settings.server.default_settings'.
|
2024-07-10 22:30:09 +02:00
|
|
|
|
2025-05-07 14:13:13 +01:00
|
|
|
Note that if you supplied an attrset and not a function you need to set this attr set in:
|
|
|
|
`settings.server.default_settings.rust-analyzer'.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2024-05-17 14:06:15 +02:00
|
|
|
}
|