Skip to content

Commit fcd18b1

Browse files
feat: add support for pruner formatter (#856)
* Add support for pruner formatter * doc: unify metadata format --------- Co-authored-by: Steven Arcangeli <506791+stevearc@users.noreply.github.com>
1 parent a99d710 commit fcd18b1

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

lua/conform/formatters/pruner.lua

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---@type conform.FileFormatterConfig
2+
return {
3+
meta = {
4+
url = "https://github.com/pruner-formatter/pruner",
5+
description = "A language-agnostic, treesitter powered formatter.",
6+
},
7+
command = "pruner",
8+
args = function(_, ctx)
9+
local args = { "format" }
10+
11+
local textwidth = vim.api.nvim_get_option_value("textwidth", {
12+
buf = ctx.buf,
13+
})
14+
if textwidth and textwidth > 0 then
15+
table.insert(args, "--print-width=" .. textwidth)
16+
end
17+
18+
local filetype = vim.api.nvim_get_option_value("filetype", {
19+
buf = ctx.buf,
20+
})
21+
table.insert(args, "--lang=" .. filetype)
22+
23+
return args
24+
end,
25+
stdin = true,
26+
}

0 commit comments

Comments
 (0)