Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat: Mason 2.0 migration Pt. 3: fixed formatting and typos, added mi…
…ssing diagnostic disable's
  • Loading branch information
logrusx committed Aug 5, 2025
commit abf09e0ff9a31f492567f8014146a2d401fb6980
9 changes: 5 additions & 4 deletions lua/java/startup/mason-dep.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local notify = require('java-core.utils.notify')
local async = require('java-core.utils.async')
local lazy = require('java.ui.lazy')
local sync = async.sync
local mason_v2 = require("mason.version").MAJOR_VERSION == 2
local mason_v2 = require('mason.version').MAJOR_VERSION == 2

local List = require('java-core.utils.list')

Expand All @@ -29,11 +29,12 @@ end
---@param registries java.Config
local function add_custom_registries_v2(registries)
for _, reg in ipairs(registries) do
require("mason-registry").sources:prepend(reg)
---@diagnostic disable-next-line: undefined-field
require('mason-registry').sources:prepend(reg)
end
end

if (mason_v2) then
if mason_v2 then
M.add_custom_registries = add_custom_registries_v2
else
M.add_custom_registries = add_custom_registries_v1
Expand Down Expand Up @@ -66,7 +67,7 @@ function M.refresh_and_install(packages)
lazy.close_lazy_if_opened()

mason_ui.open()
notify.warn('Please close and re-open after dependecies are installed')
notify.warn('Please close and re-open after dependencies are installed')
end)

mason_util.refresh_registry()
Expand Down
6 changes: 4 additions & 2 deletions lua/java/startup/mason-registry-check.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
local mason_v2 = require('mason.version').MAJOR_VERSION==2
local mason_v2 = require('mason.version').MAJOR_VERSION == 2

local mason_sources

if mason_v2 then
-- compiler will complain when Mason 1.x is used
---@diagnostic disable-next-line: undefined-field
mason_sources = require('mason-registry').sources
else
mason_sources = require('mason-registry.sources')
Expand Down Expand Up @@ -33,7 +35,7 @@ function M.is_valid()
if reg.id == M.JAVA_REG_ID then
return {
success = true,
continue = true
continue = true,
}
end
end
Expand Down
4 changes: 2 additions & 2 deletions lua/java/utils/mason.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function M.is_available(package_name, package_version)
else
-- the compiler will complain when mason 2.x is in use
---@diagnostic disable-next-line: param-type-mismatch
pkg:get_installed_version(function (success, version)
pkg:get_installed_version(function(success, version)
if success then
installed_version = version
end
Expand All @@ -50,7 +50,7 @@ function M.is_installed(package_name, package_version)
else
-- the compiler will complain when Mason 2.x is in use
---@diagnostic disable-next-line: param-type-mismatch
pkg:get_installed_version(function (success, version)
pkg:get_installed_version(function(success, version)
if success then
installed_version = version
end
Expand Down