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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
local server = require "nvim-lsp-installer.server"
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 platform = require "nvim-lsp-installer.platform"
local installers = require "nvim-lsp-installer.installers"
local coalesce, when = Data.coalesce, Data.when
return function(name, root_dir)
local solang_executable_installer = installers.pipe {
context.use_github_release_file(
"hyperledger-labs/solang",
coalesce(
when(platform.is_mac and platform.arch == "x64", "solang-mac-intel"),
when(platform.is_mac and platform.arch == "arm64", "solang-mac-arm"),
when(platform.is_linux, "solang-linux"),
when(platform.is_win, "solang.exe")
)
),
context.capture(function(ctx)
return std.download_file(ctx.github_release_file, platform.is_win and "solang.exe" or "solang")
end),
std.chmod("+x", { "solang" }),
}
local llvm_installer = installers.pipe {
context.use_github_release_file(
"hyperledger-labs/solang",
coalesce(
when(platform.is_mac and platform.arch == "x64", "llvm12.0-mac-intel.tar.xz"),
when(platform.is_mac and platform.arch == "arm64", "llvm12.0-mac-arm.tar.xz"),
when(platform.is_linux and platform.arch == "x64", "llvm12.0-linux-x86-64.tar.xz"),
when(platform.is_win, "llvm12.0-win.zip")
)
),
context.capture(function(ctx)
if platform.is_win then
return std.unzip_remote(ctx.github_release_file)
else
return std.untarxz_remote(ctx.github_release_file)
end
end),
}
return server.Server:new {
name = name,
root_dir = root_dir,
homepage = "https://solang.readthedocs.io/en/latest/",
languages = { "solang" },
installer = {
solang_executable_installer,
llvm_installer,
},
default_options = {
cmd = { path.concat { root_dir, "solang" }, "--language-server" },
cmd_env = {
PATH = table.concat({ path.concat { root_dir, "llvm12.0", "bin" }, vim.env.PATH }, platform.path_sep),
},
},
}
end
|