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