nvim: Add conditional vale diagnostics
When writing a markdown or similar document, vale will automatically be enabled if there is a '.vale.ini' or '_vale.ini' file (and a corresponding styles folder) in the project root directory. Otherwise, vale stays disabled.
This commit is contained in:
parent
a689d7cc3d
commit
1c8c5ca6d9
1 changed files with 8 additions and 1 deletions
|
@ -142,7 +142,7 @@ end
|
|||
local null_ls = require("null-ls")
|
||||
null_ls.setup({})
|
||||
require("mason-null-ls").setup({
|
||||
ensure_installed = { "black", "prettier", "shfmt", "eslint-lsp", "stylua", "jq" },
|
||||
ensure_installed = { "black", "prettier", "shfmt", "eslint-lsp", "stylua", "jq", "vale" },
|
||||
automatic_installation = false,
|
||||
handlers = {
|
||||
shfmt = function(_, _)
|
||||
|
@ -164,5 +164,12 @@ require("mason-null-ls").setup({
|
|||
extra_filetypes = { "astro" },
|
||||
}))
|
||||
end,
|
||||
vale = function(_, _)
|
||||
null_ls.register(null_ls.builtins.diagnostics.vale.with({
|
||||
condition = function(utils)
|
||||
return (utils.root_has_file({ ".vale.ini", "_vale.ini" }) and utils.root_has_file({ "styles/" }))
|
||||
end,
|
||||
}))
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue