fix(nvim-lint): Fix prepend_args logic

`prepend_args` logic doesn't work as expected, as it appends the extra
args rather than prepends them. This works for some linter
configurations, but breaks other ones that use `-` as the last argument
in the default configuration.
This commit is contained in:
Ivan Isakov 2026-04-07 11:40:36 -04:00
parent 83d90f339d
commit 03ad39320c

View file

@ -32,13 +32,19 @@ return {
config = function(_, opts)
local M = {}
local function list_prepend(dst, src)
for i = 1, #src do
table.insert(dst, i, src[i])
end
end
local lint = require("lint")
for name, linter in pairs(opts.linters) do
if type(linter) == "table" and type(lint.linters[name]) == "table" then
lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name], linter)
if type(linter.prepend_args) == "table" then
lint.linters[name].args = lint.linters[name].args or {}
vim.list_extend(lint.linters[name].args, linter.prepend_args)
list_prepend(lint.linters[name].args, linter.prepend_args)
end
else
lint.linters[name] = linter