Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5262896

Browse files
committed
diagnostics: add mado
closes #30
1 parent 86160e8 commit 5262896

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

lua/none-ls/diagnostics/mado.lua

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
local h = require("null-ls.helpers")
2+
local methods = require("null-ls.methods")
3+
4+
local DIAGNOSTICS = methods.internal.DIAGNOSTICS
5+
6+
return h.make_builtin({
7+
name = "mado",
8+
meta = {
9+
description = "A fast Markdown linter written in Rust.",
10+
url = "https://github.com/akiomik/mado",
11+
},
12+
method = DIAGNOSTICS,
13+
filetypes = { "markdown" },
14+
factory = h.generator_factory,
15+
generator_opts = {
16+
command = "mado",
17+
args = {
18+
"check",
19+
},
20+
to_stdin = true,
21+
from_stderr = false,
22+
format = "line",
23+
check_exit_code = function(code)
24+
return code <= 1
25+
end,
26+
on_output = h.diagnostics.from_patterns({
27+
{
28+
pattern = [[^([^:]+):(%d+):(%d+):%s+(MD%d+)%s+(.+)$]],
29+
groups = { "filename", "row", "col", "code", "message" },
30+
overrides = { diagnostics = { severity = 2, source = "mado" } },
31+
},
32+
{
33+
pattern = [[^([^:]+):(%d+):%s+(MD%d+)%s+(.+)$]],
34+
groups = { "filename", "row", "col", "code", "message" },
35+
overrides = { diagnostics = { severity = 2, source = "mado" } },
36+
},
37+
}),
38+
},
39+
})

0 commit comments

Comments
 (0)