mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-09 11:51: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
|
@ -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;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue