Need help configuring a new builtin diagnostic source #522
-
I'm trying to create a new source in builtins/diagnostics called 'markdownlin2.lua', based on the cli tool found here. It works differently than the standard markdownlint-cli tool, in that it doesn't accept flags or seem to accept stdin (see writeup about differences here). This is what I've come up with so far in the lua file: local h = require("null-ls.helpers")
local methods = require("null-ls.methods")
local DIAGNOSTICS = methods.internal.DIAGNOSTICS
return h.make_builtin({
method = DIAGNOSTICS,
filetypes = { "markdown", "liquid" },
generator_opts = {
command = "markdownlint-cli2",
args = {},
to_stdin = false,
from_stderr = false,
format = "line",
to_temp_file = true,
check_exit_code = function(code)
return code <= 1
end,
on_output = h.diagnostics.from_patterns({
{
pattern = [[:(%d+):(%d+) ([%w-/]+) (.*)]],
groups = { "row", "col", "code", "message" },
},
{
pattern = [[:(%d+) ([%w-/]+) (.*)]],
groups = { "row", "code", "message" },
},
}),
},
factory = h.generator_factory,
}) I don't see anything anything in the log when using |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Configuring a builtin is actually slightly different than configuring your own custom source. I have some custom diagnostic sources in my dotfiles. Also, did you add the custom source to your |
Beta Was this translation helpful? Give feedback.
-
Did you enable debug logging? Turning it on shows that the CLI is outputting a help dialog, meaning it likely isn't receiving the correct arguments. Setting |
Beta Was this translation helpful? Give feedback.
Did you enable debug logging? Turning it on shows that the CLI is outputting a help dialog, meaning it likely isn't receiving the correct arguments. Setting
args = { "$FILENAME" }
andfrom_stderr = true
seems to work, though I haven't tested it thoroughly.