Skip to content

Commit 585b31d

Browse files
author
Jose Alvarez
committed
feat(builtins): add stylua and trim_whitespace formatters
1 parent 4c1ac17 commit 585b31d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lua/null-ls/builtins/formatting.lua

+17
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ M.lua_format = h.make_builtin({
1616
factory = h.formatter_factory
1717
})
1818

19+
M.stylua = h.make_builtin({
20+
method = FORMATTING,
21+
filetypes = {"lua"},
22+
generator_opts = {command = "stylua", args = {"-"}, to_stdin = true},
23+
factory = h.formatter_factory
24+
})
25+
1926
M.prettier = h.make_builtin({
2027
method = FORMATTING,
2128
filetypes = {
@@ -56,4 +63,14 @@ M.eslint_d = h.make_builtin({
5663
factory = h.formatter_factory
5764
})
5865

66+
M.trim_whitespace = h.make_builtin({
67+
method = FORMATTING,
68+
generator_opts = {
69+
command = "awk",
70+
args = {"{ sub(/[ \t]+$/, \"\"); print }"},
71+
to_stdin = true
72+
},
73+
factory = h.formatter_factory
74+
})
75+
5976
return M

0 commit comments

Comments
 (0)