mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 18:31:35 +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
|
@ -8,7 +8,7 @@
|
|||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.types) enum package;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.types) mkGrammarOption singleOrListOf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
@ -40,13 +40,10 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "mix";
|
||||
defaultFormat = ["mix"];
|
||||
formats = {
|
||||
mix = {
|
||||
package = pkgs.elixir;
|
||||
config = {
|
||||
command = "${cfg.format.package}/bin/mix";
|
||||
};
|
||||
command = "${pkgs.elixir}/bin/mix";
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -73,16 +70,10 @@ in {
|
|||
enable = mkEnableOption "Elixir formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "Elixir formatter to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "Elixir formatter package";
|
||||
};
|
||||
};
|
||||
|
||||
elixir-tools = {
|
||||
|
@ -112,9 +103,13 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.elixir = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} =
|
||||
formats.${cfg.format.type}.config;
|
||||
setupOpts.formatters_by_ft.elixir = 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