diff options
author | Steven Arcangeli <stevearc@stevearc.com> | 2023-08-29 19:08:37 -0700 |
---|---|---|
committer | Steven Arcangeli <stevearc@stevearc.com> | 2023-08-29 19:11:38 -0700 |
commit | c9327f2af541e4a17a6e2e05682122f8c8455d29 (patch) | |
tree | 87e5bf7d368a47bd232436296089289d7a748562 /lua/conform/runner.lua | |
parent | b426bfff29cd67ceedfb2e67401a1fce2e0fdb60 (diff) |
feat: display last few lines of the log file in :ConformInfo
Diffstat (limited to 'lua/conform/runner.lua')
-rw-r--r-- | lua/conform/runner.lua | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lua/conform/runner.lua b/lua/conform/runner.lua index d546a41..8c2bfaf 100644 --- a/lua/conform/runner.lua +++ b/lua/conform/runner.lua @@ -160,14 +160,16 @@ local function run_formatter(bufnr, formatter, config, ctx, input_lines, callbac log.debug("%s exited with code %d", formatter.name, code) callback(nil, output) else - log.error("%s exited with code %d", formatter.name, code) - log.warn("%s stdout: %s", formatter.name, stdout) - log.warn("%s stderr: %s", formatter.name, stderr) - local stderr_str - if stderr then - stderr_str = table.concat(stderr, "\n") + log.info("%s exited with code %d", formatter.name, code) + log.debug("%s stdout: %s", formatter.name, stdout) + log.debug("%s stderr: %s", formatter.name, stderr) + local err_str + if stderr and not vim.tbl_isempty(stderr) then + err_str = table.concat(stderr, "\n") + elseif stdout and not vim.tbl_isempty(stdout) then + err_str = table.concat(stdout, "\n") end - callback(string.format("Formatter '%s' error: %s", formatter.name, stderr_str)) + callback(string.format("Formatter '%s' error: %s", formatter.name, err_str)) end end, }) |