diff options
author | Cody Hiar <cody@hiar.ca> | 2021-09-03 15:57:44 -0600 |
---|---|---|
committer | Cody Hiar <cody@hiar.ca> | 2021-09-03 15:57:44 -0600 |
commit | 227899a5a0edf9e449d0697eb5e387dd5ea942ed (patch) | |
tree | 1492ee9913760798e43d1c46acb0e5284076cc85 /lua/nvimlintconf.lua | |
parent | 8c4a44a45145a99922224b20c864fd51dd2f0b3c (diff) |
initial work on getting lua setup working
Diffstat (limited to 'lua/nvimlintconf.lua')
-rw-r--r-- | lua/nvimlintconf.lua | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lua/nvimlintconf.lua b/lua/nvimlintconf.lua new file mode 100644 index 0000000..026ebe1 --- /dev/null +++ b/lua/nvimlintconf.lua @@ -0,0 +1,34 @@ +local null_ls = require("null-ls") +local helpers = require("null-ls.helpers") + +local blacklint = { + method = null_ls.methods.DIAGNOSTICS, + filetypes = { "python" }, + -- null_ls.generator creates an async source + -- that spawns the command with the given arguments and options + generator = null_ls.generator({ + command = "black", + args = { "--stdin" }, + to_stdin = true, + from_stderr = true, + -- choose an output format (raw, json, or line) + format = "line", + check_exit_code = function(code) + return code <= 1 + end, + -- use helpers to parse the output from string matchers, + -- or parse it manually with a function + on_output = helpers.diagnostics.from_patterns({ + { + pattern = [[:(%d+):(%d+) [%w-/]+ (.*)]], + groups = { "row", "col", "message" }, + }, + { + pattern = [[:(%d+) [%w-/]+ (.*)]], + groups = { "row", "message" }, + }, + }), + }), +} + +null_ls.register(blacklint) |