diff options
Diffstat (limited to 'lua/nvim-lsp-installer/servers/rust_analyzer/init.lua')
| -rw-r--r-- | lua/nvim-lsp-installer/servers/rust_analyzer/init.lua | 91 |
1 files changed, 45 insertions, 46 deletions
diff --git a/lua/nvim-lsp-installer/servers/rust_analyzer/init.lua b/lua/nvim-lsp-installer/servers/rust_analyzer/init.lua index 16689571..56acc3b5 100644 --- a/lua/nvim-lsp-installer/servers/rust_analyzer/init.lua +++ b/lua/nvim-lsp-installer/servers/rust_analyzer/init.lua @@ -1,63 +1,62 @@ local server = require "nvim-lsp-installer.server" local process = require "nvim-lsp-installer.process" local platform = require "nvim-lsp-installer.platform" -local std = require "nvim-lsp-installer.installers.std" -local context = require "nvim-lsp-installer.installers.context" local Data = require "nvim-lsp-installer.data" +local github = require "nvim-lsp-installer.core.managers.github" +local std = require "nvim-lsp-installer.core.managers.std" local coalesce, when = Data.coalesce, Data.when -local libc = platform.get_libc() - -local target = coalesce( - when( - platform.is_mac, - coalesce( - when(platform.arch == "arm64", "rust-analyzer-aarch64-apple-darwin.gz"), - when(platform.arch == "x64", "rust-analyzer-x86_64-apple-darwin.gz") - ) - ), - when( - platform.is_linux, - coalesce( - when( - libc == "glibc", - coalesce( - when(platform.arch == "arm64", "rust-analyzer-aarch64-unknown-linux-gnu.gz"), - when(platform.arch == "x64", "rust-analyzer-x86_64-unknown-linux-gnu.gz") - ) - ), - when(libc == "musl", coalesce(when(platform.arch == "x64", "rust-analyzer-x86_64-unknown-linux-musl.gz"))) - ) - ), - when( - platform.is_win, - coalesce( - when(platform.arch == "arm64", "rust-analyzer-aarch64-pc-windows-msvc.gz"), - when(platform.arch == "x64", "rust-analyzer-x86_64-pc-windows-msvc.gz") - ) - ) -) - return function(name, root_dir) return server.Server:new { name = name, root_dir = root_dir, homepage = "https://rust-analyzer.github.io", languages = { "rust" }, - installer = { - context.use_github_release_file("rust-lang/rust-analyzer", target), - context.capture(function(ctx) - return std.gunzip_remote( - ctx.github_release_file, - platform.is_win and "rust-analyzer.exe" or "rust-analyzer" + async = true, + installer = function() + local libc = platform.get_libc() + + local asset_file = coalesce( + when( + platform.is_mac, + coalesce( + when(platform.arch == "arm64", "rust-analyzer-aarch64-apple-darwin.gz"), + when(platform.arch == "x64", "rust-analyzer-x86_64-apple-darwin.gz") + ) + ), + when( + platform.is_linux, + coalesce( + when( + libc == "glibc", + coalesce( + when(platform.arch == "arm64", "rust-analyzer-aarch64-unknown-linux-gnu.gz"), + when(platform.arch == "x64", "rust-analyzer-x86_64-unknown-linux-gnu.gz") + ) + ), + when( + libc == "musl", + coalesce(when(platform.arch == "x64", "rust-analyzer-x86_64-unknown-linux-musl.gz")) + ) + ) + ), + when( + platform.is_win, + coalesce( + when(platform.arch == "arm64", "rust-analyzer-aarch64-pc-windows-msvc.gz"), + when(platform.arch == "x64", "rust-analyzer-x86_64-pc-windows-msvc.gz") + ) ) - end), - std.chmod("+x", { "rust-analyzer" }), - context.receipt(function(receipt, ctx) - receipt:with_primary_source(receipt.github_release_file(ctx)) - end), - }, + ) + + github.gunzip_release_file({ + repo = "rust-lang/rust-analyzer", + asset_file = asset_file, + out_file = platform.is_win and "rust-analyzer.exe" or "rust-analyzer", + }).with_receipt() + std.chmod("+x", { "rust-analyzer" }) + end, default_options = { cmd_env = { PATH = process.extend_path { root_dir }, |
