mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-08 19:31:31 +00:00
languages: allow listOf format.type
This commit is contained in:
parent
a2b3010bb3
commit
70555904a0
22 changed files with 265 additions and 357 deletions
|
@ -6,7 +6,7 @@
|
|||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) package enum;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
|
@ -51,10 +51,10 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "fantomas";
|
||||
defaultFormat = ["fantomas"];
|
||||
formats = {
|
||||
fantomas = {
|
||||
package = pkgs.fantomas;
|
||||
command = getExe pkgs.fantomas;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -81,16 +81,10 @@ in {
|
|||
enable = mkEnableOption "F# formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "F# formatter to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "F# formatter package";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -113,10 +107,13 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.fsharp = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
setupOpts.formatters_by_ft.fsharp = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue