aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers/hls/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/nvim-lsp-installer/servers/hls/init.lua')
-rw-r--r--lua/nvim-lsp-installer/servers/hls/init.lua44
1 files changed, 21 insertions, 23 deletions
diff --git a/lua/nvim-lsp-installer/servers/hls/init.lua b/lua/nvim-lsp-installer/servers/hls/init.lua
index a5966045..a154a4f2 100644
--- a/lua/nvim-lsp-installer/servers/hls/init.lua
+++ b/lua/nvim-lsp-installer/servers/hls/init.lua
@@ -1,11 +1,10 @@
local server = require "nvim-lsp-installer.server"
local platform = require "nvim-lsp-installer.platform"
local process = require "nvim-lsp-installer.process"
-local installers = require "nvim-lsp-installer.installers"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
-local shell = require "nvim-lsp-installer.installers.shell"
local Data = require "nvim-lsp-installer.data"
+local github = require "nvim-lsp-installer.core.managers.github"
+
+local coalesce, when = Data.coalesce, Data.when
return function(name, root_dir)
return server.Server:new {
@@ -13,25 +12,24 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://haskell-language-server.readthedocs.io/en/latest/",
languages = { "haskell" },
- installer = {
- context.use_github_release_file("haskell/haskell-language-server", function(version)
- return Data.coalesce(
- Data.when(platform.is_mac, "haskell-language-server-macOS-%s.tar.gz"),
- Data.when(platform.is_linux, "haskell-language-server-Linux-%s.tar.gz"),
- Data.when(platform.is_win, "haskell-language-server-Windows-%s.tar.gz")
- ):format(version)
- end),
- context.capture(function(ctx)
- return std.untargz_remote(ctx.github_release_file)
- end),
- installers.on {
- -- we can't use std.chmod because of shell wildcard expansion
- unix = shell.sh [[ chmod +x haskell* ]],
- },
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ github.untargz_release_file({
+ repo = "haskell/haskell-language-server",
+ asset_file = function(version)
+ local target = coalesce(
+ when(platform.is_mac, "haskell-language-server-macOS-%s.tar.gz"),
+ when(platform.is_linux, "haskell-language-server-Linux-%s.tar.gz"),
+ when(platform.is_win, "haskell-language-server-Windows-%s.tar.gz")
+ )
+ return target and target:format(version)
+ end,
+ }).with_receipt()
+ if platform.is_unix then
+ ctx.spawn.sh { "-c", [[ chmod +x haskell* ]] }
+ end
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir },