aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorMaria José Solano <majosolano99@gmail.com>2023-09-14 23:33:52 -0700
committerGitHub <noreply@github.com>2023-09-14 23:33:52 -0700
commitb43690264ebcb152365d5b46faa6561f12ea062a (patch)
treed6fcfc72b159467e44bc5bbb1b25f1af69729c7a /lua
parent831aaa755c9136fd691ae109c8f05a8b4e485863 (diff)
fix: use non-deprecated health report functions if available (#48)
Diffstat (limited to 'lua')
-rw-r--r--lua/conform/health.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/lua/conform/health.lua b/lua/conform/health.lua
index 18085bf..6a12eab 100644
--- a/lua/conform/health.lua
+++ b/lua/conform/health.lua
@@ -1,5 +1,11 @@
local M = {}
+-- The "report_" functions have been deprecated, so use the new ones if defined.
+local health_start = vim.health.start or vim.health.report_start
+local health_warn = vim.health.warn or vim.health.report_warn
+local health_info = vim.health.info or vim.health.report_info
+local health_ok = vim.health.ok or vim.health.report_ok
+
---@param name string
---@return string[]
local function get_formatter_filetypes(name)
@@ -31,22 +37,18 @@ end
M.check = function()
local conform = require("conform")
- vim.health.report_start("conform.nvim report")
+ health_start("conform.nvim report")
local log = require("conform.log")
- vim.health.info(string.format("Log file: %s", log.get_logfile()))
+ 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)
- )
+ health_warn(string.format("%s unavailable: %s", formatter.name, formatter.available_msg))
else
local filetypes = get_formatter_filetypes(formatter.name)
- vim.health.report_ok(
- string.format("%s ready (%s)", formatter.name, table.concat(filetypes, ", "))
- )
+ health_ok(string.format("%s ready (%s)", formatter.name, table.concat(filetypes, ", ")))
end
end
end