forked from NormalNvim/NormalNvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhealth.lua
More file actions
265 lines (253 loc) · 7.32 KB
/
Copy pathhealth.lua
File metadata and controls
265 lines (253 loc) · 7.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
-- Command to check if you have the required dependencies to use NormalNvim.
-- DESCRIPTION:
-- To use it run the command :checkhealth base
local M = {}
function M.check()
-- Get normalnvim_version from the plugin distroupdate, if present.
local success, git_utils = pcall(require, "distroupdate.utils.git")
success = success and vim.fn.executable("git") == 1
local normalnvim_version = success and git_utils.current_version(false) or "unknown"
local distroupdate_config = vim.g.distroupdate_config or {}
if distroupdate_config.branch == "nightly" then
normalnvim_version = ("nightly (%s)"):format(normalnvim_version)
end
-- Title
vim.health.start("NormalNvim health stats:")
-- Print NormalNvim version
vim.health.info("NormalNvim Version: " .. normalnvim_version)
vim.health.info(
"Neovim Version: v"
.. vim.fn.matchstr(vim.fn.execute("version"), "NVIM v\\zs[^\n]*")
)
-- Print Neovim version
if vim.version().prerelease then
vim.health.warn(
"Neovim nightly is not officially supported and may have breaking changes"
)
elseif vim.fn.has("nvim-0.10") == 1 then
vim.health.ok("Using stable Neovim >= 0.10.0")
else
vim.health.error("Neovim >= 0.10.0 is required")
end
-- Checks to perform.
local programs = {
{
cmd = { "git" },
type = "error",
msg = "Used for core functionality such as updater and plugin management.",
},
{
cmd = { "luarocks" },
type = "error",
msg = "Used for core functionality such as updater and plugin management.",
},
{
cmd = { "node" },
type = "error",
msg = "Used for core functionality such as updater and plugin management.",
},
{
cmd = { "yarn" },
type = "error",
msg = "Used for core functionality such as updater and plugin management.",
},
{
cmd = { "cargo" },
type = "error",
msg = "Used by nvim-spectre to install oxi. Also by dooku.nvim to generate rust html docs.",
},
{
cmd = { "yazi" },
type = "error",
msg = "Used to enable yazi file browser.",
},
{
cmd = { "markmap" },
type = "warn",
msg = "Used by markmap.nvim. Make sure yarn is in your PATH. To learn how check markmap.nvim github page.",
},
{
cmd = { "fd" },
type = "error",
msg = "Used for nvim-spectre to find using fd.",
},
{
cmd = { "lazygit" },
type = "warn",
msg = "Used for mappings to pull up git TUI (Optional)",
},
{
cmd = { "gitui" },
type = "warn",
msg = "Used for mappings to pull up git TUI (Optional)",
},
{
cmd = { "delta" },
type = "warn",
msg = "Used by undotree to show a diff (Optional)",
},
{
cmd = { "grcov" },
type = "warn",
msg = "Used to show code coverage (Optional)",
},
{
cmd = { "grcov" },
type = "warn",
msg = "Used to show code coverage (Optional)",
},
{
cmd = { "jest" },
type = "warn",
msg = "Used to run typescript and javascript tests (Optional)",
},
{
cmd = { "pytest" },
type = "warn",
msg = "Used to run python tests (Optional)",
},
{
cmd = { "cargo nextest" },
type = "warn",
msg = "Used to run rust tests (optional)\nNOTE: checkhealth won't detect this correctly, but you can confirm it works correctly with 'cargo nextest'.",
},
{
cmd = { "nunit" },
type = "warn",
msg = "Used to run C# tests (optional)\nNOTE: There is no way to install this system wide. To use it you must add it to your dotnet C# project: 'dotnet add package NUnit NUnit3TestAdapter'.",
},
{
cmd = { "csc" },
type = "warn",
msg = "Used by compiler.nvim to compile non dotnet C# files (Optional)",
},
{
cmd = { "mono" },
type = "warn",
msg = "Used by compiler.nvim to run non dotnet C# files. (Optional)",
},
{
cmd = { "dotnet" },
type = "warn",
msg = "Used by compiler.nvim and DAP to operate with dotnet projects (optional)\nNOTE: Make sure you also have the system package dotnet-sdk installed.",
},
{
cmd = { "java" },
type = "warn",
msg = "Used by compiler.nvim and dap to operate with java (Optional)",
},
{
cmd = { "javac" },
type = "warn",
msg = "Used by compiler.nvim to compile java (Optional)",
},
{
cmd = { "nasm" },
type = "warn",
msg = "Used by compiler.nvim to compile assembly x86_64 (Optional)",
},
{
cmd = { "gcc" },
type = "warn",
msg = "Used by compiler.nvim to compile C (Optional)",
},
{
cmd = { "g++" },
type = "warn",
msg = "Used by compiler.nvim to compile C++ (Optional)",
},
{
cmd = { "elixir" },
type = "warn",
msg = "Used by compiler.nvim to compile elixir (optional)",
},
{
cmd = { "Rscript" },
type = "warn",
msg = "Used by compiler.nvim to interpretate R (Optional)",
},
{
cmd = { "python" },
type = "warn",
msg = "Used by compiler.nvim to interpretate python (Optional)",
},
{
cmd = { "nuitka" },
type = "warn",
msg = "Used by compiler.nvim to compile python to machine code (Optional)",
},
{
cmd = { "pyinstaller" },
type = "warn",
msg = "Used by compiler.nvim to compile python to bytecode (Optional)",
},
{
cmd = { "ruby" },
type = "warn",
msg = "Used by compiler.nvim to interpretate ruby (optional)",
},
{
cmd = { "perl" },
type = "warn",
msg = "Used by compiler.nvim to interpretate perl (optional)",
},
{
cmd = { "swiftc" },
type = "warn",
msg = "Used by compiler.nvim to compile swift (optional)",
},
{
cmd = { "swift" },
type = "warn",
msg = "Used by compiler.nvim to compile swift (optional)",
},
{
cmd = { "gfortran" },
type = "warn",
msg = "Used by compiler.nvim to compile fortran (optional)",
},
{
cmd = { "fpm" },
type = "warn",
msg = "Used by compiler.nvim to compile fortran (optional)",
},
{
cmd = { "go" },
type = "warn",
msg = "Used by compiler.nvim to compile go (optional)",
},
{
cmd = { "godoc" },
type = "warn",
msg = "Used by dooku.nvim to generate go html docs\nNOTE: If you have it installed but you can't run it on the terminal, ensure you have added 'go' to your OS path (optional)",
},
{
cmd = { "doxygen" },
type = "warn",
msg = "Used by dooku.nvim to generate c/c++/python/java html docs (optional)",
},
}
-- Actually perform the checks we defined above.
for _, program in ipairs(programs) do
if type(program.cmd) == "string" then program.cmd = { program.cmd } end
local name = table.concat(program.cmd, "/")
local found = false
for _, cmd in ipairs(program.cmd) do
if vim.fn.executable(cmd) == 1 then
name = cmd
found = true
break
end
end
if found then
vim.health.ok(("`%s` is installed: %s"):format(name, program.msg))
else
vim.health[program.type](
("`%s` is not installed: %s"):format(name, program.msg)
)
end
end
vim.health.info("")
vim.health.info("Write `:bw` to close `:checkhealth` gracefully.")
end
return M