This commit is contained in:
Venkatesan Ravi 2025-04-12 22:22:18 +07:00 committed by GitHub
commit 8af3de07d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,12 +1,9 @@
{ {lib, ...}: let
pkgs, inherit (lib.generators) mkLuaInline;
lib, inherit (lib.options) mkOption mkEnableOption;
... inherit (lib.types) attrs either nullOr;
}: let inherit (lib.nvim.lua) toLuaObject;
inherit (lib.options) mkOption mkEnableOption literalExpression; inherit (lib.nvim.types) luaInline mkPluginSetupOption;
inherit (lib.types) attrs enum nullOr;
inherit (lib.nvim.types) mkPluginSetupOption;
inherit (lib.nvim.lua) mkLuaInline;
in { in {
options.vim.formatter.conform-nvim = { options.vim.formatter.conform-nvim = {
enable = mkEnableOption "lightweight yet powerful formatter plugin for Neovim [conform-nvim]"; enable = mkEnableOption "lightweight yet powerful formatter plugin for Neovim [conform-nvim]";
@ -30,27 +27,48 @@ in {
description = "Default values when calling `conform.format()`"; description = "Default values when calling `conform.format()`";
}; };
format_on_save = mkOption { format_on_save = let
type = nullOr attrs; defaultFormatOnSaveOpts = {
default = {
lsp_format = "fallback"; lsp_format = "fallback";
timeout_ms = 500; timeout_ms = 500;
}; };
description = '' in
Table that will be passed to `conform.format()`. If this mkOption {
is set, Conform will run the formatter on save. type = nullOr (either attrs luaInline);
''; default = mkLuaInline ''
}; function()
if not vim.g.formatsave or vim.b.disableFormatSave then
return
else
return ${toLuaObject defaultFormatOnSaveOpts}
end
end
'';
description = ''
Table or function(lualinline) that will be passed to `conform.format()`. If this
is set, Conform will run the formatter on save.
'';
};
format_after_save = mkOption { format_after_save = let
type = nullOr attrs; defaultFormatAfterSaveOpts = {lsp_format = "fallback";};
default = {lsp_format = "fallback";}; in
description = '' mkOption {
Table that will be passed to `conform.format()`. If this type = nullOr (either attrs luaInline);
is set, Conform will run the formatter asynchronously after default = mkLuaInline ''
save. function()
''; if not vim.g.formatsave or vim.b.disableFormatSave then
}; return
else
return ${toLuaObject defaultFormatAfterSaveOpts}
end
end
'';
description = ''
Table or function(luainline) that will be passed to `conform.format()`. If this
is set, Conform will run the formatter asynchronously after save.
'';
};
}; };
}; };
} }