mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-21 19:25:13 +02:00
lib/modules: add applyExtraConfig
Used for - mkVimPlugin: extraConfig - mkNeovimPlugin: extraConfig - mkLsp: extraConfig - mkLsp: settings - mkExtension (telecsope): extraConfig
This commit is contained in:
parent
c7b7b6481b
commit
63cfc84abe
6 changed files with 69 additions and 14 deletions
|
@ -29,14 +29,14 @@
|
|||
with lib;
|
||||
let
|
||||
cfg = config.plugins.lsp.servers.${name};
|
||||
opt = options.plugins.lsp.servers.${name};
|
||||
opts = options.plugins.lsp.servers.${name};
|
||||
|
||||
enabled = config.plugins.lsp.enable && cfg.enable;
|
||||
in
|
||||
{
|
||||
meta.nixvimInfo = {
|
||||
# TODO: description
|
||||
url = args.url or opt.package.default.meta.homepage or null;
|
||||
url = args.url or opts.package.default.meta.homepage or null;
|
||||
path = [
|
||||
"plugins"
|
||||
"lsp"
|
||||
|
@ -70,7 +70,7 @@ in
|
|||
type = with types; nullOr (listOf str);
|
||||
default =
|
||||
# TODO: do we really only want the default `cmd` when `package` is non-null?
|
||||
if !(opt.package.isDefined or false) then
|
||||
if !(opts.package.isDefined or false) then
|
||||
null
|
||||
else if cfg.package == null then
|
||||
null
|
||||
|
@ -150,7 +150,12 @@ in
|
|||
end
|
||||
''
|
||||
);
|
||||
settings = settings cfg.settings;
|
||||
settings = lib.nixvim.modules.applyExtraConfig {
|
||||
extraConfig = settings;
|
||||
cfg = cfg.settings;
|
||||
opts = opts.settings;
|
||||
enabled = true;
|
||||
};
|
||||
} // cfg.extraOptions;
|
||||
}
|
||||
];
|
||||
|
@ -170,8 +175,17 @@ in
|
|||
(mkRemovedOptionModule (
|
||||
basePluginPath ++ [ "extraSettings" ]
|
||||
) "You can use `${basePluginPathString}.extraOptions.settings` instead.")
|
||||
(lib.mkIf enabled (extraConfig cfg))
|
||||
]
|
||||
++ lib.optional (args ? extraConfig) (
|
||||
lib.nixvim.modules.applyExtraConfig {
|
||||
inherit
|
||||
extraConfig
|
||||
cfg
|
||||
opts
|
||||
enabled
|
||||
;
|
||||
}
|
||||
)
|
||||
# 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
|
||||
++ (optional (name != serverName) (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue