aboutsummaryrefslogtreecommitdiffstats
path: root/lua/conform/health.lua
diff options
context:
space:
mode:
authorSteven Arcangeli <stevearc@stevearc.com>2023-08-25 11:15:12 -0700
committerSteven Arcangeli <stevearc@stevearc.com>2023-08-25 11:43:47 -0700
commiteb5987e9dd40ce1e27c9c07e41d09571f1bd876e (patch)
treeb4cffe35e0893272cedc0ecf0229d08be343d70e /lua/conform/health.lua
parent100fd00d40423af85c4c7efcf875f8e4ee329f50 (diff)
feat: first working version
Diffstat (limited to 'lua/conform/health.lua')
-rw-r--r--lua/conform/health.lua34
1 files changed, 34 insertions, 0 deletions
diff --git a/lua/conform/health.lua b/lua/conform/health.lua
new file mode 100644
index 0000000..76309be
--- /dev/null
+++ b/lua/conform/health.lua
@@ -0,0 +1,34 @@
+local M = {}
+
+M.check = function()
+ local conform = require("conform")
+ vim.health.report_start("conform.nvim report")
+
+ local log = require("conform.log")
+ vim.health.info(string.format("Log file: %s", log.get_logfile()))
+
+ local all_formatters = conform.list_all_formatters()
+ for _, formatter in ipairs(all_formatters) do
+ if not formatter.available then
+ vim.health.report_warn(
+ string.format("%s unavailable: %s", formatter.name, formatter.available_msg)
+ )
+ else
+ local filetypes = {}
+ for filetype, formatters in pairs(conform.formatters_by_ft) do
+ if not vim.tbl_islist(formatters) then
+ formatters = formatters.formatters
+ end
+ if vim.tbl_contains(formatters, formatter.name) then
+ table.insert(filetypes, filetype)
+ end
+ end
+
+ vim.health.report_ok(
+ string.format("%s ready (%s)", formatter.name, table.concat(filetypes, ", "))
+ )
+ end
+ end
+end
+
+return M