languages/formatters: allow multiple formatters (#1103)

* language/python: allow multiple formatters

* package: add prettier-plugin-astro

* language/astro: fix prettier, remove prettierd

* package: add prettier-plugin-svelte

* language/svelte: fix prettier, remove prettierd

* languages: allow listOf format.type

* deprecations: add warnings for removed format options

* ruby: remove unused variable

* nix: fix outdated references to format.package

* docs: update release note

* treewide: warn deprecation in singleOrListOf

* conform: add definitions for setupOpts.formatters
This commit is contained in:
Ching Pei Yang 2025-11-16 19:49:21 +01:00 committed by GitHub
commit d5da1a14c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 641 additions and 488 deletions

View file

@ -1,13 +1,58 @@
{lib, ...}: let
inherit (lib.generators) mkLuaInline;
inherit (lib.options) mkOption mkEnableOption literalMD;
inherit (lib.types) attrs either nullOr;
inherit (lib.types) attrs either nullOr listOf submodule str;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.types) luaInline mkPluginSetupOption;
formattersType = submodule {
freeformType = attrs;
options = {
command = mkOption {
type = nullOr (either str luaInline);
default = null;
description = "The command to run.";
};
args = mkOption {
type = nullOr (either (listOf str) luaInline);
default = null;
description = ''
A list of strings, or a lua function that returns a list of strings.
Return a single string instead of a list to run the command in a
shell.
'';
};
prepend_args = mkOption {
type = nullOr (either (listOf str) luaInline);
default = null;
description = ''
When inherit = true, add additional arguments to the beginning of
args. Can also be a function, like args.
'';
};
append_args = mkOption {
type = nullOr (either (listOf str) luaInline);
default = null;
description = ''
When inherit = true, add additional arguments to the end of args.
Can also be a function, like args.
'';
};
};
};
in {
options.vim.formatter.conform-nvim = {
enable = mkEnableOption "lightweight yet powerful formatter plugin for Neovim [conform-nvim]";
setupOpts = mkPluginSetupOption "conform.nvim" {
formatters = mkOption {
type = formattersType;
default = {};
description = "Custom formatters and overrides for built-in formatters.";
};
formatters_by_ft = mkOption {
type = attrs;
default = {};