nvf/lib/types/lsp.nix
2026-06-10 22:45:19 +01:00

26 lines
810 B
Nix

{lib}: let
inherit (lib.generators) toPretty;
inherit (lib.options) mkOption;
inherit (lib.strings) removeSuffix optionalString;
inherit (lib.types) bool;
mkLspPresetEnableOption = option: display: fileTypes:
mkLspPresetEnableOptionWithDesc option display fileTypes "";
mkLspPresetEnableOptionWithDesc = option: display: fileTypes: description:
mkOption {
type = bool;
default = false;
description = removeSuffix "\n" (''
The ${display} Language Server.
Default `filetypes = ${toPretty {} fileTypes}`.
Use {option}`vim.lsp.servers.${option}` for customization.
''
+ optionalString (description != "") ''
${description}
'');
};
in {
inherit mkLspPresetEnableOption mkLspPresetEnableOptionWithDesc;
}