1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
local server = require "nvim-lsp-installer.server"
local platform = require "nvim-lsp-installer.platform"
local process = require "nvim-lsp-installer.process"
local Data = require "nvim-lsp-installer.data"
local std = require "nvim-lsp-installer.core.managers.std"
local github_client = require "nvim-lsp-installer.core.managers.github.client"
local path = require "nvim-lsp-installer.path"
local coalesce, when = Data.coalesce, Data.when
return function(name, root_dir)
return server.Server:new {
name = name,
root_dir = root_dir,
homepage = "https://haskell-language-server.readthedocs.io/en/latest/",
languages = { "haskell" },
---@param ctx InstallContext
installer = function(ctx)
local repo = "haskell/haskell-language-server"
local release = ctx.requested_version:or_else_get(function()
return github_client.fetch_latest_release(repo)
:map(
---@param release GitHubRelease
function(release)
return release.tag_name
end
)
:get_or_throw()
end)
std.ensure_executable("ghcup", { help_url = "https://www.haskell.org/ghcup/" })
ctx:promote_cwd()
ctx.spawn.ghcup { "install", "hls", release, "-i", ctx.cwd:get() }
ctx.receipt:with_primary_source(ctx.receipt.github_release(repo, release))
end,
default_options = {
cmd_env = {
PATH = process.extend_path {
platform.is_win and root_dir or path.concat { root_dir, "bin" },
},
},
},
}
end
|