mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-04 01:55:08 +02:00
[Feature] add linter support (#982)
This commit is contained in:
parent
fe48ed9ef9
commit
836286798e
15 changed files with 107 additions and 84 deletions
|
@ -15,6 +15,7 @@ M.config = function()
|
|||
args = { "-w" },
|
||||
stdin = false,
|
||||
},
|
||||
linters = { "shellcheck" },
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -37,36 +38,9 @@ M.format = function()
|
|||
end
|
||||
|
||||
M.lint = function()
|
||||
-- sh
|
||||
local sh_arguments = {}
|
||||
|
||||
local shfmt = { formatCommand = "shfmt -ci -s -bn", formatStdin = true }
|
||||
|
||||
local shellcheck = {
|
||||
LintCommand = "shellcheck -f gcc -x",
|
||||
lintFormats = { "%f:%l:%c: %trror: %m", "%f:%l:%c: %tarning: %m", "%f:%l:%c: %tote: %m" },
|
||||
require("lint").linters_by_ft = {
|
||||
sh = O.lang.sh.linters,
|
||||
}
|
||||
|
||||
if O.lang.sh.linter == "shellcheck" then
|
||||
table.insert(sh_arguments, shellcheck)
|
||||
end
|
||||
|
||||
if not require("lv-utils").check_lsp_client_active "efm" then
|
||||
require("lspconfig").efm.setup {
|
||||
-- init_options = {initializationOptions},
|
||||
cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
|
||||
on_attach = require("lsp").common_on_attach,
|
||||
init_options = { documentFormatting = true, codeAction = false },
|
||||
root_dir = require("lspconfig").util.root_pattern ".git/",
|
||||
filetypes = { "sh" },
|
||||
settings = {
|
||||
rootMarkers = { ".git/" },
|
||||
languages = {
|
||||
sh = sh_arguments,
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
M.lsp = function()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue