fix(vim): cspell linter will now work with newer versions

There was a breaking change / bug fix to the cspell that caused the
error format to change.
This commit is contained in:
Ade Attwood 2023-04-12 13:57:02 +01:00
parent 584667ab3a
commit bcab974cce

View file

@ -37,37 +37,39 @@ lint.linters.psalm = {
end
}
lint.linters.cspell = {
cmd = "cspell",
stdin = true,
args = {
"lint",
"--no-color",
"--no-progress",
"--no-summary",
local get_language_id = function()
local file_type = vim.api.nvim_buf_get_option(0, "filetype")
return "--language-id=" .. file_type
end
lint.linters.cspell = {
cmd = 'cspell',
stdin = true,
ignore_exitcode = true,
args = {
'lint',
'--no-color',
'--no-progress',
'--no-summary',
"--config=" .. os.getenv("HOME") .. "/.cspell.json",
function()
local file_type = vim.api.nvim_buf_get_option(0, "filetype")
return "--language-id=" .. file_type
end,
"--",
"stdin",
},
stream = "stdout",
parser = require("lint.parser").from_errorformat("/:%l:%c - %m", {
source = "cspell",
severity = vim.diagnostic.severity.INFO,
}),
get_language_id,
'--',
'stdin'
},
stream = 'stdout',
parser = require('lint.parser').from_errorformat('%f:%l:%c - %m', {
source = 'cspell',
severity = vim.diagnostic.severity.INFO
})
}
lint.linters_by_ft = {
php = {'phpcs'},
typescript = {'eslint'},
javascript = {'eslint'},
typescriptreact = {'eslint'},
javascriptreact = {'eslint'},
lua = {'luacheck'},
php = {'phpcs'},
typescript = {'eslint'},
javascript = {'eslint'},
typescriptreact = {'eslint'},
javascriptreact = {'eslint'},
lua = {'luacheck'},
}