1
1
local health = vim .health or require (" health" )
2
2
local fmt = string.format
3
3
4
+ -- Polyfill deprecated health api
5
+ if vim .fn .has (" nvim-0.10" ) ~= 1 then
6
+ health = {
7
+ start = health .report_start ,
8
+ ok = health .report_ok ,
9
+ info = health .report_info ,
10
+ warn = health .report_warn ,
11
+ error = health .report_error ,
12
+ }
13
+ end
14
+
4
15
local M = {}
5
16
6
17
M .plugin_deps = {
25
36
26
37
function M .check ()
27
38
if vim .fn .has (" nvim-0.7" ) == 0 then
28
- health .report_error (" Diffview.nvim requires Neovim 0.7.0+" )
39
+ health .error (" Diffview.nvim requires Neovim 0.7.0+" )
29
40
end
30
41
31
42
-- LuaJIT
32
43
if not _G .jit then
33
- health .report_error (" Not running on LuaJIT! Non-JIT Lua runtimes are not officially supported by the plugin. Mileage may vary." )
44
+ health .error (" Not running on LuaJIT! Non-JIT Lua runtimes are not officially supported by the plugin. Mileage may vary." )
34
45
end
35
46
36
- health .report_start (" Checking plugin dependencies" )
47
+ health .start (" Checking plugin dependencies" )
37
48
38
49
local missing_essential = false
39
50
40
51
for _ , plugin in ipairs (M .plugin_deps ) do
41
52
if lualib_available (plugin .name ) then
42
- health .report_ok (plugin .name .. " installed." )
53
+ health .ok (plugin .name .. " installed." )
43
54
else
44
55
if plugin .optional then
45
- health .report_warn (fmt (" Optional dependency '%s' not found." , plugin .name ))
56
+ health .warn (fmt (" Optional dependency '%s' not found." , plugin .name ))
46
57
else
47
58
missing_essential = true
48
- health .report_error (fmt (" Dependency '%s' not found!" , plugin .name ))
59
+ health .error (fmt (" Dependency '%s' not found!" , plugin .name ))
49
60
end
50
61
end
51
62
end
52
63
53
- health .report_start (" Checking VCS tools" )
64
+ health .start (" Checking VCS tools" )
54
65
55
66
;(function ()
56
67
if missing_essential then
57
- health .report_warn (" Cannot perform checks on external dependencies without all essential plugin dependencies installed!" )
68
+ health .warn (" Cannot perform checks on external dependencies without all essential plugin dependencies installed!" )
58
69
return
59
70
end
60
71
61
- health .report_info (" The plugin requires at least one of the supported VCS tools to be valid." )
72
+ health .info (" The plugin requires at least one of the supported VCS tools to be valid." )
62
73
63
74
local has_valid_adapter = false
64
75
local adapter_kinds = {
@@ -71,19 +82,19 @@ function M.check()
71
82
if not bs .done then kind .class .run_bootstrap () end
72
83
73
84
if bs .version_string then
74
- health .report_ok (fmt (" %s found." , kind .name ))
85
+ health .ok (fmt (" %s found." , kind .name ))
75
86
end
76
87
77
88
if bs .ok then
78
- health .report_ok (fmt (" %s is up-to-date. (%s)" , kind .name , bs .version_string ))
89
+ health .ok (fmt (" %s is up-to-date. (%s)" , kind .name , bs .version_string ))
79
90
has_valid_adapter = true
80
91
else
81
- health .report_warn (bs .err or (kind .name .. " : Unknown error" ))
92
+ health .warn (bs .err or (kind .name .. " : Unknown error" ))
82
93
end
83
94
end
84
95
85
96
if not has_valid_adapter then
86
- health .report_error (" No valid VCS tool was found!" )
97
+ health .error (" No valid VCS tool was found!" )
87
98
end
88
99
end )()
89
100
end
0 commit comments