refactor(vim): move the cspell config to extend the builtin one

There have been some changes in the cspell config upstream to fix issues
in the cspell cli. These are mainly around the parsing of the output.

The only things my changes are adding in the file type and applying my
config file. They are only in the command not the parser.

Now we are using the upstream config and adding the extra params I need
rather than having to maintain a completely override.
This commit is contained in:
Ade Attwood 2024-05-19 16:55:07 +01:00
parent 521382ecb7
commit 56b2b01f6f

View file

@ -1,4 +1,5 @@
local lint = require "lint"
local cspell_linter = require "lint.linters.cspell"
local severities = {
error = vim.diagnostic.severity.ERROR,
@ -42,25 +43,16 @@ local get_language_id = function()
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",
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.cspell = cspell_linter
lint.linters.cspell.args = {
"lint",
"--no-color",
"--no-progress",
"--no-summary",
"--config=" .. os.getenv "HOME" .. "/.cspell.json",
get_language_id,
"--",
"stdin",
}
lint.linters_by_ft = {}