From e9eb0048cecc577a1eec534485d3e010487b46a7 Mon Sep 17 00:00:00 2001 From: William Boman Date: Sat, 19 Aug 2023 08:31:07 +0200 Subject: feat(cargo): support fetching versions for git crates hosted on github (#1459) --- lua/mason-core/installer/registry/providers/cargo.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lua') 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 -- cgit v1.2.3-70-g09d2