File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -316,6 +316,12 @@ want, following options are available
316316 -- Set following property value to false to disable the notification if
317317 -- you know what you are doing
318318 duplicate_setup_calls = true ,
319+
320+ -- nvim-java checks if nvim-java/mason-registry is added correctly to
321+ -- mason.nvim plugin.
322+ -- IF it's not registered correctly, an error will be thrown and nvim-java
323+ -- will stop setup
324+ invalid_mason_registry = true ,
319325 },
320326}
321327```
Original file line number Diff line number Diff line change 44--- @field java_debug_adapter { enable : boolean }
55--- @field jdk { auto_install : boolean }
66--- @field notifications { dap : boolean }
7- --- @field verification { invalid_order : boolean , duplicate_setup_calls : boolean }
7+ --- @field verification { invalid_order : boolean , duplicate_setup_calls : boolean , invalid_mason_registry : boolean }
88local config = {
99 -- list of file that exists in root of the project
1010 root_markers = {
@@ -57,6 +57,12 @@ local config = {
5757 -- Set following property value to false to disable the notification if
5858 -- you know what you are doing
5959 duplicate_setup_calls = true ,
60+
61+ -- nvim-java checks if nvim-java/mason-registry is added correctly to
62+ -- mason.nvim plugin.
63+ -- IF it's not registered correctly, an error will be thrown and nvim-java
64+ -- will stop setup
65+ invalid_mason_registry = true ,
6066 },
6167}
6268
Original file line number Diff line number Diff line change 1+ local mason_source = require (' mason-registry.sources' )
2+
3+ local M = {
4+ JAVA_REG_ID = ' github:nvim-java/mason-registry' ,
5+ }
6+
7+ function M .is_valid ()
8+ local has_reg = false
9+
10+ for reg in mason_source .iter () do
11+ if reg .id == M .JAVA_REG_ID then
12+ has_reg = true
13+ goto continue
14+ end
15+ end
16+
17+ :: continue::
18+
19+ if has_reg then
20+ return {
21+ success = true ,
22+ continue = true ,
23+ }
24+ end
25+
26+ return {
27+ success = false ,
28+ continue = false ,
29+ message = ' nvim-java mason registry is not added correctly!'
30+ .. ' \n This occurs when mason.nvim configured incorrectly'
31+ .. ' \n Please refer the link below to fix the issue'
32+ .. ' \n https://github.com/nvim-java/nvim-java/wiki/Q-&-A#no_entry-cannot-find-package-xxxxx' ,
33+ }
34+ end
35+
36+ return M
Original file line number Diff line number Diff line change @@ -5,6 +5,13 @@ local function get_checkers()
55 local config = vim .g .nvim_java_config
66 local checks = {}
77
8+ if config .verification .invalid_mason_registry then
9+ table.insert (
10+ checks ,
11+ select (1 , require (' java.startup.mason-registry-check' ))
12+ )
13+ end
14+
815 if config .verification .invalid_order then
916 table.insert (checks , select (1 , require (' java.startup.exec-order-check' )))
1017 end
You can’t perform that action at this time.
0 commit comments