aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/reason_ls/init.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-04-21 12:09:59 +0200
committerGitHub <noreply@github.com>2022-04-21 12:09:59 +0200
commitb68fcc6bb2c770495ff8e2508c06dfdd49abcc80 (patch)
treedf7c71efb59958deb21a18eeccf3e3c43c4cd704 /lua/nvim-lsp-installer/servers/reason_ls/init.lua
parentrun autogen_metadata.lua (diff)
downloadmason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.gz
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.bz2
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.lz
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.xz
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.zst
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.zip
chore: refactor remaining installers to async impl (#616)
Diffstat (limited to 'lua/nvim-lsp-installer/servers/reason_ls/init.lua')
-rw-r--r--lua/nvim-lsp-installer/servers/reason_ls/init.lua34
1 files changed, 15 insertions, 19 deletions
diff --git a/lua/nvim-lsp-installer/servers/reason_ls/init.lua b/lua/nvim-lsp-installer/servers/reason_ls/init.lua
index 5cb94119..ceca2612 100644
--- a/lua/nvim-lsp-installer/servers/reason_ls/init.lua
+++ b/lua/nvim-lsp-installer/servers/reason_ls/init.lua
@@ -1,36 +1,32 @@
local server = require "nvim-lsp-installer.server"
local platform = require "nvim-lsp-installer.platform"
local path = require "nvim-lsp-installer.path"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
local Data = require "nvim-lsp-installer.data"
local process = require "nvim-lsp-installer.process"
+local github = require "nvim-lsp-installer.core.managers.github"
local coalesce, when = Data.coalesce, Data.when
return function(name, root_dir)
- local archive_name = coalesce(
- when(platform.is_mac, "rls-macos"),
- when(platform.is_linux, "rls-linux"),
- when(platform.is_win, "rls-windows")
- )
return server.Server:new {
name = name,
root_dir = root_dir,
languages = { "reason" },
homepage = "https://github.com/jaredly/reason-language-server",
- installer = {
- context.use_github_release_file("jaredly/reason-language-server", ("%s.zip"):format(archive_name)),
- context.capture(function(ctx)
- return std.unzip_remote(ctx.github_release_file)
- end),
- context.capture(function()
- return std.rename(archive_name, "reason")
- end),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ local archive_name = coalesce(
+ when(platform.is_mac, "rls-macos"),
+ when(platform.is_linux, "rls-linux"),
+ when(platform.is_win, "rls-windows")
+ )
+ github.unzip_release_file({
+ repo = "jaredly/reason-language-server",
+ asset_file = ("%s.zip"):format(archive_name),
+ }).with_receipt()
+ ctx.fs:rename(archive_name, "reason")
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { path.concat { root_dir, "reason" } },