aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/sumneko_lua/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/sumneko_lua/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/sumneko_lua/init.lua')
-rw-r--r--lua/nvim-lsp-installer/servers/sumneko_lua/init.lua65
1 files changed, 31 insertions, 34 deletions
diff --git a/lua/nvim-lsp-installer/servers/sumneko_lua/init.lua b/lua/nvim-lsp-installer/servers/sumneko_lua/init.lua
index 4bf97f7b..943b41f0 100644
--- a/lua/nvim-lsp-installer/servers/sumneko_lua/init.lua
+++ b/lua/nvim-lsp-installer/servers/sumneko_lua/init.lua
@@ -2,9 +2,8 @@ local server = require "nvim-lsp-installer.server"
local path = require "nvim-lsp-installer.path"
local platform = require "nvim-lsp-installer.platform"
local Data = require "nvim-lsp-installer.data"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
local process = require "nvim-lsp-installer.process"
+local github = require "nvim-lsp-installer.core.managers.github"
local coalesce, when = Data.coalesce, Data.when
@@ -14,41 +13,39 @@ return function(name, root_dir)
root_dir = root_dir,
languages = { "lua" },
homepage = "https://github.com/sumneko/lua-language-server",
- installer = {
- context.use_github_release_file("sumneko/vscode-lua", function(version)
- local target = coalesce(
- when(
- platform.is_mac,
- coalesce(
- when(platform.arch == "x64", "vscode-lua-%s-darwin-x64.vsix"),
- when(platform.arch == "arm64", "vscode-lua-%s-darwin-arm64.vsix")
- )
- ),
- when(
- platform.is_linux,
- coalesce(
- when(platform.arch == "x64", "vscode-lua-%s-linux-x64.vsix"),
- when(platform.arch == "arm64", "vscode-lua-%s-linux-arm64.vsix")
- )
- ),
- when(
- platform.is_win,
- coalesce(
- when(platform.arch == "x64", "vscode-lua-%s-win32-x64.vsix"),
- when(platform.arch == "x86", "vscode-lua-%s-win32-ia32.vsix")
+ async = true,
+ installer = function()
+ github.unzip_release_file({
+ repo = "sumneko/vscode-lua",
+ asset_file = function(version)
+ local target = coalesce(
+ when(
+ platform.is_mac,
+ coalesce(
+ when(platform.arch == "x64", "vscode-lua-%s-darwin-x64.vsix"),
+ when(platform.arch == "arm64", "vscode-lua-%s-darwin-arm64.vsix")
+ )
+ ),
+ when(
+ platform.is_linux,
+ coalesce(
+ when(platform.arch == "x64", "vscode-lua-%s-linux-x64.vsix"),
+ when(platform.arch == "arm64", "vscode-lua-%s-linux-arm64.vsix")
+ )
+ ),
+ when(
+ platform.is_win,
+ coalesce(
+ when(platform.arch == "x64", "vscode-lua-%s-win32-x64.vsix"),
+ when(platform.arch == "x86", "vscode-lua-%s-win32-ia32.vsix")
+ )
)
)
- )
- return target and target:format(version)
- end),
- context.capture(function(ctx)
- return std.unzip_remote(ctx.github_release_file)
- end),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ return target and target:format(version)
+ end,
+ }).with_receipt()
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path {