mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-22 12:31:07 +00:00
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:
parent
83d90f339d
commit
03ad39320c
1 changed files with 7 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue