aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2023-08-19 08:31:07 +0200
committerGitHub <noreply@github.com>2023-08-19 08:31:07 +0200
commite9eb0048cecc577a1eec534485d3e010487b46a7 (patch)
tree2c2ccc7015dc6c7f0d79b3a39d5d14c9e64992a9 /lua
parentchore(async): add Channel (#1456) (diff)
downloadmason-e9eb0048cecc577a1eec534485d3e010487b46a7.tar
mason-e9eb0048cecc577a1eec534485d3e010487b46a7.tar.gz
mason-e9eb0048cecc577a1eec534485d3e010487b46a7.tar.bz2
mason-e9eb0048cecc577a1eec534485d3e010487b46a7.tar.lz
mason-e9eb0048cecc577a1eec534485d3e010487b46a7.tar.xz
mason-e9eb0048cecc577a1eec534485d3e010487b46a7.tar.zst
mason-e9eb0048cecc577a1eec534485d3e010487b46a7.zip
feat(cargo): support fetching versions for git crates hosted on github (#1459)
Diffstat (limited to 'lua')
-rw-r--r--lua/mason-core/installer/registry/providers/cargo.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/lua/mason-core/installer/registry/providers/cargo.lua b/lua/mason-core/installer/registry/providers/cargo.lua
index 312a2938..af43db86 100644
--- a/lua/mason-core/installer/registry/providers/cargo.lua
+++ b/lua/mason-core/installer/registry/providers/cargo.lua
@@ -58,6 +58,20 @@ end
---@async
---@param purl Purl
function M.get_versions(purl)
+ ---@type string?
+ local repository_url = _.path({ "qualifiers", "repository_url" }, purl)
+ if repository_url then
+ ---@type Result?
+ local git_tags = _.cond {
+ {
+ _.matches "github.com/(.+)",
+ _.compose(providers.github.get_all_tags, _.head, _.match "github.com/(.+)"),
+ },
+ }(repository_url)
+ if git_tags then
+ return git_tags
+ end
+ end
return providers.crates.get_all_versions(purl.name)
end