aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-registry/index/rust-analyzer/init.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2023-02-20 22:19:39 +0100
committerGitHub <noreply@github.com>2023-02-20 22:19:39 +0100
commitb8a6632a0f2d263199d5d480ca85477fe0f414ab (patch)
tree57e1ee0f3cef078ec144ecdf1b2fa861acf47755 /lua/mason-registry/index/rust-analyzer/init.lua
parentchore: autogenerate (#1015) (diff)
downloadmason-b8a6632a0f2d263199d5d480ca85477fe0f414ab.tar
mason-b8a6632a0f2d263199d5d480ca85477fe0f414ab.tar.gz
mason-b8a6632a0f2d263199d5d480ca85477fe0f414ab.tar.bz2
mason-b8a6632a0f2d263199d5d480ca85477fe0f414ab.tar.lz
mason-b8a6632a0f2d263199d5d480ca85477fe0f414ab.tar.xz
mason-b8a6632a0f2d263199d5d480ca85477fe0f414ab.tar.zst
mason-b8a6632a0f2d263199d5d480ca85477fe0f414ab.zip
feat: configurable registries (#1016)
Diffstat (limited to 'lua/mason-registry/index/rust-analyzer/init.lua')
-rw-r--r--lua/mason-registry/index/rust-analyzer/init.lua53
1 files changed, 53 insertions, 0 deletions
diff --git a/lua/mason-registry/index/rust-analyzer/init.lua b/lua/mason-registry/index/rust-analyzer/init.lua
new file mode 100644
index 00000000..27294e29
--- /dev/null
+++ b/lua/mason-registry/index/rust-analyzer/init.lua
@@ -0,0 +1,53 @@
+local Pkg = require "mason-core.package"
+local platform = require "mason-core.platform"
+local _ = require "mason-core.functional"
+local github = require "mason-core.managers.github"
+local std = require "mason-core.managers.std"
+
+local coalesce, when = _.coalesce, _.when
+
+return Pkg.new {
+ name = "rust-analyzer",
+ desc = _.dedent [[
+ rust-analyzer is an implementation of Language Server Protocol for the Rust programming language. It provides
+ features like completion and goto definition for many code editors, including VS Code, Emacs and Vim.
+ ]],
+ homepage = "https://rust-analyzer.github.io",
+ languages = { Pkg.Lang.Rust },
+ categories = { Pkg.Cat.LSP },
+ ---@async
+ ---@param ctx InstallContext
+ install = function(ctx)
+ local asset_file = coalesce(
+ when(platform.is.mac_arm64, "rust-analyzer-aarch64-apple-darwin.gz"),
+ when(platform.is.mac_x64, "rust-analyzer-x86_64-apple-darwin.gz"),
+ when(platform.is.linux_x64_gnu, "rust-analyzer-x86_64-unknown-linux-gnu.gz"),
+ when(platform.is.linux_arm64_gnu, "rust-analyzer-aarch64-unknown-linux-gnu.gz"),
+ when(platform.is.linux_x64_musl, "rust-analyzer-x86_64-unknown-linux-musl.gz"),
+ when(platform.is.win_arm64, "rust-analyzer-aarch64-pc-windows-msvc.zip"),
+ when(platform.is.win_x64, "rust-analyzer-x86_64-pc-windows-msvc.zip")
+ )
+
+ platform.when {
+ unix = function()
+ github
+ .gunzip_release_file({
+ repo = "rust-lang/rust-analyzer",
+ asset_file = asset_file,
+ out_file = "rust-analyzer",
+ })
+ .with_receipt()
+ end,
+ win = function()
+ github
+ .unzip_release_file({
+ repo = "rust-lang/rust-analyzer",
+ asset_file = asset_file,
+ })
+ .with_receipt()
+ end,
+ }
+ std.chmod("+x", { "rust-analyzer" })
+ ctx:link_bin("rust-analyzer", platform.is.win and "rust-analyzer.exe" or "rust-analyzer")
+ end,
+}