Switch text editing from ALE to null-ls

This commit is contained in:
ViViDboarder 2022-01-10 14:38:24 -08:00
parent e77a79e662
commit 6475f422ac
2 changed files with 28 additions and 2 deletions

View File

@ -9,7 +9,7 @@ vim.g.ale_linters = {
lua = {}, lua = {},
-- sh = {'language_server', 'shell', 'shellcheck'}, -- sh = {'language_server', 'shell', 'shellcheck'},
sh = {}, sh = {},
text = { "proselint", "alex" }, text = {},
} }
vim.g.ale_linter_aliases = { vim.g.ale_linter_aliases = {
markdown = { "text" }, markdown = { "text" },

View File

@ -189,6 +189,29 @@ end
function M.config_null_ls() function M.config_null_ls()
utils.try_require("null-ls", function(null_ls) utils.try_require("null-ls", function(null_ls)
local helpers = require("null-ls.helpers")
local alex_lint = {
name = "alex",
method = null_ls.methods.DIAGNOSTICS,
filetypes = { "markdown" },
generator = null_ls.generator({
command = "alex",
args = { "--stdin", "--quiet" },
to_stdin = true,
from_stderr = true,
format = "line",
check_exit_code = function(code)
return code <= 1
end,
on_output = helpers.diagnostics.from_patterns({
{
pattern = [[ *(%d+):(%d+)-(%d+):(%d+) *(%w+) *(.+) +[%w]+ +([-%l]+)]],
groups = { "row", "col", "end_row", "end_col", "severity", "message", "code" },
},
}),
}),
}
local sources = { local sources = {
-- Generic -- Generic
-- null_ls.builtins.formatting.preittier, -- null_ls.builtins.formatting.preittier,
@ -203,7 +226,10 @@ function M.config_null_ls()
-- Go -- Go
null_ls.builtins.diagnostics.golangci_lint, null_ls.builtins.diagnostics.golangci_lint,
-- Text -- Text
-- null_ls.builtins.code_actions.proselint, null_ls.builtins.diagnostics.proselint,
-- null_ls.builtins.diagnostics.write_good,
null_ls.builtins.code_actions.proselint,
alex_lint,
-- Ansible -- Ansible
-- null_ls.builtins.diagnostics.ansiblelint, -- null_ls.builtins.diagnostics.ansiblelint,
-- Shell -- Shell