Skip to content

Commit 77aaade

Browse files
authored
Fix health check (#248)
1 parent de0fbc3 commit 77aaade

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

lua/scnvim/health.lua

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,40 @@ local M = {}
1414
local function check_nvim_version()
1515
local supported = vim.fn.has 'nvim-0.7' == 1
1616
if not supported then
17-
health.report_error 'scnvim needs nvim version 0.7 or higher.'
18-
health.report_info 'if you are unable to upgrade, use the `0.6-compat` branch'
17+
health.error 'scnvim needs nvim version 0.7 or higher.'
18+
health.info 'if you are unable to upgrade, use the `0.6-compat` branch'
1919
else
2020
local v = vim.version()
21-
health.report_ok(string.format('nvim version %d.%d.%d', v.major, v.minor, v.patch))
21+
health.ok(string.format('nvim version %d.%d.%d', v.major, v.minor, v.patch))
2222
end
2323
end
2424

2525
local function check_classes_installed()
2626
local class_path = install.check()
2727
if not class_path then
28-
health.report_error 'scnvim classes are not installed.'
29-
health.report_info 'use `ensure_installed = true` in the scnvim setup function'
28+
health.error 'scnvim classes are not installed.'
29+
health.info 'use `ensure_installed = true` in the scnvim setup function'
3030
else
31-
health.report_ok('scnvim classes are installed: ' .. class_path)
31+
health.ok('scnvim classes are installed: ' .. class_path)
3232
end
3333
end
3434

3535
local function check_keymaps()
3636
if vim.tbl_count(config.keymaps) == 0 then
37-
health.report_info 'no keymaps defined'
37+
health.info 'no keymaps defined'
3838
else
39-
health.report_ok 'keymaps are defined'
39+
health.ok 'keymaps are defined'
4040
end
4141
end
4242

4343
local function check_documentation()
4444
local doc = config.documentation
4545
if not doc.cmd then
46-
health.report_info 'using HelpBrowser for documentation'
46+
health.info 'using HelpBrowser for documentation'
4747
else
4848
local exe_path = vim.fn.exepath(doc.cmd)
4949
if exe_path ~= '' then
50-
health.report_ok(doc.cmd)
50+
health.ok(doc.cmd)
5151
end
5252
if doc.args then
5353
local vin = false
@@ -60,30 +60,30 @@ local function check_documentation()
6060
end
6161
end
6262
if vin and vout then
63-
health.report_ok(vim.inspect(doc.args))
63+
health.ok(vim.inspect(doc.args))
6464
elseif vout and not vin then
65-
health.report_error 'argument list is missing input placeholder ($1)'
65+
health.error 'argument list is missing input placeholder ($1)'
6666
elseif vin and not vout then
67-
health.report_error 'argument list is missing output placeholder ($2)'
67+
health.error 'argument list is missing output placeholder ($2)'
6868
else
69-
health.report_error 'argument list is missing both input and output placeholders ($1/$2)'
69+
health.error 'argument list is missing both input and output placeholders ($1/$2)'
7070
end
7171
end
7272
if doc.on_open then
73-
health.report_info 'using external function for on_open'
73+
health.info 'using external function for on_open'
7474
end
7575
if doc.on_select then
76-
health.report_info 'using external function for on_select'
76+
health.info 'using external function for on_select'
7777
end
7878
end
7979
end
8080

8181
local function check_sclang()
8282
local ok, ret = pcall(sclang.find_sclang_executable)
8383
if ok then
84-
health.report_ok('sclang executable: ' .. ret)
84+
health.ok('sclang executable: ' .. ret)
8585
else
86-
health.report_error(ret)
86+
health.error(ret)
8787
end
8888
end
8989

@@ -96,29 +96,29 @@ local function check_extensions()
9696
for _, name in ipairs(installed) do
9797
local health_check = extensions._health[name]
9898
if health_check then
99-
health.report_start(string.format('extension: "%s"', name))
99+
health.start(string.format('extension: "%s"', name))
100100
health_check()
101101
local link = extensions._linked[name]
102102
if link then
103-
health.report_ok(string.format('installed classes "%s"', link))
103+
health.ok(string.format('installed classes "%s"', link))
104104
else
105-
health.report_ok 'no classes to install'
105+
health.ok 'no classes to install'
106106
end
107107
else
108-
health.report_ok(string.format('No health check for "%s"', name))
108+
health.ok(string.format('No health check for "%s"', name))
109109
end
110110
end
111111
end
112112

113113
function M.check()
114-
health.report_start 'scnvim'
114+
health.start 'scnvim'
115115
check_nvim_version()
116116
check_sclang()
117117
check_classes_installed()
118118
check_keymaps()
119-
health.report_start 'scnvim documentation'
119+
health.start 'scnvim documentation'
120120
check_documentation()
121-
health.report_start 'scnvim extensions'
121+
health.start 'scnvim extensions'
122122
check_extensions()
123123
end
124124

0 commit comments

Comments
 (0)