feat(rust): add assertion and comment on configuration

This commit is contained in:
Samuel Cobb 2026-06-05 04:06:23 +01:00
commit ad13549beb
2 changed files with 9 additions and 6 deletions

View file

@ -74,7 +74,8 @@ isMaximal: {
typst.enable = isMaximal;
rust = {
enable = isMaximal;
extensions.rustaceanvim.enable = isMaximal;
# Can only be enabled if lsp.enable = false
extensions.rustaceanvim.enable = false;
extensions.crates-nvim.enable = isMaximal;
};
toml.enable = isMaximal;

View file

@ -282,11 +282,6 @@ in {
(mkIf cfg.extensions.rustaceanvim.enable {
vim = {
# TODO: Determine if mkForce is the best thing here, and if we should consider a warning instead? Or use priority settings.
lsp.servers.rust-analyzer.enable = lib.mkForce false;
lsp.servers.rust-analyzer.root_dir = lib.mkForce null; # let rustaceanvim determine root
lsp.servers.rust-analyzer.on_attach = lib.mkForce null; # let rustaceanvim determine attach funcs
startPlugins = ["rustaceanvim"];
pluginRC.rustaceanvim = entryAfter ["lsp-setup"] ''
vim.g.rustaceanvim = function()
@ -294,6 +289,13 @@ in {
end
'';
};
assertions = [
{
assertion = !cfg.lsp.enable;
message = "rustaceanvim and vim.languages.rust.lsp.enable are mutually exclusive. Please ensure `vim.lsp.rust-analyzer.enable` is false, or disable `vim.languages.rust.lsp.enable`.";
}
];
})
(mkIf cfg.extensions.crates-nvim.enable {