Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ want, following options are available
-- load java test plugins
java_test = {
enable = true,
version = '0.43.0',
version = '0.40.1',
},

-- load java debugger plugins
Expand All @@ -377,7 +377,7 @@ want, following options are available

spring_boot_tools = {
enable = true,
version = '1.59.0',
version = '1.55.1',
},

jdk = {
Expand Down Expand Up @@ -416,7 +416,16 @@ want, following options are available
-- will stop setup
invalid_mason_registry = false,
},

mason = {
-- These mason registries will be prepended to the existing mason
-- configuration
registries = {
'github:nvim-java/mason-registry',
},
},
}

```

</details>
Expand Down
12 changes: 6 additions & 6 deletions lazy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ return {
},
{
'williamboman/mason.nvim',
opts = {
registries = {
'github:nvim-java/mason-registry',
'github:mason-org/mason-registry',
},
},
-- opts = {
-- registries = {
-- 'github:nvim-java/mason-registry',
-- 'github:mason-org/mason-registry',
-- },
-- },
},
},
}
9 changes: 9 additions & 0 deletions lua/java/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
---@field jdk { auto_install: boolean, version: string }
---@field notifications { dap: boolean }
---@field verification { invalid_order: boolean, duplicate_setup_calls: boolean, invalid_mason_registry: boolean }
---@field mason { registries: string[] }
local config = {
-- list of file that exists in root of the project
root_markers = {
Expand Down Expand Up @@ -83,6 +84,14 @@ local config = {
-- will stop setup
invalid_mason_registry = false,
},

mason = {
-- These mason registries will be prepended to the existing mason
-- configuration
registries = {
'github:nvim-java/mason-registry',
},
},
}

return config
10 changes: 10 additions & 0 deletions lua/java/startup/mason-dep.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local log = require('java.utils.log')
local mason_ui = require('mason.ui')
local mason_util = require('java.utils.mason')
local list_util = require('java-core.utils.list')
local notify = require('java-core.utils.notify')
local async = require('java-core.utils.async')
local lazy = require('java.ui.lazy')
Expand All @@ -13,6 +14,15 @@ local M = {}
---Install mason package dependencies for nvim-java
---@param config java.Config
function M.install(config)
local mason_default_config = require('mason.settings').current

local registries = list_util
:new(config.mason.registries)
:concat(mason_default_config.registries)

require('mason').setup({
registries = registries,
})
local packages = M.get_pkg_list(config)
local is_outdated = mason_util.is_outdated(packages)

Expand Down