Skip to content

Commit 7228c8b

Browse files
authored
feat: new builtin gleam format (#93)
1 parent ff3819c commit 7228c8b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
local h = require("null-ls.helpers")
2+
local methods = require("null-ls.methods")
3+
local u = require("null-ls.utils")
4+
5+
local FORMATTING = methods.internal.FORMATTING
6+
7+
return h.make_builtin({
8+
name = "gleam_format",
9+
meta = {
10+
url = "https://github.com/gleam-lang/gleam/",
11+
description = [[Default formater for the Gleam programming language]],
12+
},
13+
method = { FORMATTING },
14+
filetypes = { "gleam" },
15+
generator_opts = {
16+
command = "gleam",
17+
args = { "format", "--stdin" },
18+
to_stdin = true,
19+
cwd = h.cache.by_bufnr(function(params)
20+
return u.root_pattern("gleam.toml")(params.bufname)
21+
end),
22+
},
23+
factory = h.formatter_factory,
24+
})

0 commit comments

Comments
 (0)