Skip to content

Commit 7d73539

Browse files
committed
feat(health): add checks for plugin dependencies
1 parent 0161a71 commit 7d73539

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

lua/neotest-java/health.lua

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,51 @@ local function check_bin(name)
1010
end
1111
end
1212

13+
local function check_treesitter()
14+
local ok, parsers = pcall(require, "nvim-treesitter.parsers")
15+
if not ok then
16+
health.error("'nvim-treesitter' is not installed", {
17+
"Install it: https://github.com/nvim-treesitter/nvim-treesitter",
18+
})
19+
return
20+
end
21+
if not parsers.has_parser("java") then
22+
health.error("Tree-sitter parser for 'java' is missing", {
23+
"Run :TSInstall java",
24+
})
25+
else
26+
health.ok("Tree-sitter parser for 'java' is installed")
27+
end
28+
health.warn("Make sure Tree-sitter parser for 'java' is up-to-date", {
29+
"Run :TSUpdate java",
30+
})
31+
end
32+
33+
local function check_plugin(mod_name, repo_url)
34+
local ok = pcall(require, mod_name)
35+
if ok then
36+
health.ok(string.format("Plugin '%s' is installed", mod_name))
37+
else
38+
health.error(string.format("Plugin '%s' is missing", mod_name), {
39+
"Install it: https://github.com/" .. repo_url,
40+
})
41+
end
42+
end
43+
1344
return {
1445
check = function()
46+
health.start("Required plugin depencies:")
47+
check_plugin("neotest", "nvim-neotest/neotest")
48+
check_plugin("nvim-treesitter", "nvim-treesitter/nvim-treesitter")
49+
check_treesitter()
50+
check_plugin("nio", "nvim-neotest/nvim-nio")
51+
check_plugin("plenary", "nvim-lua/plenary.nvim")
52+
check_plugin("jdtls", "mfussenegger/nvim-jdtls")
53+
check_plugin("dap", "mfussenegger/nvim-dap")
54+
check_plugin("dapui", "rcarriga/nvim-dap-ui")
55+
check_plugin("nvim-dap-virtual-text", "theHamsta/nvim-dap-virtual-text")
56+
57+
health.start("Required binaries:")
1558
check_bin(binaries.java())
1659
check_bin(binaries.javac())
1760
end,

0 commit comments

Comments
 (0)