mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
Fix credo detection for elixir linters.
This commit is contained in:
parent
a33eabddd9
commit
f9eb19ad92
1 changed files with 13 additions and 7 deletions
|
|
@ -33,12 +33,13 @@ return {
|
||||||
"nvimtools/none-ls.nvim",
|
"nvimtools/none-ls.nvim",
|
||||||
optional = true,
|
optional = true,
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
if vim.fn.executable("credo") == 0 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local nls = require("null-ls")
|
local nls = require("null-ls")
|
||||||
opts.sources = vim.list_extend(opts.sources or {}, {
|
opts.sources = vim.list_extend(opts.sources or {}, {
|
||||||
nls.builtins.diagnostics.credo,
|
nls.builtins.diagnostics.credo.with({
|
||||||
|
condition = function(utils)
|
||||||
|
return utils.root_has_file(".credo.exs")
|
||||||
|
end,
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
@ -46,12 +47,17 @@ return {
|
||||||
"mfussenegger/nvim-lint",
|
"mfussenegger/nvim-lint",
|
||||||
optional = true,
|
optional = true,
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
if vim.fn.executable("credo") == 0 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
opts.linters_by_ft = {
|
opts.linters_by_ft = {
|
||||||
elixir = { "credo" },
|
elixir = { "credo" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts.linters = {
|
||||||
|
credo = {
|
||||||
|
condition = function(ctx)
|
||||||
|
return vim.fs.find({ ".credo.exs" }, { path = ctx.filename, upward = true })[1]
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue