mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-09 15:05:30 +00:00
languages: allow listOf format.type
This commit is contained in:
parent
266f5bc01f
commit
60004b0da2
24 changed files with 314 additions and 355 deletions
|
|
@ -173,18 +173,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;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -236,15 +236,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 = {
|
||||
|
|
@ -306,12 +300,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