mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-08 19:46:06 +01:00
lib/options (mkSettingsOption): allow more types for settingsOption when no sub-options are explicitly declared
This commit is contained in:
parent
4439dd85cd
commit
ecb75f49d1
2 changed files with 19 additions and 5 deletions
|
|
@ -329,14 +329,22 @@ rec {
|
||||||
options ? { },
|
options ? { },
|
||||||
description,
|
description,
|
||||||
example ? null,
|
example ? null,
|
||||||
|
# If no sub-options are explicitly declared, settings do not need to be a submodule.
|
||||||
|
submoduleType ? options != { },
|
||||||
}:
|
}:
|
||||||
lib.mkOption {
|
lib.mkOption {
|
||||||
type =
|
type =
|
||||||
with types;
|
let
|
||||||
submodule {
|
anyLuaType = lib.nixvim.lua-types.anything;
|
||||||
freeformType = attrsOf lib.nixvim.lua-types.anything;
|
in
|
||||||
inherit options;
|
if submoduleType then
|
||||||
};
|
types.submodule {
|
||||||
|
freeformType = types.attrsOf anyLuaType;
|
||||||
|
inherit options;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
assert options == { };
|
||||||
|
anyLuaType;
|
||||||
default = { };
|
default = { };
|
||||||
inherit description;
|
inherit description;
|
||||||
example =
|
example =
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,12 @@ in
|
||||||
settings = lib.nixvim.mkSettingsOption {
|
settings = lib.nixvim.mkSettingsOption {
|
||||||
description = "The settings for this LSP.";
|
description = "The settings for this LSP.";
|
||||||
options = settingsOptions;
|
options = settingsOptions;
|
||||||
|
|
||||||
|
# Some servers declare settings sub-options without using `settingsOptions`.
|
||||||
|
# This leads the `settings` option to not be typed as a submodule.
|
||||||
|
# Hence, we force all `plugins.lsp.<name>.settings` options to be types as submodules.
|
||||||
|
# FIXME This is not ideal, but `plugins.lsp` will be dropped entirely in a few months.
|
||||||
|
submoduleType = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
extraOptions = mkOption {
|
extraOptions = mkOption {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue