plugins/lsp: Correctly mark servers as disabled if the lsp plugin is disabled

This commit is contained in:
traxys 2024-11-19 11:36:31 +01:00
parent 31eb9d8d75
commit c674f10d18

View file

@ -30,6 +30,8 @@ with lib;
let let
cfg = config.plugins.lsp.servers.${name}; cfg = config.plugins.lsp.servers.${name};
opt = options.plugins.lsp.servers.${name}; opt = options.plugins.lsp.servers.${name};
enabled = config.plugins.lsp.enable && cfg.enable;
in in
{ {
meta.nixvimInfo = { meta.nixvimInfo = {
@ -131,7 +133,7 @@ in
} // extraOptions; } // extraOptions;
}; };
config = mkIf cfg.enable { config = mkIf enabled {
extraPackages = [ cfg.package ]; extraPackages = [ cfg.package ];
plugins.lsp.enabledServers = [ plugins.lsp.enabledServers = [
@ -168,7 +170,7 @@ in
(mkRemovedOptionModule ( (mkRemovedOptionModule (
basePluginPath ++ [ "extraSettings" ] basePluginPath ++ [ "extraSettings" ]
) "You can use `${basePluginPathString}.extraOptions.settings` instead.") ) "You can use `${basePluginPathString}.extraOptions.settings` instead.")
(lib.mkIf cfg.enable (extraConfig cfg)) (lib.mkIf enabled (extraConfig cfg))
] ]
# Add an alias (with warning) for the lspconfig server name, if different to `name`. # Add an alias (with warning) for the lspconfig server name, if different to `name`.
# Note: users may use lspconfig's docs to guess the `plugins.lsp.servers.*` name # Note: users may use lspconfig's docs to guess the `plugins.lsp.servers.*` name