mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-05 18:01:32 +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) mkOption mkEnableOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum package bool;
|
||||
inherit (lib.types) enum bool;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.types) diagnostics mkGrammarOption singleOrListOf;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
@ -30,10 +30,10 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "shfmt";
|
||||
defaultFormat = ["shfmt"];
|
||||
formats = {
|
||||
shfmt = {
|
||||
package = pkgs.shfmt;
|
||||
command = getExe pkgs.shfmt;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -68,16 +68,10 @@ in {
|
|||
description = "Enable Bash formatting";
|
||||
};
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "Bash formatter to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "Bash formatter package";
|
||||
};
|
||||
};
|
||||
|
||||
extraDiagnostics = {
|
||||
|
@ -108,10 +102,13 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.sh = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
setupOpts.formatters_by_ft.sh = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
@ -8,10 +8,8 @@
|
|||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.types) enum listOf;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
cfg = config.vim.languages.clojure;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum package;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.nvim.types) mkGrammarOption singleOrListOf;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
|
@ -30,34 +30,18 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "prettier";
|
||||
defaultFormat = ["prettier"];
|
||||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.prettier;
|
||||
command = getExe pkgs.prettier;
|
||||
};
|
||||
|
||||
prettierd = {
|
||||
package = pkgs.prettierd;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
command = "${cfg.format.package}/bin/prettierd",
|
||||
})
|
||||
)
|
||||
'';
|
||||
command = getExe pkgs.prettierd;
|
||||
};
|
||||
|
||||
biome = {
|
||||
package = pkgs.biome;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.biome.with({
|
||||
command = "${cfg.format.package}/bin/biome",
|
||||
})
|
||||
)
|
||||
'';
|
||||
command = getExe pkgs.biome;
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -85,15 +69,9 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "CSS formatter to use";
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "CSS formatter package";
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -115,10 +93,13 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.css = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
setupOpts.formatters_by_ft.css = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
@ -59,19 +59,16 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "gofmt";
|
||||
defaultFormat = ["gofmt"];
|
||||
formats = {
|
||||
gofmt = {
|
||||
package = pkgs.go;
|
||||
config.command = "${cfg.format.package}/bin/gofmt";
|
||||
command = "${pkgs.go}/bin/gofmt";
|
||||
};
|
||||
gofumpt = {
|
||||
package = pkgs.gofumpt;
|
||||
config.command = getExe cfg.format.package;
|
||||
command = getExe pkgs.gofumpt;
|
||||
};
|
||||
golines = {
|
||||
package = pkgs.golines;
|
||||
config.command = "${cfg.format.package}/bin/golines";
|
||||
command = "${pkgs.golines}/bin/golines";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -113,15 +110,9 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "Go formatter to use";
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Go formatter package";
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
|
||||
dap = {
|
||||
|
@ -163,8 +154,13 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.go = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||
setupOpts.formatters_by_ft.go = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) package bool enum listOf;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.types) bool enum listOf;
|
||||
inherit (lib.nvim.types) mkGrammarOption singleOrListOf;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
cfg = config.vim.languages.hcl;
|
||||
|
@ -24,10 +24,10 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "hclfmt";
|
||||
defaultFormat = ["hclfmt"];
|
||||
formats = {
|
||||
hclfmt = {
|
||||
package = pkgs.hclfmt;
|
||||
command = getExe pkgs.hclfmt;
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -55,15 +55,10 @@ in {
|
|||
description = "Enable HCL formatting";
|
||||
};
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "HCL formatter to use";
|
||||
};
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "HCL formatter package";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -103,10 +98,13 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.hcl = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
setupOpts.formatters_by_ft.hcl = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
inherit (lib.meta) getExe;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) bool enum package;
|
||||
inherit (lib.types) bool enum;
|
||||
inherit (lib.lists) optional;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics singleOrListOf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
@ -25,14 +25,11 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "superhtml";
|
||||
defaultFormat = ["superhtml"];
|
||||
formats = {
|
||||
superhtml = {
|
||||
package = pkgs.writeShellApplication {
|
||||
name = "superhtml_fmt";
|
||||
runtimeInputs = [pkgs.superhtml];
|
||||
text = "superhtml fmt -";
|
||||
};
|
||||
command = "${pkgs.superhtml}/bin/superhtml";
|
||||
args = ["fmt" "-"];
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -68,16 +65,10 @@ in {
|
|||
enable = mkEnableOption "HTML formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "HTML formatter to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "HTML formatter package";
|
||||
};
|
||||
};
|
||||
|
||||
extraDiagnostics = {
|
||||
|
@ -119,10 +110,13 @@ in {
|
|||
(mkIf (cfg.format.enable && !cfg.lsp.enable) {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.html = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
setupOpts.formatters_by_ft.html = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.meta) getExe' getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum package;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.nvim.types) mkGrammarOption singleOrListOf;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
|
@ -24,15 +24,12 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "jsonfmt";
|
||||
defaultFormat = ["jsonfmt"];
|
||||
|
||||
formats = {
|
||||
jsonfmt = {
|
||||
package = pkgs.writeShellApplication {
|
||||
name = "jsonfmt";
|
||||
runtimeInputs = [pkgs.jsonfmt];
|
||||
text = "jsonfmt -w -";
|
||||
};
|
||||
command = getExe pkgs.jsonfmt;
|
||||
args = ["-w" "-"];
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -60,15 +57,9 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "JSON formatter to use";
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "JSON formatter package";
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -90,10 +81,13 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.json = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
setupOpts.formatters_by_ft.json = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.types) bool enum listOf package;
|
||||
inherit (lib.nvim.types) diagnostics mkGrammarOption;
|
||||
inherit (lib.types) bool enum listOf;
|
||||
inherit (lib.nvim.types) diagnostics mkGrammarOption singleOrListOf;
|
||||
inherit (lib.nvim.dag) entryBefore;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
|
@ -34,10 +34,10 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "stylua";
|
||||
defaultFormat = ["stylua"];
|
||||
formats = {
|
||||
stylua = {
|
||||
package = pkgs.stylua;
|
||||
command = getExe pkgs.stylua;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -79,16 +79,10 @@ in {
|
|||
description = "Enable Lua formatting";
|
||||
};
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "Lua formatter to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "Lua formatter package";
|
||||
};
|
||||
};
|
||||
|
||||
extraDiagnostics = {
|
||||
|
@ -132,10 +126,13 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.lua = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
setupOpts.formatters_by_ft.lua = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (builtins) attrNames warn;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) bool enum package listOf str nullOr;
|
||||
inherit (lib.types) bool enum listOf str nullOr;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.types) diagnostics mkGrammarOption mkPluginSetupOption singleOrListOf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
@ -25,17 +25,17 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "deno_fmt";
|
||||
defaultFormat = ["deno_fmt"];
|
||||
formats = {
|
||||
# for backwards compatibility
|
||||
denofmt = {
|
||||
package = pkgs.deno;
|
||||
command = getExe pkgs.deno;
|
||||
};
|
||||
deno_fmt = {
|
||||
package = pkgs.deno;
|
||||
command = getExe pkgs.deno;
|
||||
};
|
||||
prettierd = {
|
||||
package = pkgs.prettierd;
|
||||
command = getExe pkgs.prettierd;
|
||||
};
|
||||
};
|
||||
defaultDiagnosticsProvider = ["markdownlint-cli2"];
|
||||
|
@ -72,17 +72,11 @@ in {
|
|||
enable = mkEnableOption "Markdown formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "Markdown formatter to use. `denofmt` is deprecated and currently aliased to deno_fmt.";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "Markdown formatter package";
|
||||
};
|
||||
|
||||
extraFiletypes = mkOption {
|
||||
type = listOf str;
|
||||
default = [];
|
||||
|
@ -157,14 +151,22 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.markdown = [cfg.format.type];
|
||||
setupOpts.formatters.${
|
||||
if cfg.format.type == "denofmt"
|
||||
then "deno_fmt"
|
||||
else cfg.format.type
|
||||
} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
setupOpts.formatters_by_ft.markdown = cfg.format.type;
|
||||
setupOpts.formatters = let
|
||||
names = map (name:
|
||||
if name == "denofmt"
|
||||
then
|
||||
warn ''
|
||||
vim.languages.markdown.format.type: "denofmt" is renamed to "deno_fmt".
|
||||
'' "deno_fmt"
|
||||
else name)
|
||||
cfg.format.type;
|
||||
in
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
names;
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.meta) getExe';
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum package;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.nvim.types) mkGrammarOption singleOrListOf;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
@ -37,13 +37,10 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "nimpretty";
|
||||
defaultFormat = ["nimpretty"];
|
||||
formats = {
|
||||
nimpretty = {
|
||||
package = pkgs.nim;
|
||||
config = {
|
||||
command = "${cfg.format.package}/bin/nimpretty";
|
||||
};
|
||||
command = "${pkgs.nim}/bin/nimpretty";
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -68,16 +65,10 @@ in {
|
|||
format = {
|
||||
enable = mkEnableOption "Nim formatting" // {default = config.vim.languages.enableFormat;};
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "Nim formatter to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "Nim formatter package";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -108,8 +99,13 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.nim = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||
setupOpts.formatters_by_ft.nim = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
inherit (lib.meta) getExe;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum package;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics singleOrListOf;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
|
@ -49,14 +49,14 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "alejandra";
|
||||
defaultFormat = ["alejandra"];
|
||||
formats = {
|
||||
alejandra = {
|
||||
package = pkgs.alejandra;
|
||||
command = getExe pkgs.alejandra;
|
||||
};
|
||||
|
||||
nixfmt = {
|
||||
package = pkgs.nixfmt-rfc-style;
|
||||
command = getExe pkgs.nixfmt-rfc-style;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -109,15 +109,9 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "Nix formatter to use";
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Nix formatter package";
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
|
||||
extraDiagnostics = {
|
||||
|
@ -161,10 +155,13 @@ in {
|
|||
(mkIf (cfg.format.enable && !cfg.lsp.enable) {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.nix = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
setupOpts.formatters_by_ft.nix = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
@ -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.nvim.types) mkGrammarOption singleOrListOf;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
@ -55,10 +55,10 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "ocamlformat";
|
||||
defaultFormat = ["ocamlformat"];
|
||||
formats = {
|
||||
ocamlformat = {
|
||||
package = pkgs.ocamlPackages.ocamlformat;
|
||||
command = getExe pkgs.ocamlPackages.ocamlformat;
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -83,15 +83,10 @@ in {
|
|||
format = {
|
||||
enable = mkEnableOption "OCaml formatting support (ocamlformat)" // {default = config.vim.languages.enableFormat;};
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "OCaml formatter to use";
|
||||
};
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "OCaml formatter package";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -113,10 +108,13 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.ocaml = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
setupOpts.formatters_by_ft.ocaml = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "black";
|
||||
defaultFormat = ["black"];
|
||||
formats = {
|
||||
black = {
|
||||
command = getExe pkgs.black;
|
||||
|
@ -233,12 +233,6 @@ in {
|
|||
default = defaultFormat;
|
||||
description = "Python formatters to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "Python formatter package";
|
||||
};
|
||||
};
|
||||
|
||||
# TODO this implementation is very bare bones, I don't know enough python to implement everything
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib.meta) getExe getExe';
|
||||
inherit (lib.meta) getExe';
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum package;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.nvim.types) mkGrammarOption singleOrListOf;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
|
@ -28,11 +28,9 @@
|
|||
defaultFormat = "qmlformat";
|
||||
formats = {
|
||||
qmlformat = {
|
||||
package = pkgs.writeShellApplication {
|
||||
name = "qmlformat";
|
||||
runtimeInputs = [qmlPackage];
|
||||
text = "qmlformat -";
|
||||
};
|
||||
command = "${qmlPackage}/bin/qmlformat";
|
||||
args = ["-i" "$FILENAME"];
|
||||
stdin = false;
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -56,16 +54,10 @@ in {
|
|||
enable = mkEnableOption "QML formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "QML formatter to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "QML formatter package";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -88,10 +80,13 @@ in {
|
|||
(mkIf (cfg.format.enable && !cfg.lsp.enable) {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.qml = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
setupOpts.formatters_by_ft.qml = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
inherit (builtins) attrNames;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum package;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.nvim.types) mkGrammarOption singleOrListOf;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
@ -19,35 +19,31 @@
|
|||
packages = [pkgs.rPackages.languageserver];
|
||||
};
|
||||
|
||||
defaultFormat = "format_r";
|
||||
defaultFormat = ["format_r"];
|
||||
formats = {
|
||||
styler = {
|
||||
package = pkgs.rWrapper.override {
|
||||
packages = [pkgs.rPackages.styler];
|
||||
};
|
||||
config = {
|
||||
command = "${cfg.format.package}/bin/R";
|
||||
};
|
||||
command = let
|
||||
pkg = pkgs.rWrapper.override {packages = [pkgs.rPackages.styler];};
|
||||
in "${pkg}/bin/R";
|
||||
};
|
||||
|
||||
format_r = {
|
||||
package = pkgs.rWrapper.override {
|
||||
packages = [pkgs.rPackages.formatR];
|
||||
};
|
||||
config = {
|
||||
command = "${cfg.format.package}/bin/R";
|
||||
stdin = true;
|
||||
args = [
|
||||
"--slave"
|
||||
"--no-restore"
|
||||
"--no-save"
|
||||
"-s"
|
||||
"-e"
|
||||
''formatR::tidy_source(source="stdin")''
|
||||
];
|
||||
# TODO: range_args seem to be possible
|
||||
# https://github.com/nvimtools/none-ls.nvim/blob/main/lua/null-ls/builtins/formatting/format_r.lua
|
||||
};
|
||||
command = let
|
||||
pkg = pkgs.rWrapper.override {
|
||||
packages = [pkgs.rPackages.formatR];
|
||||
};
|
||||
in "${pkg}/bin/R";
|
||||
stdin = true;
|
||||
args = [
|
||||
"--slave"
|
||||
"--no-restore"
|
||||
"--no-save"
|
||||
"-s"
|
||||
"-e"
|
||||
''formatR::tidy_source(source="stdin")''
|
||||
];
|
||||
# TODO: range_args seem to be possible
|
||||
# https://github.com/nvimtools/none-ls.nvim/blob/main/lua/null-ls/builtins/formatting/format_r.lua
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -87,16 +83,10 @@ in {
|
|||
enable = mkEnableOption "R formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "R formatter to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "R formatter package";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -109,8 +99,13 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.r = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||
setupOpts.formatters_by_ft.r = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.types) mkGrammarOption diagnostics singleOrListOf;
|
||||
inherit (lib.types) package enum;
|
||||
inherit (lib.types) enum;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
|
||||
cfg = config.vim.languages.ruby;
|
||||
|
@ -49,11 +49,10 @@
|
|||
|
||||
# testing
|
||||
|
||||
defaultFormat = "rubocop";
|
||||
defaultFormat = ["rubocop"];
|
||||
formats = {
|
||||
rubocop = {
|
||||
# TODO: is this right?
|
||||
package = pkgs.rubyPackages.rubocop;
|
||||
command = getExe pkgs.rubyPackages.rubocop;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -87,16 +86,10 @@ in {
|
|||
enable = mkEnableOption "Ruby formatter support" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "Ruby formatter to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "Ruby formatter package";
|
||||
};
|
||||
};
|
||||
|
||||
extraDiagnostics = {
|
||||
|
@ -130,10 +123,13 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.ruby = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
setupOpts.formatters_by_ft.ruby = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
@ -12,16 +12,17 @@
|
|||
inherit (lib.trivial) boolToString;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) bool package str listOf either enum;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.types) mkGrammarOption singleOrListOf;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.dag) entryAfter entryAnywhere;
|
||||
|
||||
cfg = config.vim.languages.rust;
|
||||
|
||||
defaultFormat = "rustfmt";
|
||||
defaultFormat = ["rustfmt"];
|
||||
formats = {
|
||||
rustfmt = {
|
||||
package = pkgs.rustfmt;
|
||||
command = getExe pkgs.rustfmt;
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -79,15 +80,9 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "Rust formatter to use";
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Rust formatter package";
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
|
||||
dap = {
|
||||
|
@ -130,10 +125,13 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.rust = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
setupOpts.formatters_by_ft.rust = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
@ -33,14 +33,11 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "sqlfluff";
|
||||
defaultFormat = ["sqlfluff"];
|
||||
formats = {
|
||||
sqlfluff = {
|
||||
package = sqlfluffDefault;
|
||||
config = {
|
||||
command = getExe cfg.format.package;
|
||||
append_args = ["--dialect=${cfg.dialect}"];
|
||||
};
|
||||
command = getExe sqlfluffDefault;
|
||||
append_args = ["--dialect=${cfg.dialect}"];
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -88,16 +85,10 @@ in {
|
|||
enable = mkEnableOption "SQL formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "SQL formatter to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "SQL formatter package";
|
||||
};
|
||||
};
|
||||
|
||||
extraDiagnostics = {
|
||||
|
@ -133,8 +124,13 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.sql = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = formats.${cfg.format.type}.config;
|
||||
setupOpts.formatters_by_ft.sql = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
})
|
||||
|
||||
|
|
|
@ -176,18 +176,18 @@
|
|||
'';
|
||||
|
||||
# TODO: specify packages
|
||||
defaultFormat = "prettier";
|
||||
defaultFormat = ["prettier"];
|
||||
formats = {
|
||||
prettier = {
|
||||
package = pkgs.prettier;
|
||||
command = getExe pkgs.prettier;
|
||||
};
|
||||
|
||||
prettierd = {
|
||||
package = pkgs.prettierd;
|
||||
command = getExe pkgs.prettierd;
|
||||
};
|
||||
|
||||
biome = {
|
||||
package = pkgs.biome;
|
||||
command = getExe pkgs.biome;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -239,15 +239,9 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "Typescript/Javascript formatter to use";
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Typescript/Javascript formatter package";
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
|
||||
extraDiagnostics = {
|
||||
|
@ -309,12 +303,15 @@ in {
|
|||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
formatters_by_ft.typescript = [cfg.format.type];
|
||||
formatters_by_ft.typescript = cfg.format.type;
|
||||
# .tsx files
|
||||
formatters_by_ft.typescriptreact = [cfg.format.type];
|
||||
formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
formatters_by_ft.typescriptreact = cfg.format.type;
|
||||
setupOpts.formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
|
|
@ -91,14 +91,14 @@
|
|||
};
|
||||
};
|
||||
|
||||
defaultFormat = "typstfmt";
|
||||
defaultFormat = ["typstfmt"];
|
||||
formats = {
|
||||
typstfmt = {
|
||||
package = pkgs.typstfmt;
|
||||
command = getExe pkgs.typstfmt;
|
||||
};
|
||||
# https://github.com/Enter-tainer/typstyle
|
||||
typstyle = {
|
||||
package = pkgs.typstyle;
|
||||
command = getExe pkgs.typstyle;
|
||||
};
|
||||
};
|
||||
in {
|
||||
|
@ -124,16 +124,10 @@ in {
|
|||
enable = mkEnableOption "Typst document formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
type = enum (attrNames formats);
|
||||
type = singleOrListOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "Typst formatter to use";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
description = "Typst formatter package";
|
||||
};
|
||||
};
|
||||
|
||||
extensions = {
|
||||
|
@ -189,10 +183,13 @@ in {
|
|||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts.formatters_by_ft.typst = [cfg.format.type];
|
||||
setupOpts.formatters.${cfg.format.type} = {
|
||||
command = getExe cfg.format.package;
|
||||
};
|
||||
setupOpts.formatters_by_ft.typst = 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