Skip to content

Commit 8f98708

Browse files
committed
nvim: update null-ls
1 parent bb498dd commit 8f98708

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

.config/nvim/lua/lsp/null-ls.lua

+16-8
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ local M = {}
33
function M.config()
44
return {
55
formatters = {
6-
lua = { exe = "stylua", args = {} },
7-
sh = { exe = "shfmt", args = { "-i", "2", "-ci", "-bn" } },
6+
{ cmd = "stylua", args = {}, filetypes = { "lua" } },
7+
{ cmd = "shfmt", args = { "-i", "2", "-ci", "-bn" }, filetypes = { "sh" } },
88
},
99
linters = {
10-
lua = { exe = "luacheck", args = {} },
11-
sh = { exe = "shellcheck", args = { "--exclude=SC1090,SC1091" } },
10+
{ cmd = "luacheck", args = {}, filetypes = { "lua" } },
11+
{ cmd = "shellcheck", args = { "--exclude=SC1090,SC1091" }, filetypes = { "sh" } },
12+
},
13+
code_actions = {
14+
{ cmd = "gitsigns", filetypes = {} },
15+
{ cmd = "shellcheck", filetypes = {} },
1216
},
1317
}
1418
end
@@ -45,19 +49,23 @@ function M:setup()
4549

4650
local null_ls = require "null-ls"
4751
local sources = {}
48-
for _, provider in pairs(config.formatters) do
49-
local source = null_ls.builtins.formatting[provider.exe].with {
52+
for _, provider in ipairs(config.formatters) do
53+
local source = null_ls.builtins.formatting[provider.cmd].with {
5054
extra_args = provider.args,
5155
}
5256
table.insert(sources, source)
5357
end
5458

55-
for _, provider in pairs(config.linters) do
56-
local source = null_ls.builtins.diagnostics[provider.exe].with {
59+
for _, provider in ipairs(config.linters) do
60+
local source = null_ls.builtins.diagnostics[provider.cmd].with {
5761
extra_args = provider.args,
5862
}
5963
table.insert(sources, source)
6064
end
65+
for _, provider in ipairs(config.code_actions) do
66+
local source = null_ls.builtins.code_actions[provider.cmd].with {}
67+
table.insert(sources, source)
68+
end
6169
null_ls.config { sources = sources, log = { level = "warn" } }
6270
end
6371

0 commit comments

Comments
 (0)