From 56b2b01f6f7f1e9757af88d7dabc7f94627747cd Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Sun, 19 May 2024 16:55:07 +0100 Subject: [PATCH] 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. --- site-modules/core/files/vim/plugin/lint.lua | 30 ++++++++------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/site-modules/core/files/vim/plugin/lint.lua b/site-modules/core/files/vim/plugin/lint.lua index 950399b..0df24c8 100644 --- a/site-modules/core/files/vim/plugin/lint.lua +++ b/site-modules/core/files/vim/plugin/lint.lua @@ -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 = {}