@@ -12,15 +12,7 @@ local health = {}
12
12
local Types = require (' haskell-tools.types.internal' )
13
13
local deps = require (' haskell-tools.deps' )
14
14
local HTConfig = require (' haskell-tools.config.internal' )
15
- local h = vim .health or require (' health' )
16
- --- @diagnostic disable-next-line : deprecated
17
- local start = h .start or h .report_start
18
- --- @diagnostic disable-next-line : deprecated
19
- local ok = h .ok or h .report_ok
20
- --- @diagnostic disable-next-line : deprecated
21
- local error = h .error or h .report_error
22
- --- @diagnostic disable-next-line : deprecated
23
- local warn = h .warn or h .report_warn
15
+ local h = vim .health
24
16
25
17
--- @class haskell-tools.LuaDependency
26
18
--- @field module string The name of a module
@@ -99,9 +91,9 @@ local external_dependencies = {
99
91
if errmsg then
100
92
local hoogle_mode = HTConfig .tools .hoogle .mode
101
93
if hoogle_mode and hoogle_mode == ' auto' or hoogle_mode == ' telescope-local' then
102
- error (' hoogle: ' .. errmsg )
94
+ h . error (' hoogle: ' .. errmsg )
103
95
else
104
- warn (' hoogle: ' .. errmsg )
96
+ h . warn (' hoogle: ' .. errmsg )
105
97
end
106
98
end
107
99
end ,
@@ -156,13 +148,13 @@ local external_dependencies = {
156
148
--- @param dep haskell-tools.LuaDependency
157
149
local function check_lua_dependency (dep )
158
150
if deps .has (dep .module ) then
159
- ok (dep .url .. ' installed.' )
151
+ h . ok (dep .url .. ' installed.' )
160
152
return
161
153
end
162
154
if dep .optional () then
163
- warn ((' %s not installed. %s %s' ):format (dep .module , dep .info , dep .url ))
155
+ h . warn ((' %s not installed. %s %s' ):format (dep .module , dep .info , dep .url ))
164
156
else
165
- error ((' Lua dependency %s not found: %s' ):format (dep .module , dep .url ))
157
+ h . error ((' Lua dependency %s not found: %s' ):format (dep .module , dep .url ))
166
158
end
167
159
end
168
160
@@ -195,20 +187,20 @@ local function check_external_dependency(dep)
195
187
local mb_version_newline_idx = mb_version and mb_version :find (' \n ' )
196
188
local mb_version_len = mb_version and (mb_version_newline_idx and mb_version_newline_idx - 1 or mb_version :len ())
197
189
local version = mb_version and mb_version :sub (0 , mb_version_len ) or ' (unknown version)'
198
- ok ((' %s: found %s' ):format (dep .name , version ))
190
+ h . ok ((' %s: found %s' ):format (dep .name , version ))
199
191
if dep .extra_checks then
200
192
dep .extra_checks ()
201
193
end
202
194
return
203
195
end
204
196
if dep .optional () then
205
- warn (([[
197
+ h . warn (([[
206
198
%s: not found.
207
199
Install %s for extended capabilities.
208
200
%s
209
201
]] ):format (dep .name , dep .url , dep .info ))
210
202
else
211
- error (([[
203
+ h . error (([[
212
204
%s: not found.
213
205
haskell-tools.nvim requires %s.
214
206
%s
@@ -217,41 +209,41 @@ local function check_external_dependency(dep)
217
209
end
218
210
219
211
local function check_config ()
220
- start (' Checking config' )
212
+ h . start (' Checking config' )
221
213
if vim .g .haskell_tools and not HTConfig .debug_info .was_g_haskell_tools_sourced then
222
- error (' vim.g.haskell_tools is set, but was not sourced before haskell-tools.nvim was initialized.' )
214
+ h . error (' vim.g.haskell_tools is set, but was not sourced before haskell-tools.nvim was initialized.' )
223
215
return
224
216
end
225
217
local valid , err = require (' haskell-tools.config.check' ).validate (HTConfig )
226
218
if valid then
227
- ok (' No errors found in config.' )
219
+ h . ok (' No errors found in config.' )
228
220
else
229
- error (err or ' ' .. vim .g .haskell_tools and ' ' or ' This looks like a plugin bug!' )
221
+ h . error (err or ' ' .. vim .g .haskell_tools and ' ' or ' This looks like a plugin bug!' )
230
222
end
231
223
local unrecognized_keys = HTConfig .debug_info .unrecognized_keys
232
224
if # unrecognized_keys > 0 then
233
- warn (' unrecognized configs in vim.g.haskell_tools: ' .. vim .inspect (unrecognized_keys ))
225
+ h . warn (' unrecognized configs in vim.g.haskell_tools: ' .. vim .inspect (unrecognized_keys ))
234
226
end
235
227
end
236
228
237
229
local function check_for_conflicts ()
238
- start (' Checking for conflicting plugins' )
230
+ h . start (' Checking for conflicting plugins' )
239
231
for _ , autocmd in ipairs (vim .api .nvim_get_autocmds { event = ' FileType' , pattern = ' haskell' }) do
240
232
if autocmd .group_name and autocmd .group_name == ' lspconfig' and autocmd .desc and autocmd .desc :match (' hls ' ) then
241
- error (' lspconfig.hls has been setup. This will likely lead to conflicts with the haskell-tools LSP client.' )
233
+ h . error (' lspconfig.hls has been setup. This will likely lead to conflicts with the haskell-tools LSP client.' )
242
234
return
243
235
end
244
236
end
245
- ok (' No conflicting plugins detected.' )
237
+ h . ok (' No conflicting plugins detected.' )
246
238
end
247
239
248
240
function health .check ()
249
- start (' Checking for Lua dependencies' )
241
+ h . start (' Checking for Lua dependencies' )
250
242
for _ , dep in ipairs (lua_dependencies ) do
251
243
check_lua_dependency (dep )
252
244
end
253
245
254
- start (' Checking external dependencies' )
246
+ h . start (' Checking external dependencies' )
255
247
for _ , dep in ipairs (external_dependencies ) do
256
248
check_external_dependency (dep )
257
249
end
0 commit comments