Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd25bc1c

Browse files
authored
🐛fix(mason v2.0): Compatibility added (#376)
* 🐛fix(`mason v2.0`): Compatibility added* format: stylua
1 parente552f06 commitd25bc1c

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

‎lua/java/utils/mason.lua‎

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,33 @@ local await = async.wait_handle_ok
66
localM= {}
77

88
functionM.is_available(package_name,package_version)
9+
-- guard clause
910
localhas_pkg=mason_reg.has_package(package_name)
10-
1111
ifnothas_pkgthen
1212
returnfalse
1313
end
1414

15-
localhas_version=false
16-
15+
-- check
1716
localpkg=mason_reg.get_package(package_name)
18-
pkg:get_installed_version(function(success,version)
19-
ifsuccessandversion==package_versionthen
20-
has_version=true
21-
end
22-
end)
17+
localversion=pkg:get_installed_version()
18+
localhas_version=version==package_version
2319

2420
returnhas_version
2521
end
2622

2723
functionM.is_installed(package_name,package_version)
24+
-- guard clause
2825
localpkg=mason_reg.get_package(package_name)
2926
localis_installed=pkg:is_installed()
30-
3127
ifnotis_installedthen
3228
returnfalse
3329
end
3430

35-
localinstalled_version
36-
pkg:get_installed_version(function(ok,version)
37-
ifnotokthen
38-
return
39-
end
40-
41-
installed_version=version
42-
end)
31+
-- check
32+
localinstalled_version=pkg:get_installed_version()
33+
is_installed=installed_version==package_version
4334

44-
returninstalled_version==package_version
35+
returnis_installed
4536
end
4637

4738
functionM.is_outdated(packages)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp