aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer
diff options
context:
space:
mode:
Diffstat (limited to 'lua/nvim-lsp-installer')
-rw-r--r--lua/nvim-lsp-installer/servers/init.lua1
-rw-r--r--lua/nvim-lsp-installer/servers/solang/init.lua61
2 files changed, 62 insertions, 0 deletions
diff --git a/lua/nvim-lsp-installer/servers/init.lua b/lua/nvim-lsp-installer/servers/init.lua
index 05abda53..48516442 100644
--- a/lua/nvim-lsp-installer/servers/init.lua
+++ b/lua/nvim-lsp-installer/servers/init.lua
@@ -82,6 +82,7 @@ local CORE_SERVERS = Data.set_of {
"rome",
"rust_analyzer",
"serve_d",
+ "solang",
"solargraph",
"sqlls",
"sqls",
diff --git a/lua/nvim-lsp-installer/servers/solang/init.lua b/lua/nvim-lsp-installer/servers/solang/init.lua
new file mode 100644
index 00000000..b1405f46
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/solang/init.lua
@@ -0,0 +1,61 @@
+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.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.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,
+ 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