From 9852b32d4199d2f94f885265fabd7e388950afee Mon Sep 17 00:00:00 2001 From: Samuel Cobb Date: Sat, 6 Jun 2026 00:55:31 +0100 Subject: [PATCH] feat(rust): add mkLspPresetOptionWithDesc and be more explicit with punctuation --- lib/types/lsp.nix | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/types/lsp.nix b/lib/types/lsp.nix index d05b8783..be2a994e 100644 --- a/lib/types/lsp.nix +++ b/lib/types/lsp.nix @@ -1,12 +1,23 @@ {lib}: let - inherit (lib.options) mkEnableOption; + inherit (lib.options) mkOption; mkLspPresetEnableOption = option: display: fileTypes: - mkEnableOption '' - the ${display} Language Server. - Default `filetypes = ${lib.generators.toPretty {} fileTypes}`. - Use {option}`vim.lsp.servers.${option}` for customization - ''; + mkLspPresetEnableOptionWithDesc option display fileTypes ""; + + mkLspPresetEnableOptionWithDesc = option: display: fileTypes: description: + mkOption { + type = lib.types.bool; + default = false; + description = lib.removeSuffix "\n" ('' + the ${display} Language Server. + Default `filetypes = ${lib.generators.toPretty {} fileTypes}`. + Use {option}`vim.lsp.servers.${option}` for customization. + '' + + lib.optionalString (description != "") '' + + ${description} + ''); + }; in { - inherit mkLspPresetEnableOption; + inherit mkLspPresetEnableOption mkLspPresetEnableOptionWithDesc; }