aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers
diff options
context:
space:
mode:
Diffstat (limited to 'lua/nvim-lsp-installer/servers')
-rw-r--r--lua/nvim-lsp-installer/servers/arduino_language_server/init.lua228
-rw-r--r--lua/nvim-lsp-installer/servers/beancount/init.lua56
-rw-r--r--lua/nvim-lsp-installer/servers/bicep/init.lua38
-rw-r--r--lua/nvim-lsp-installer/servers/bsl_ls/init.lua32
-rw-r--r--lua/nvim-lsp-installer/servers/ccls/common.lua41
-rw-r--r--lua/nvim-lsp-installer/servers/ccls/init.lua186
-rw-r--r--lua/nvim-lsp-installer/servers/ccls/linux.lua75
-rw-r--r--lua/nvim-lsp-installer/servers/ccls/mac.lua22
-rw-r--r--lua/nvim-lsp-installer/servers/clangd/init.lua41
-rw-r--r--lua/nvim-lsp-installer/servers/clarity_lsp/init.lua24
-rw-r--r--lua/nvim-lsp-installer/servers/clojure_lsp/init.lua35
-rw-r--r--lua/nvim-lsp-installer/servers/codeqlls/init.lua24
-rw-r--r--lua/nvim-lsp-installer/servers/crystalline/init.lua57
-rw-r--r--lua/nvim-lsp-installer/servers/denols/init.lua24
-rw-r--r--lua/nvim-lsp-installer/servers/dhall_lsp_server/init.lua79
-rw-r--r--lua/nvim-lsp-installer/servers/elixirls/init.lua27
-rw-r--r--lua/nvim-lsp-installer/servers/erlangls/init.lua43
-rw-r--r--lua/nvim-lsp-installer/servers/groovyls/init.lua5
-rw-r--r--lua/nvim-lsp-installer/servers/hls/init.lua44
-rw-r--r--lua/nvim-lsp-installer/servers/jdtls/init.lua68
-rw-r--r--lua/nvim-lsp-installer/servers/julials/init.lua45
-rw-r--r--lua/nvim-lsp-installer/servers/kotlin_language_server/init.lua19
-rw-r--r--lua/nvim-lsp-installer/servers/lemminx/init.lua61
-rw-r--r--lua/nvim-lsp-installer/servers/ltex/init.lua53
-rw-r--r--lua/nvim-lsp-installer/servers/mm0_ls/init.lua5
-rw-r--r--lua/nvim-lsp-installer/servers/omnisharp/init.lua76
-rw-r--r--lua/nvim-lsp-installer/servers/opencl_ls/init.lua45
-rw-r--r--lua/nvim-lsp-installer/servers/powershell_es/init.lua27
-rw-r--r--lua/nvim-lsp-installer/servers/prosemd_lsp/init.lua37
-rw-r--r--lua/nvim-lsp-installer/servers/puppet/init.lua23
-rw-r--r--lua/nvim-lsp-installer/servers/quick_lint_js/init.lua105
-rw-r--r--lua/nvim-lsp-installer/servers/r_language_server/init.lua1
-rw-r--r--lua/nvim-lsp-installer/servers/reason_ls/init.lua34
-rw-r--r--lua/nvim-lsp-installer/servers/rescriptls/init.lua23
-rw-r--r--lua/nvim-lsp-installer/servers/rust_analyzer/init.lua91
-rw-r--r--lua/nvim-lsp-installer/servers/serve_d/init.lua51
-rw-r--r--lua/nvim-lsp-installer/servers/slint_lsp/init.lua38
-rw-r--r--lua/nvim-lsp-installer/servers/solang/init.lua69
-rw-r--r--lua/nvim-lsp-installer/servers/solc/init.lua31
-rw-r--r--lua/nvim-lsp-installer/servers/spectral/init.lua10
-rw-r--r--lua/nvim-lsp-installer/servers/sumneko_lua/init.lua65
-rw-r--r--lua/nvim-lsp-installer/servers/terraformls/init.lua59
-rw-r--r--lua/nvim-lsp-installer/servers/texlab/init.lua44
-rw-r--r--lua/nvim-lsp-installer/servers/tflint/init.lua75
-rw-r--r--lua/nvim-lsp-installer/servers/vala_ls/init.lua57
-rw-r--r--lua/nvim-lsp-installer/servers/verible/init.lua99
-rw-r--r--lua/nvim-lsp-installer/servers/zeta_note/init.lua29
-rw-r--r--lua/nvim-lsp-installer/servers/zk/init.lua51
-rw-r--r--lua/nvim-lsp-installer/servers/zls/init.lua48
49 files changed, 1209 insertions, 1311 deletions
diff --git a/lua/nvim-lsp-installer/servers/arduino_language_server/init.lua b/lua/nvim-lsp-installer/servers/arduino_language_server/init.lua
index 49da467a..81188828 100644
--- a/lua/nvim-lsp-installer/servers/arduino_language_server/init.lua
+++ b/lua/nvim-lsp-installer/servers/arduino_language_server/init.lua
@@ -1,122 +1,164 @@
local path = require "nvim-lsp-installer.path"
-local std = require "nvim-lsp-installer.installers.std"
-local installers = require "nvim-lsp-installer.installers"
local server = require "nvim-lsp-installer.server"
-local go = require "nvim-lsp-installer.installers.go"
-local process = require "nvim-lsp-installer.process"
local platform = require "nvim-lsp-installer.platform"
-local context = require "nvim-lsp-installer.installers.context"
local Data = require "nvim-lsp-installer.data"
+local installer = require "nvim-lsp-installer.core.installer"
+local github = require "nvim-lsp-installer.core.managers.github"
+local std = require "nvim-lsp-installer.core.managers.std"
+local Optional = require "nvim-lsp-installer.core.optional"
+local process = require "nvim-lsp-installer.process"
local coalesce, when = Data.coalesce, Data.when
return function(name, root_dir)
- local arduino_cli_installer = installers.branch_context {
- context.set_working_dir "arduino-cli",
- context.set(function(ctx)
- -- The user's requested version should not apply to the CLI.
- ctx.requested_server_version = nil
- end),
- context.use_github_release_file("arduino/arduino-cli", function(version)
- local target_file = coalesce(
- when(platform.is_mac, "arduino-cli_%s_macOS_64bit.tar.gz"),
- when(
- platform.is_linux,
- coalesce(
- when(platform.arch == "x64", "arduino-cli_%s_Linux_64bit.tar.gz"),
- when(platform.arch == "x86", "arduino-cli_%s_Linux_32bit.tar.gz"),
- when(platform.arch == "arm64", "arduino-cli_%s_Linux_ARM64.tar.gz"),
- when(platform.arch == "armv6", "arduino-cli_%s_Linux_ARMv6.tar.gz"),
- when(platform.arch == "armv7", "arduino-cli_%s_Linux_ARMv7.tar.gz")
- )
- ),
- when(
- platform.is_win,
- coalesce(
- when(platform.arch == "x64", "arduino-cli_%s_Windows_64bit.zip"),
- when(platform.arch == "x86", "arduino-cli_%s_Windows_32bit.zip")
+ ---@async
+ local function arduino_cli_installer()
+ local ctx = installer.context()
+
+ ctx.fs:mkdir "arduino-cli"
+ ctx:chdir("arduino-cli", function()
+ local opts = {
+ repo = "arduino/arduino-cli",
+ version = Optional.empty(),
+ asset_file = function(release)
+ local target = coalesce(
+ when(platform.is_mac, "arduino-cli_%s_macOS_64bit.tar.gz"),
+ when(
+ platform.is_linux,
+ coalesce(
+ when(platform.arch == "x64", "arduino-cli_%s_Linux_64bit.tar.gz"),
+ when(platform.arch == "x86", "arduino-cli_%s_Linux_32bit.tar.gz"),
+ when(platform.arch == "arm64", "arduino-cli_%s_Linux_ARM64.tar.gz"),
+ when(platform.arch == "armv6", "arduino-cli_%s_Linux_ARMv6.tar.gz"),
+ when(platform.arch == "armv7", "arduino-cli_%s_Linux_ARMv7.tar.gz")
+ )
+ ),
+ when(
+ platform.is_win,
+ coalesce(
+ when(platform.arch == "x64", "arduino-cli_%s_Windows_64bit.zip"),
+ when(platform.arch == "x86", "arduino-cli_%s_Windows_32bit.zip")
+ )
+ )
)
- )
- )
- return target_file and target_file:format(version)
- end),
- context.capture(function(ctx)
- if platform.is_win then
- return std.unzip_remote(ctx.github_release_file)
- else
- return std.untargz_remote(ctx.github_release_file)
- end
- end),
- std.chmod("+x", { "arduino-cli" }),
- ---@type ServerInstallerFunction
- function(_, callback, ctx)
- process.spawn(path.concat { ctx.install_dir, "arduino-cli" }, {
- args = { "config", "init", "--dest-file", "arduino-cli.yaml", "--overwrite" },
- cwd = ctx.install_dir,
- stdio_sink = ctx.stdio_sink,
- }, callback)
- end,
- context.receipt(function(receipt, ctx)
- receipt:with_secondary_source(receipt.github_release_file(ctx))
- end),
- }
+ return target and target:format(release)
+ end,
+ }
- local arduino_language_server_installer = installers.branch_context {
- context.set_working_dir "arduino-language-server",
- go.packages { "github.com/arduino/arduino-language-server" },
- }
+ platform.when {
+ unix = function()
+ github.untargz_release_file(opts)
+ std.chmod("+x", { "arduino-cli" })
+ end,
+ win = function()
+ github.unzip_release_file(opts)
+ end,
+ }
- local clangd_installer = installers.branch_context {
- context.set(function(ctx)
- -- The user's requested version should not apply to clangd.
- ctx.requested_server_version = nil
- end),
- context.use_github_release_file("clangd/clangd", function(version)
- local target_file = coalesce(
- when(platform.is_mac, "clangd-mac-%s.zip"),
- when(platform.is_linux and platform.arch == "x64", "clangd-linux-%s.zip"),
- when(platform.is_win, "clangd-windows-%s.zip")
- )
- return target_file and target_file:format(version)
- end),
- context.capture(function(ctx)
- return installers.pipe {
- std.unzip_remote(ctx.github_release_file),
- std.rename(("clangd_%s"):format(ctx.requested_server_version), "clangd"),
+ ctx.spawn["arduino-cli"] {
+ "config",
+ "init",
+ "--dest-file",
+ "arduino-cli.yaml",
+ "--overwrite",
+ with_paths = { ctx.cwd:get() },
}
- end),
- context.receipt(function(receipt, ctx)
- receipt:with_secondary_source(receipt.github_release_file(ctx))
- end),
- }
+ end)
+ end
+
+ local function arduino_language_server_installer()
+ local ctx = installer.context()
+ ctx.fs:mkdir "arduino-language-server"
+ ctx:chdir("arduino-language-server", function()
+ local opts = {
+ repo = "arduino/arduino-language-server",
+ asset_file = function(release)
+ local target = coalesce(
+ when(platform.is_mac, "arduino-language-server_%s_macOS_64bit.tar.gz"),
+ when(
+ platform.is_linux and platform.arch == "x64",
+ "arduino-language-server_%s_Linux_64bit.tar.gz"
+ ),
+ when(
+ platform.is_linux and platform.arch == "x86",
+ "arduino-language-server_%s_Linux_32bit.tar.gz"
+ ),
+ when(
+ platform.is_linux and platform.arch == "arm64",
+ "arduino-language-server_%s_Linux_ARM64.tar.gz"
+ ),
+ when(
+ platform.is_win and platform.arch == "x64",
+ "arduino-language-server_0.6.0_Windows_64bit.zip"
+ ),
+ when(
+ platform.is_win and platform.arch == "x86",
+ "arduino-language-server_0.6.0_Windows_32bit.zip"
+ )
+ )
+
+ return target and target:format(release)
+ end,
+ }
+ platform.when {
+ unix = function()
+ github.untargz_release_file(opts)
+ end,
+ win = function()
+ github.unzip_release_file(opts)
+ end,
+ }
+ end)
+ end
+
+ local function clangd_installer()
+ local ctx = installer.context()
+
+ local source = github.unzip_release_file {
+ repo = "clangd/clangd",
+ version = Optional.empty(),
+ asset_file = function(release)
+ local target_file = coalesce(
+ when(platform.is_mac, "clangd-mac-%s.zip"),
+ when(platform.is_linux and platform.arch == "x64", "clangd-linux-%s.zip"),
+ when(platform.is_win, "clangd-windows-%s.zip")
+ )
+ return target_file and target_file:format(release)
+ end,
+ }
+
+ ctx.fs:rename(("clangd_%s"):format(source.release), "clangd")
+ end
return server.Server:new {
name = name,
root_dir = root_dir,
homepage = "https://github.com/arduino/arduino-language-server",
languages = { "arduino" },
- installer = {
- clangd_installer,
- arduino_cli_installer,
- arduino_language_server_installer,
- context.receipt(function(receipt)
- -- We install 3 different components to 3 different subdirectories. This is currently not captured in
- -- the receipt structure.
- receipt:mark_invalid()
- end),
- },
+ async = true,
+ installer = function()
+ clangd_installer()
+ arduino_cli_installer()
+ arduino_language_server_installer()
+ end,
default_options = {
cmd = {
-- This cmd is incomplete. Users need to manually append their FQBN (e.g., -fqbn arduino:avr:nano)
"arduino-language-server",
"-cli",
- path.concat { root_dir, "arduino-cli", platform.is_win and "arduino-cli.exe" or "arduino-cli" },
+ "arduino-cli",
+ "-clangd",
+ "clangd",
"-cli-config",
path.concat { root_dir, "arduino-cli", "arduino-cli.yaml" },
- "-clangd",
- path.concat { root_dir, "clangd", "bin", platform.is_win and "clangd.bat" or "clangd" },
},
- cmd_env = go.env(path.concat { root_dir, "arduino-language-server" }),
+ cmd_env = {
+ PATH = process.extend_path {
+ path.concat { root_dir, "arduino-language-server" },
+ path.concat { root_dir, "arduino-cli" },
+ path.concat { root_dir, "clangd", "bin" },
+ },
+ },
},
}
end
diff --git a/lua/nvim-lsp-installer/servers/beancount/init.lua b/lua/nvim-lsp-installer/servers/beancount/init.lua
index b9908488..e857e44b 100644
--- a/lua/nvim-lsp-installer/servers/beancount/init.lua
+++ b/lua/nvim-lsp-installer/servers/beancount/init.lua
@@ -1,8 +1,6 @@
local server = require "nvim-lsp-installer.server"
-local installers = require "nvim-lsp-installer.installers"
-local context = require "nvim-lsp-installer.installers.context"
-local pip3 = require "nvim-lsp-installer.installers.pip3"
-local std = require "nvim-lsp-installer.installers.std"
+local github = require "nvim-lsp-installer.core.managers.github"
+local pip3 = require "nvim-lsp-installer.core.managers.pip3"
local Data = require "nvim-lsp-installer.data"
local platform = require "nvim-lsp-installer.platform"
local process = require "nvim-lsp-installer.process"
@@ -10,47 +8,37 @@ local process = require "nvim-lsp-installer.process"
local coalesce, when = Data.coalesce, Data.when
return function(name, root_dir)
- local file_ext = platform.is_win and ".exe" or ""
return server.Server:new {
name = name,
root_dir = root_dir,
languages = { "beancount" },
homepage = "https://github.com/polarmutex/beancount-language-server",
- installer = {
- context.use_github_release_file(
- "polarmutex/beancount-language-server",
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ local asset_file = assert(
coalesce(
when(platform.is_mac, "beancount-language-server-macos-x64.zip"),
when(platform.is_linux and platform.arch == "x64", "beancount-language-server-linux-x64.zip"),
when(platform.is_win and platform.arch == "x64", "beancount-language-server-windows-x64.zip")
- )
- ),
- context.capture(function(ctx)
- return installers.pipe {
- std.unzip_remote(ctx.github_release_file),
- -- We rename the binary to conform with lspconfig
- std.rename(
- ("beancount-language-server%s"):format(file_ext),
- ("beancount-langserver%s"):format(file_ext)
- ),
- }
- end),
- context.promote_install_dir(),
- installers.branch_context {
- context.set(function(ctx)
- ctx.requested_server_version = nil
- end),
- pip3.packages { "beancount" },
- },
- context.receipt(function(receipt, ctx)
- receipt
- :with_primary_source(receipt.github_release_file(ctx))
- :with_secondary_source(receipt.pip3 "beancount")
- end),
- },
+ ),
+ "Unsupported platform"
+ )
+ github.unzip_release_file({
+ repo = "polarmutex/beancount-language-server",
+ asset_file = asset_file,
+ }).with_receipt()
+
+ local file_ext = platform.is_win and ".exe" or ""
+ -- We rename the binary to conform with lspconfig
+ ctx.fs:rename(("beancount-language-server%s"):format(file_ext), ("beancount-langserver%s"):format(file_ext))
+
+ pip3.install { "beancount" }
+ ctx.receipt:with_secondary_source(ctx.receipt.pip3 "beancount")
+ end,
default_options = {
cmd_env = {
- PATH = process.extend_path { root_dir, pip3.path(root_dir) },
+ PATH = process.extend_path { root_dir, pip3.venv_path(root_dir) },
},
},
}
diff --git a/lua/nvim-lsp-installer/servers/bicep/init.lua b/lua/nvim-lsp-installer/servers/bicep/init.lua
index 89770999..6f5f7064 100644
--- a/lua/nvim-lsp-installer/servers/bicep/init.lua
+++ b/lua/nvim-lsp-installer/servers/bicep/init.lua
@@ -1,7 +1,7 @@
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 std = require "nvim-lsp-installer.core.managers.std"
+local github = require "nvim-lsp-installer.core.managers.github"
return function(name, root_dir)
return server.Server:new {
@@ -9,23 +9,23 @@ return function(name, root_dir)
root_dir = root_dir,
languages = { "bicep" },
homepage = "https://github.com/Azure/bicep",
- installer = {
- std.ensure_executables {
- { "dotnet", "dotnet is required to run the bicep language server." },
- },
- -- The bicep-langserver.zip is a bit broken on POSIX systems - so we download it via the VSCode distribution
- -- instead. See https://github.com/Azure/bicep/issues/3704.
- context.use_github_release_file("Azure/bicep", "vscode-bicep.vsix"),
- context.capture(function(ctx)
- return std.unzip_remote(ctx.github_release_file, "vscode")
- end),
- std.rename(path.concat { "vscode", "extension", "bicepLanguageServer" }, "langserver"),
- std.rmrf "vscode",
- context.set_working_dir "langserver",
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ std.ensure_executable("dotnet", { help_url = "https://dotnet.microsoft.com/download" })
+ ctx.fs:mkdir "vscode"
+ ctx:chdir("vscode", function()
+ -- The bicep-langserver.zip is a bit broken on POSIX systems - so we download it via the VSCode distribution
+ -- instead. See https://github.com/Azure/bicep/issues/3704.
+ github.unzip_release_file({
+ repo = "Azure/bicep",
+ asset_file = "vscode-bicep.vsix",
+ }).with_receipt()
+ end)
+ ctx.fs:rename(path.concat { "vscode", "extension", "bicepLanguageServer" }, "langserver")
+ ctx.fs:rmrf "vscode"
+ ctx:chdir "langserver"
+ end,
default_options = {
cmd = { "dotnet", path.concat { root_dir, "Bicep.LangServer.dll" } },
},
diff --git a/lua/nvim-lsp-installer/servers/bsl_ls/init.lua b/lua/nvim-lsp-installer/servers/bsl_ls/init.lua
index 9036ea7d..62c85079 100644
--- a/lua/nvim-lsp-installer/servers/bsl_ls/init.lua
+++ b/lua/nvim-lsp-installer/servers/bsl_ls/init.lua
@@ -1,7 +1,7 @@
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 github = require "nvim-lsp-installer.core.managers.github"
+local std = require "nvim-lsp-installer.core.managers.std"
return function(name, root_dir)
return server.Server:new {
@@ -9,21 +9,19 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://1c-syntax.github.io/bsl-language-server",
languages = { "onescript" },
- installer = {
- std.ensure_executables {
- { "java", "java was not found in path." },
- },
- context.use_github_release_file("1c-syntax/bsl-language-server", function(tag)
- local version = tag:gsub("^v", "")
- return ("bsl-language-server-%s-exec.jar"):format(version)
- end),
- context.capture(function(ctx)
- return std.download_file(ctx.github_release_file, "bsl-lsp.jar")
- end),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ async = true,
+ installer = function()
+ std.ensure_executable "java"
+ local source = github.release_file {
+ repo = "1c-syntax/bsl-language-server",
+ asset_file = function(release)
+ local version = release:gsub("^v", "")
+ return ("bsl-language-server-%s-exec.jar"):format(version)
+ end,
+ }
+ source.with_receipt()
+ std.download_file(source.download_url, "bsl-lsp.jar")
+ end,
default_options = {
cmd = {
"java",
diff --git a/lua/nvim-lsp-installer/servers/ccls/common.lua b/lua/nvim-lsp-installer/servers/ccls/common.lua
new file mode 100644
index 00000000..2d212a06
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/ccls/common.lua
@@ -0,0 +1,41 @@
+local path = require "nvim-lsp-installer.path"
+local platform = require "nvim-lsp-installer.platform"
+local installer = require "nvim-lsp-installer.core.installer"
+local git = require "nvim-lsp-installer.core.managers.git"
+local Optional = require "nvim-lsp-installer.core.optional"
+
+---@async
+---@param opts {llvm_dir: string}
+return function(opts)
+ local ctx = installer.context()
+ local clang_resource_dir = path.concat { ctx.destination_dir, "clang-resource" }
+ local install_prefix = ctx.cwd:get()
+
+ ctx.fs:mkdir "ccls-git"
+ ctx:chdir("ccls-git", function()
+ git.clone { "https://github.com/MaskRay/ccls", recursive = true }
+ ctx.spawn.cmake {
+ "-DCMAKE_BUILD_TYPE=Release",
+ "-DUSE_SYSTEM_RAPIDJSON=OFF",
+ "-DCMAKE_FIND_FRAMEWORK=LAST",
+ "-Wno-dev",
+ ("-DCMAKE_INSTALL_PREFIX=%s"):format(install_prefix),
+ Optional.of_nilable(opts.llvm_dir)
+ :map(function(llvm_dir)
+ return {
+ ("-DCMAKE_PREFIX_PATH=%s"):format(llvm_dir),
+ -- On Mac we use Homebrew LLVM which will persist after installation.
+ -- On Linux, and when a custom llvm_dir is provided, its clang resource dir will be the only
+ -- artifact persisted after installation, as the locally installed llvm installation will be
+ -- cleaned up after compilation.
+ not platform.is_mac and ("-DCLANG_RESOURCE_DIR=%s"):format(clang_resource_dir) or vim.NIL,
+ }
+ end)
+ :or_else(vim.NIL),
+ platform.is_mac and "-DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" or vim.NIL,
+ }
+
+ ctx.spawn.make { "install" }
+ end)
+ ctx.fs:rmrf "ccls-git"
+end
diff --git a/lua/nvim-lsp-installer/servers/ccls/init.lua b/lua/nvim-lsp-installer/servers/ccls/init.lua
index 5482af87..9fec618c 100644
--- a/lua/nvim-lsp-installer/servers/ccls/init.lua
+++ b/lua/nvim-lsp-installer/servers/ccls/init.lua
@@ -1,193 +1,21 @@
--- __________________
--- < Here be dragons! >
--- ------------------
--- \ ^ /^
--- \ / \ // \
--- \ |\___/| / \// .\
--- \ /O O \__ / // | \ \ *----*
--- / / \/_/ // | \ \ \ |
--- @___@` \/_ // | \ \ \/\ \
--- 0/0/| \/_ // | \ \ \ \
--- 0/0/0/0/| \/// | \ \ | |
--- 0/0/0/0/0/_|_ / ( // | \ _\ | /
--- 0/0/0/0/0/0/`/,_ _ _/ ) ; -. | _ _\.-~ / /
--- ,-} _ *-.|.-~-. .~ ~
--- \ \__/ `/\ / ~-. _ .-~ /
--- \____(@@) *. } { /
--- ( (--) .----~-.\ \-` .~
--- //__\\ \__ Ack! ///.----..< \ _ -~
--- // \\ ///-._ _ _ _ _ _ _{^ - - - - ~
---
-
local server = require "nvim-lsp-installer.server"
local path = require "nvim-lsp-installer.path"
-local installers = require "nvim-lsp-installer.installers"
-local Data = require "nvim-lsp-installer.data"
-local std = require "nvim-lsp-installer.installers.std"
local platform = require "nvim-lsp-installer.platform"
-local context = require "nvim-lsp-installer.installers.context"
local process = require "nvim-lsp-installer.process"
-local fs = require "nvim-lsp-installer.fs"
-
-local coalesce, when, list_not_nil = Data.coalesce, Data.when, Data.list_not_nil
return function(name, root_dir)
- local llvm_installer
-
- do
- ---@param version string
- ---@param os_distribution table<string, string>|nil
- ---@return string|nil
- local function get_archive_name(version, os_distribution)
- local name_template = coalesce(
- when(
- platform.is_linux,
- coalesce(
- when(
- platform.arch == "x64",
- coalesce(
- when(
- os_distribution.id == "ubuntu" and os_distribution.version.major >= 20,
- "clang+llvm-%s-x86_64-linux-gnu-ubuntu-20.04"
- ),
- when(
- os_distribution.id == "ubuntu" and os_distribution.version.major >= 16,
- "clang+llvm-%s-x86_64-linux-gnu-ubuntu-16.04"
- )
- )
- ),
- when(platform.arch == "arm64", "clang+llvm-%s-aarch64-linux-gnu"),
- when(platform.arch == "armv7", "clang+llvm-%s-armv7a-linux-gnueabihf")
- )
- )
- )
- return name_template and name_template:format(version)
- end
-
- ---@param version string
- local function normalize_version(version)
- local s = version:gsub("^llvmorg%-", "")
- return s
- end
-
- llvm_installer = installers.branch_context {
- context.use_os_distribution(),
- context.set(function(ctx)
- -- We unset the requested version for llvm because it's not the primary target - the user's requested version should only apply to ccls.
- ctx.requested_server_version = nil
- end),
- installers.first_successful {
- installers.pipe {
- context.capture(function(ctx)
- return context.use_github_release_file("llvm/llvm-project", function(version)
- -- Strip the "llvmorg-" prefix from tags (llvm releases tags like llvmorg-13.0.0)
- local archive_name = get_archive_name(normalize_version(version), ctx.os_distribution)
- return archive_name and ("%s.tar.xz"):format(archive_name)
- end)
- end),
- context.capture(function(ctx)
- return installers.pipe {
- std.untarxz_remote(ctx.github_release_file),
- std.rename(
- get_archive_name(normalize_version(ctx.requested_server_version), ctx.os_distribution),
- "llvm"
- ),
- -- We move the clang headers out, because they need to be persisted
- std.rename(
- path.concat { "llvm", "lib", "clang", normalize_version(ctx.requested_server_version) },
- "clang-resource"
- ),
- }
- end),
- },
- -- If the previous step fails, default to building using system clang+llvm.
- context.set(function(ctx)
- ctx.stdio_sink.stdout "\nUsing system clang+LLVM! Build will fail if clang/LLVM is not installed on the system.\n"
- ctx.use_system_llvm = true
- end),
- },
- }
- end
-
- local ccls_installer = installers.pipe {
- std.git_clone("https://github.com/MaskRay/ccls", {
- directory = "ccls-git",
- recursive = true,
- }),
- function(srv, callback, ctx)
- local c = process.chain {
- cwd = path.concat { ctx.install_dir, "ccls-git" },
- stdio_sink = ctx.stdio_sink,
- }
-
- local clang_resource_dir = path.concat { srv.root_dir, "clang-resource" }
-
- c.run(
- "cmake",
- list_not_nil(
- "-DCMAKE_BUILD_TYPE=Release",
- "-DUSE_SYSTEM_RAPIDJSON=OFF",
- "-DCMAKE_FIND_FRAMEWORK=LAST",
- "-Wno-dev",
- ("-DCMAKE_INSTALL_PREFIX=%s"):format(ctx.install_dir),
- when(not ctx.use_system_llvm, ("-DCMAKE_PREFIX_PATH=%s"):format(ctx.llvm_dir)),
- when(
- not platform.is_mac and not ctx.use_system_llvm,
- ("-DCLANG_RESOURCE_DIR=%s"):format(clang_resource_dir)
- ),
- when(platform.is_mac, "-DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk")
- )
- )
- c.run("make", { "install" })
- c.spawn(callback)
- end,
- std.rmrf "ccls-git",
- }
-
- local linux_ccls_installer = installers.pipe {
- llvm_installer,
- context.set(function(ctx)
- ctx.llvm_dir = path.concat { ctx.install_dir, "llvm" }
- end),
- ccls_installer,
- installers.always_succeed(std.rmrf "llvm"),
- }
-
- local mac_ccls_installer = installers.pipe {
- context.use_homebrew_prefix(),
- context.set(function(ctx)
- ctx.llvm_dir = path.concat { ctx.homebrew_prefix, "opt", "llvm", "lib", "cmake" }
- end),
- function(_, callback, ctx)
- if not fs.dir_exists(ctx.llvm_dir) then
- ctx.stdio_sink.stderr(
- (
- "LLVM does not seem to be installed on this system (looked in %q). Please install LLVM via Homebrew:\n $ brew install llvm\n"
- ):format(ctx.llvm_dir)
- )
- callback(false)
- return
- end
- callback(true)
- end,
- ccls_installer,
- }
-
return server.Server:new {
name = name,
root_dir = root_dir,
homepage = "https://github.com/MaskRay/ccls",
languages = { "c", "c++", "objective-c" },
- installer = {
- installers.when {
- mac = mac_ccls_installer,
- linux = linux_ccls_installer,
- },
- context.receipt(function(receipt)
- -- The cloned ccls git repo gets deleted during installation, so we have no local copy.
- receipt:mark_invalid()
- end),
- },
+ async = true,
+ installer = function()
+ platform.when {
+ mac = require "nvim-lsp-installer.servers.ccls.mac",
+ linux = require "nvim-lsp-installer.servers.ccls.linux",
+ }
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { path.concat { root_dir, "bin" } },
diff --git a/lua/nvim-lsp-installer/servers/ccls/linux.lua b/lua/nvim-lsp-installer/servers/ccls/linux.lua
new file mode 100644
index 00000000..db4e8a3b
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/ccls/linux.lua
@@ -0,0 +1,75 @@
+local path = require "nvim-lsp-installer.path"
+local platform = require "nvim-lsp-installer.platform"
+local installer = require "nvim-lsp-installer.core.installer"
+local github = require "nvim-lsp-installer.core.managers.github"
+local Data = require "nvim-lsp-installer.data"
+local Result = require "nvim-lsp-installer.core.result"
+local Optional = require "nvim-lsp-installer.core.optional"
+
+local ccls_installer = require "nvim-lsp-installer.servers.ccls.common"
+
+local coalesce, when = Data.coalesce, Data.when
+
+---@param release string
+local function normalize_llvm_release(release)
+ -- Strip the "llvmorg-" prefix from tags (llvm releases tags like llvmorg-13.0.0)
+ local normalized_release = release:gsub("^llvmorg%-", "")
+ return normalized_release
+end
+
+---@async
+local function llvm_installer()
+ local ctx = installer.context()
+ local os_dist = platform.os_distribution()
+
+ local asset_name = coalesce(
+ when(
+ platform.is_linux,
+ coalesce(
+ when(
+ platform.arch == "x64",
+ coalesce(
+ when(
+ os_dist.id == "ubuntu" and os_dist.version.major >= 20,
+ "clang+llvm-%s-x86_64-linux-gnu-ubuntu-20.04"
+ ),
+ when(
+ os_dist.id == "ubuntu" and os_dist.version.major >= 16,
+ "clang+llvm-%s-x86_64-linux-gnu-ubuntu-16.04"
+ )
+ )
+ ),
+ when(platform.arch == "arm64", "clang+llvm-%s-aarch64-linux-gnu"),
+ when(platform.arch == "armv7", "clang+llvm-%s-armv7a-linux-gnueabihf")
+ )
+ )
+ )
+
+ local source = github.untarxz_release_file {
+ repo = "llvm/llvm-project",
+ version = Optional.of "llvmorg-13.0.0",
+ asset_file = function(release)
+ local normalized_release = normalize_llvm_release(release)
+ return asset_name and ("%s.tar.xz"):format(asset_name):format(normalized_release)
+ end,
+ }
+
+ ctx.fs:rename(asset_name:format(normalize_llvm_release(source.release)), "llvm")
+ -- We move the clang headers out, because they need to be persisted
+ ctx.fs:rename(path.concat { "llvm", "lib", "clang", normalize_llvm_release(source.release) }, "clang-resource")
+
+ return path.concat { ctx.cwd:get(), "llvm" }
+end
+
+---@async
+return function()
+ local ctx = installer.context()
+ Result.run_catching(llvm_installer)
+ :map(function(llvm_dir)
+ ccls_installer { llvm_dir = llvm_dir }
+ end)
+ :recover(function()
+ ccls_installer {}
+ end)
+ ctx.fs:rmrf "llvm"
+end
diff --git a/lua/nvim-lsp-installer/servers/ccls/mac.lua b/lua/nvim-lsp-installer/servers/ccls/mac.lua
new file mode 100644
index 00000000..dc53bde5
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/ccls/mac.lua
@@ -0,0 +1,22 @@
+local path = require "nvim-lsp-installer.path"
+local platform = require "nvim-lsp-installer.platform"
+local installer = require "nvim-lsp-installer.core.installer"
+local fs = require "nvim-lsp-installer.core.fs"
+
+local ccls_installer = require "nvim-lsp-installer.servers.ccls.common"
+
+---@async
+return function()
+ local ctx = installer.context()
+ local homebrew_prefix = platform.get_homebrew_prefix():get_or_throw()
+ local llvm_dir = path.concat { homebrew_prefix, "opt", "llvm", "lib", "cmake" }
+ if not fs.dir_exists(llvm_dir) then
+ ctx.stdio_sink.stderr(
+ (
+ "LLVM does not seem to be installed on this system (looked in %q). Please install LLVM via Homebrew:\n $ brew install llvm\n"
+ ):format(llvm_dir)
+ )
+ error "Unable to find LLVM."
+ end
+ ccls_installer { llvm_dir = llvm_dir }
+end
diff --git a/lua/nvim-lsp-installer/servers/clangd/init.lua b/lua/nvim-lsp-installer/servers/clangd/init.lua
index e4e819b8..c4025fd5 100644
--- a/lua/nvim-lsp-installer/servers/clangd/init.lua
+++ b/lua/nvim-lsp-installer/servers/clangd/init.lua
@@ -2,9 +2,10 @@ local server = require "nvim-lsp-installer.server"
local path = require "nvim-lsp-installer.path"
local process = require "nvim-lsp-installer.process"
local Data = require "nvim-lsp-installer.data"
-local std = require "nvim-lsp-installer.installers.std"
local platform = require "nvim-lsp-installer.platform"
-local context = require "nvim-lsp-installer.installers.context"
+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 {
@@ -12,25 +13,23 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://clangd.llvm.org",
languages = { "c", "c++" },
- installer = {
- context.use_github_release_file("clangd/clangd", function(version)
- local target_file = Data.coalesce(
- Data.when(platform.is_mac, "clangd-mac-%s.zip"),
- Data.when(platform.is_linux and platform.arch == "x64", "clangd-linux-%s.zip"),
- Data.when(platform.is_win, "clangd-windows-%s.zip")
- )
- return target_file and target_file:format(version)
- end),
- context.capture(function(ctx)
- return std.unzip_remote(ctx.github_release_file)
- end),
- context.capture(function(ctx)
- return std.rename(("clangd_%s"):format(ctx.requested_server_version), "clangd")
- end),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ local source = github.unzip_release_file {
+ repo = "clangd/clangd",
+ asset_file = function(release)
+ local target = coalesce(
+ when(platform.is_mac, "clangd-mac-%s.zip"),
+ when(platform.is_linux and platform.arch == "x64", "clangd-linux-%s.zip"),
+ when(platform.is_win, "clangd-windows-%s.zip")
+ )
+ return target and target:format(release)
+ end,
+ }
+ source.with_receipt()
+ ctx.fs:rename(("clangd_%s"):format(source.release), "clangd")
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { path.concat { root_dir, "clangd", "bin" } },
diff --git a/lua/nvim-lsp-installer/servers/clarity_lsp/init.lua b/lua/nvim-lsp-installer/servers/clarity_lsp/init.lua
index 9c470790..ae5bea52 100644
--- a/lua/nvim-lsp-installer/servers/clarity_lsp/init.lua
+++ b/lua/nvim-lsp-installer/servers/clarity_lsp/init.lua
@@ -1,8 +1,7 @@
local server = require "nvim-lsp-installer.server"
local process = require "nvim-lsp-installer.process"
local platform = require "nvim-lsp-installer.platform"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
+local github = require "nvim-lsp-installer.core.managers.github"
local Data = require "nvim-lsp-installer.data"
local coalesce, when = Data.coalesce, Data.when
@@ -13,22 +12,17 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://github.com/hirosystems/clarity-lsp",
languages = { "clarity" },
- installer = {
- context.use_github_release_file(
- "hirosystems/clarity-lsp",
- coalesce(
+ async = true,
+ installer = function()
+ github.unzip_release_file({
+ repo = "hirosystems/clarity-lsp",
+ asset_file = coalesce(
when(platform.is_mac, "clarity-lsp-macos-x64.zip"),
when(platform.is_linux and platform.arch == "x64", "clarity-lsp-linux-x64.zip"),
when(platform.is_win and platform.arch == "x64", "clarity-lsp-windows-x64.zip")
- )
- ),
- 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),
- },
+ ),
+ }).with_receipt()
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir },
diff --git a/lua/nvim-lsp-installer/servers/clojure_lsp/init.lua b/lua/nvim-lsp-installer/servers/clojure_lsp/init.lua
index 5e13fa00..a160a9a6 100644
--- a/lua/nvim-lsp-installer/servers/clojure_lsp/init.lua
+++ b/lua/nvim-lsp-installer/servers/clojure_lsp/init.lua
@@ -1,9 +1,11 @@
local server = require "nvim-lsp-installer.server"
local process = require "nvim-lsp-installer.process"
-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 github = require "nvim-lsp-installer.core.managers.github"
+local std = require "nvim-lsp-installer.core.managers.std"
+
+local coalesce, when = Data.coalesce, Data.when
return function(name, root_dir)
return server.Server:new {
@@ -11,23 +13,18 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://clojure-lsp.io",
languages = { "clojure" },
- installer = {
- context.use_github_release_file(
- "clojure-lsp/clojure-lsp",
- Data.coalesce(
- Data.when(platform.is_mac, "clojure-lsp-native-macos-amd64.zip"),
- Data.when(platform.is_linux, "clojure-lsp-native-linux-amd64.zip"),
- Data.when(platform.is_win, "clojure-lsp-native-windows-amd64.zip")
- )
- ),
- context.capture(function(ctx)
- return std.unzip_remote(ctx.github_release_file)
- end),
- std.chmod("+x", { "clojure-lsp" }),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ async = true,
+ installer = function()
+ github.unzip_release_file({
+ repo = "clojure-lsp/clojure-lsp",
+ asset_file = coalesce(
+ when(platform.is_mac, "clojure-lsp-native-macos-amd64.zip"),
+ when(platform.is_linux, "clojure-lsp-native-linux-amd64.zip"),
+ when(platform.is_win, "clojure-lsp-native-windows-amd64.zip")
+ ),
+ }).with_receipt()
+ std.chmod("+x", { "clojure-lsp" })
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir },
diff --git a/lua/nvim-lsp-installer/servers/codeqlls/init.lua b/lua/nvim-lsp-installer/servers/codeqlls/init.lua
index 9bb82d98..87106e1e 100644
--- a/lua/nvim-lsp-installer/servers/codeqlls/init.lua
+++ b/lua/nvim-lsp-installer/servers/codeqlls/init.lua
@@ -1,8 +1,7 @@
local server = require "nvim-lsp-installer.server"
-local std = require "nvim-lsp-installer.installers.std"
local Data = require "nvim-lsp-installer.data"
local platform = require "nvim-lsp-installer.platform"
-local context = require "nvim-lsp-installer.installers.context"
+local github = require "nvim-lsp-installer.core.managers.github"
local process = require "nvim-lsp-installer.process"
local path = require "nvim-lsp-installer.path"
@@ -13,22 +12,17 @@ return function(name, root_dir)
name = name,
root_dir = root_dir,
languages = { "codeql" },
- installer = {
- context.use_github_release_file(
- "github/codeql-cli-binaries",
- coalesce(
+ async = true,
+ installer = function()
+ github.unzip_release_file({
+ repo = "github/codeql-cli-binaries",
+ asset_file = coalesce(
when(platform.is_mac, "codeql-osx64.zip"),
when(platform.is_unix, "codeql-linux64.zip"),
when(platform.is_win, "codeql-win64.zip")
- )
- ),
- 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),
- },
+ ),
+ }).with_receipt()
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { path.concat { root_dir, "codeql" } },
diff --git a/lua/nvim-lsp-installer/servers/crystalline/init.lua b/lua/nvim-lsp-installer/servers/crystalline/init.lua
index 01c8ac24..67d61a9e 100644
--- a/lua/nvim-lsp-installer/servers/crystalline/init.lua
+++ b/lua/nvim-lsp-installer/servers/crystalline/init.lua
@@ -1,11 +1,10 @@
local server = require "nvim-lsp-installer.server"
local process = require "nvim-lsp-installer.process"
local platform = require "nvim-lsp-installer.platform"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
-local installers = require "nvim-lsp-installer.installers"
local Data = require "nvim-lsp-installer.data"
local path = require "nvim-lsp-installer.path"
+local github = require "nvim-lsp-installer.core.managers.github"
+local std = require "nvim-lsp-installer.core.managers.std"
local coalesce, when = Data.coalesce, Data.when
@@ -15,48 +14,18 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://github.com/elbywan/crystalline",
languages = { "crystal" },
- installer = {
- -- Crystalline (LSP)
- installers.branch_context {
- context.use_github_release_file(
- "elbywan/crystalline",
- coalesce(
- when(platform.is_mac and platform.arch == "x64", "crystalline_x86_64-apple-darwin.gz"),
- when(platform.is_linux and platform.arch == "x64", "crystalline_x86_64-unknown-linux-gnu.gz")
- )
+ async = true,
+ installer = function()
+ github.gunzip_release_file({
+ repo = "elbywan/crystalline",
+ asset_file = coalesce(
+ when(platform.is_mac and platform.arch == "x64", "crystalline_x86_64-apple-darwin.gz"),
+ when(platform.is_linux and platform.arch == "x64", "crystalline_x86_64-unknown-linux-gnu.gz")
),
- context.capture(function(ctx)
- return std.gunzip_remote(
- ctx.github_release_file,
- platform.is_win and "crystalline.exe" or "crystalline"
- )
- end),
- std.chmod("+x", { "crystalline" }),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
- -- Crystal
- installers.branch_context {
- context.use_github_release_file("crystal-lang/crystal", function(version)
- local target_file = coalesce(
- when(platform.is_mac, "crystal-%s-1-darwin-universal.tar.gz"),
- when(platform.is_linux and platform.arch == "x64", "crystal-%s-1-linux-x86_64-bundled.tar.gz")
- )
- return target_file and target_file:format(version)
- end),
- context.capture(function(ctx)
- return installers.pipe {
- std.untargz_remote(ctx.github_release_file),
- std.rename(("crystal-%s-1"):format(ctx.requested_server_version), "crystal"),
- }
- end),
- std.chmod("+x", { "crystalline" }),
- context.receipt(function(receipt, ctx)
- receipt:with_secondary_source(receipt.github_release_file(ctx))
- end),
- },
- },
+ out_file = "crystalline",
+ }).with_receipt()
+ std.chmod("+x", { "crystalline" })
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir, path.concat { root_dir, "crystal", "bin" } },
diff --git a/lua/nvim-lsp-installer/servers/denols/init.lua b/lua/nvim-lsp-installer/servers/denols/init.lua
index dfd0ab2a..37ae7e6d 100644
--- a/lua/nvim-lsp-installer/servers/denols/init.lua
+++ b/lua/nvim-lsp-installer/servers/denols/init.lua
@@ -2,8 +2,7 @@ local server = require "nvim-lsp-installer.server"
local process = require "nvim-lsp-installer.process"
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 github = require "nvim-lsp-installer.core.managers.github"
local coalesce, when = Data.coalesce, Data.when
@@ -13,10 +12,11 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://deno.land/x/deno/cli/lsp",
languages = { "deno" },
- installer = {
- context.use_github_release_file(
- "denoland/deno",
- coalesce(
+ async = true,
+ installer = function()
+ github.unzip_release_file({
+ repo = "denoland/deno",
+ asset_file = coalesce(
when(
platform.is_mac,
coalesce(
@@ -26,15 +26,9 @@ return function(name, root_dir)
),
when(platform.is_linux, "deno-x86_64-unknown-linux-gnu.zip"),
when(platform.is_win, "deno-x86_64-pc-windows-msvc.zip")
- )
- ),
- 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),
- },
+ ),
+ }).with_receipt()
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir },
diff --git a/lua/nvim-lsp-installer/servers/dhall_lsp_server/init.lua b/lua/nvim-lsp-installer/servers/dhall_lsp_server/init.lua
index 407f9d5a..27604f0c 100644
--- a/lua/nvim-lsp-installer/servers/dhall_lsp_server/init.lua
+++ b/lua/nvim-lsp-installer/servers/dhall_lsp_server/init.lua
@@ -2,17 +2,12 @@ local server = require "nvim-lsp-installer.server"
local path = require "nvim-lsp-installer.path"
local process = require "nvim-lsp-installer.process"
local platform = require "nvim-lsp-installer.platform"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
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 Optional = require "nvim-lsp-installer.core.optional"
-local coalesce, when = Data.coalesce, Data.when
-
-local target = coalesce(
- when(platform.is_mac, "dhall-lsp-server-1.0.18-x86_64-macos.tar.bz2"),
- when(platform.is_linux, "dhall-lsp-server-1.0.18-x86_64-linux.tar.bz2"),
- when(platform.is_win, "dhall-lsp-server-1.0.18-x86_64-windows.zip")
-)
+local coalesce, when, list_find_first = Data.coalesce, Data.when, Data.list_find_first
return function(name, root_dir)
return server.Server:new {
@@ -20,26 +15,56 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://dhall-lang.org/",
languages = { "dhall" },
- installer = {
- context.set(function(ctx)
- ctx.requested_server_version = Data.coalesce(
- ctx.requested_server_version,
- "1.41.1" -- https://github.com/williamboman/nvim-lsp-installer/pull/512#discussion_r817062340
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ local repo = "dhall-lang/dhall-haskell"
+ ---@type GitHubRelease
+ local gh_release = ctx.requested_version
+ :map(function(version)
+ return github_client.fetch_release(repo, version)
+ end)
+ :or_else_get(function()
+ return github_client.fetch_latest_release(repo)
+ end)
+ :get_or_throw()
+
+ local asset_name_pattern = assert(
+ coalesce(
+ when(platform.is_mac, "dhall%-lsp%-server%-.+%-x86_64%-macos.tar.bz2"),
+ when(platform.is_linux, "dhall%-lsp%-server%-.+%-x86_64%-linux.tar.bz2"),
+ when(platform.is_win, "dhall%-lsp%-server%-.+%-x86_64%-windows.zip")
)
- end),
- context.use_github_release_file("dhall-lang/dhall-haskell", target),
- context.capture(function(ctx)
- if platform.is_win then
- return std.unzip_remote(ctx.github_release_file)
- else
- return std.untargz_remote(ctx.github_release_file)
+ )
+ local dhall_lsp_server_asset = list_find_first(
+ gh_release.assets,
+ ---@param asset GitHubReleaseAsset
+ function(asset)
+ return asset.name:match(asset_name_pattern)
end
- end),
- std.chmod("+x", { path.concat { "bin", "dhall-lsp-server" } }),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ )
+ Optional.of_nilable(dhall_lsp_server_asset)
+ :if_present(
+ ---@param asset GitHubReleaseAsset
+ function(asset)
+ if platform.is_win then
+ std.download_file(asset.browser_download_url, "dhall-lsp-server.zip")
+ std.unzip("dhall-lsp-server.zip", ".")
+ else
+ std.download_file(asset.browser_download_url, "dhall-lsp-server.tar.bz2")
+ std.untar "dhall-lsp-server.tar.bz2"
+ std.chmod("+x", { path.concat { "bin", "dhall-lsp-server" } })
+ end
+ ctx.receipt:with_primary_source {
+ type = "github_release_file",
+ repo = repo,
+ file = asset.browser_download_url,
+ release = gh_release.tag_name,
+ }
+ end
+ )
+ :or_else_throw "Unable to find the dhall-lsp-server release asset in the GitHub release."
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { path.concat { root_dir, "bin" } },
diff --git a/lua/nvim-lsp-installer/servers/elixirls/init.lua b/lua/nvim-lsp-installer/servers/elixirls/init.lua
index 7a8f8bea..006c0222 100644
--- a/lua/nvim-lsp-installer/servers/elixirls/init.lua
+++ b/lua/nvim-lsp-installer/servers/elixirls/init.lua
@@ -1,8 +1,8 @@
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 platform = require "nvim-lsp-installer.platform"
+local github = require "nvim-lsp-installer.core.managers.github"
+local std = require "nvim-lsp-installer.core.managers.std"
return function(name, root_dir)
return server.Server:new {
@@ -10,16 +10,19 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://github.com/elixir-lsp/elixir-ls",
languages = { "elixir" },
- installer = {
- context.use_github_release_file("elixir-lsp/elixir-ls", "elixir-ls.zip"),
- context.capture(function(ctx)
- return std.unzip_remote(ctx.github_release_file, "elixir-ls")
- end),
- std.chmod("+x", { "elixir-ls/language_server.sh" }),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ -- We write to the elixir-ls directory for backwards compatibility reasons
+ ctx.fs:mkdir "elixir-ls"
+ ctx:chdir("elixir-ls", function()
+ github.unzip_release_file({
+ repo = "elixir-lsp/elixir-ls",
+ asset_file = "elixir-ls.zip",
+ }).with_receipt()
+ std.chmod("+x", { "language_server.sh" })
+ end)
+ end,
default_options = {
cmd = {
path.concat {
diff --git a/lua/nvim-lsp-installer/servers/erlangls/init.lua b/lua/nvim-lsp-installer/servers/erlangls/init.lua
index 749a57b0..52b2e8ea 100644
--- a/lua/nvim-lsp-installer/servers/erlangls/init.lua
+++ b/lua/nvim-lsp-installer/servers/erlangls/init.lua
@@ -1,9 +1,11 @@
local server = require "nvim-lsp-installer.server"
local path = require "nvim-lsp-installer.path"
local process = require "nvim-lsp-installer.process"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
local platform = require "nvim-lsp-installer.platform"
+local std = require "nvim-lsp-installer.core.managers.std"
+local github_client = require "nvim-lsp-installer.core.managers.github.client"
+local git = require "nvim-lsp-installer.core.managers.git"
+local Optional = require "nvim-lsp-installer.core.optional"
return function(name, root_dir)
local rebar3 = platform.is_win and "rebar3.cmd" or "rebar3"
@@ -13,25 +15,24 @@ return function(name, root_dir)
root_dir = root_dir,
languages = { "erlang" },
homepage = "https://erlang-ls.github.io/",
- installer = {
- std.ensure_executables {
- { rebar3, ("%s was not found in path. Refer to http://rebar3.org/docs/."):format(rebar3) },
- },
- context.use_github_latest_tag "erlang-ls/erlang_ls",
- std.git_clone "https://github.com/erlang-ls/erlang_ls.git",
- function(_, callback, ctx)
- local c = process.chain {
- cwd = ctx.install_dir,
- stdio_sink = ctx.stdio_sink,
- }
- c.run(rebar3, { "escriptize" })
- c.run(rebar3, { "as", "dap", "escriptize" })
- c.spawn(callback)
- end,
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_tag(ctx))
- end),
- },
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ std.ensure_executable(rebar3, { help_url = "http://rebar3.org/docs/" })
+
+ local repo = "erlang-ls/erlang_ls"
+ ctx.requested_version = ctx.requested_version:or_(function()
+ return Optional.of(github_client.fetch_latest_tag(repo)
+ :map(function(tag)
+ return tag.name
+ end)
+ :get_or_throw "Failed to fetch latest tag.")
+ end)
+ git.clone({ ("https://github.com/%s.git"):format(repo) }).with_receipt()
+
+ ctx.spawn[rebar3] { "escriptize" }
+ ctx.spawn[rebar3] { "as", "dap", "escriptize" }
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { path.concat { root_dir, "_build", "default", "bin" } },
diff --git a/lua/nvim-lsp-installer/servers/groovyls/init.lua b/lua/nvim-lsp-installer/servers/groovyls/init.lua
index a40dc32e..8f7b4617 100644
--- a/lua/nvim-lsp-installer/servers/groovyls/init.lua
+++ b/lua/nvim-lsp-installer/servers/groovyls/init.lua
@@ -2,7 +2,6 @@ local server = require "nvim-lsp-installer.server"
local path = require "nvim-lsp-installer.path"
local std = require "nvim-lsp-installer.core.managers.std"
local git = require "nvim-lsp-installer.core.managers.git"
-local process = require "nvim-lsp-installer.process"
return function(name, root_dir)
return server.Server:new {
@@ -18,9 +17,7 @@ return function(name, root_dir)
ctx:promote_cwd()
ctx.spawn.gradlew {
"build",
- env = process.graft_env {
- PATH = process.extend_path { ctx.cwd:get() },
- },
+ with_paths = { ctx.cwd:get() },
}
end,
default_options = {
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 },
diff --git a/lua/nvim-lsp-installer/servers/jdtls/init.lua b/lua/nvim-lsp-installer/servers/jdtls/init.lua
index 1e466c85..c36a8f87 100644
--- a/lua/nvim-lsp-installer/servers/jdtls/init.lua
+++ b/lua/nvim-lsp-installer/servers/jdtls/init.lua
@@ -1,11 +1,10 @@
local server = require "nvim-lsp-installer.server"
-local a = require "nvim-lsp-installer.core.async"
local path = require "nvim-lsp-installer.path"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
local platform = require "nvim-lsp-installer.platform"
local Data = require "nvim-lsp-installer.data"
+local installer = require "nvim-lsp-installer.core.installer"
local eclipse = require "nvim-lsp-installer.core.clients.eclipse"
+local std = require "nvim-lsp-installer.core.managers.std"
return function(name, root_dir)
---@param workspace_root string
@@ -47,46 +46,39 @@ return function(name, root_dir)
}
end
+ local function download_jdtls()
+ local ctx = installer.context()
+ local version = ctx.requested_version:or_else_get(function()
+ return eclipse.fetch_latest_jdtls_version():get_or_throw()
+ end)
+
+ std.download_file(
+ ("https://download.eclipse.org/jdtls/snapshots/jdt-language-server-%s.tar.gz"):format(version),
+ "archive.tar.gz"
+ )
+ std.untar "archive.tar.gz"
+
+ ctx.receipt:with_primary_source {
+ type = "jdtls",
+ version = version,
+ }
+ end
+
+ local function download_lombok()
+ std.download_file("https://projectlombok.org/downloads/lombok.jar", "lombok.jar")
+ end
+
return server.Server:new {
name = name,
root_dir = root_dir,
languages = { "java" },
homepage = "https://github.com/eclipse/eclipse.jdt.ls",
- installer = {
- std.ensure_executables {
- { "java", "java was not found in path." },
- },
- ---@type ServerInstallerFunction
- function(_, callback, ctx)
- if ctx.requested_server_version then
- callback(true)
- return
- end
- a.run(eclipse.fetch_latest_jdtls_version, function(success, latest_version)
- if not success or latest_version:is_failure() then
- ctx.stdio_sink.stderr "Failed to fetch latest verison.\n"
- callback(false)
- else
- ctx.requested_server_version = latest_version:get_or_nil()
- callback(true)
- end
- end)
- end,
- context.capture(function(ctx)
- return std.untargz_remote(
- ("https://download.eclipse.org/jdtls/snapshots/jdt-language-server-%s.tar.gz"):format(
- ctx.requested_server_version
- )
- )
- end),
- std.download_file("https://projectlombok.org/downloads/lombok.jar", "lombok.jar"),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source {
- type = "jdtls",
- version = ctx.requested_server_version,
- }
- end),
- },
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ std.ensure_executable "java"
+ ctx:run_concurrently { download_jdtls, download_lombok }
+ end,
default_options = {
cmd = get_cmd(
vim.env.WORKSPACE and vim.env.WORKSPACE or path.concat { vim.env.HOME, "workspace" },
diff --git a/lua/nvim-lsp-installer/servers/julials/init.lua b/lua/nvim-lsp-installer/servers/julials/init.lua
index 690dd9d4..afbb16eb 100644
--- a/lua/nvim-lsp-installer/servers/julials/init.lua
+++ b/lua/nvim-lsp-installer/servers/julials/init.lua
@@ -1,7 +1,7 @@
local server = require "nvim-lsp-installer.server"
local path = require "nvim-lsp-installer.path"
-local context = require "nvim-lsp-installer.installers.context"
-local std = require "nvim-lsp-installer.installers.std"
+local std = require "nvim-lsp-installer.core.managers.std"
+local github = require "nvim-lsp-installer.core.managers.github"
return function(name, root_dir)
local server_script = [[
@@ -26,31 +26,34 @@ runserver(stdin,
root_dir = root_dir,
homepage = "https://github.com/julia-vscode/LanguageServer.jl",
languages = { "julia" },
- installer = {
- std.ensure_executables {
- { "julia", "julia was not found in path, refer to https://julialang.org/downloads/." },
- },
- context.use_github_release_file("julia-vscode/julia-vscode", function(version)
- local version_number = version:gsub("^v", "")
- return ("language-julia-%s.vsix"):format(version_number)
- end),
- context.capture(function(ctx)
- return std.unzip_remote(ctx.github_release_file, "vscode-package")
- end),
- std.rename(
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ std.ensure_executable("julia", { help_url = "https://julialang.org/downloads/" })
+
+ ctx.fs:mkdir "vscode-package"
+ ctx:chdir("vscode-package", function()
+ github.unzip_release_file({
+ repo = "julia-vscode/julia-vscode",
+ asset_file = function(version)
+ local version_number = version:gsub("^v", "")
+ return ("language-julia-%s.vsix"):format(version_number)
+ end,
+ }).with_receipt()
+ end)
+
+ ctx.fs:rename(
path.concat {
"vscode-package",
"extension",
"scripts",
},
"scripts"
- ),
- std.rmrf "vscode-package",
- std.write_file("nvim-lsp.jl", server_script),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ )
+ ctx.fs:rmrf "vscode-package"
+
+ ctx.fs:write_file("nvim-lsp.jl", server_script)
+ end,
default_options = {
cmd = {
"julia",
diff --git a/lua/nvim-lsp-installer/servers/kotlin_language_server/init.lua b/lua/nvim-lsp-installer/servers/kotlin_language_server/init.lua
index 4909b56d..a8330fca 100644
--- a/lua/nvim-lsp-installer/servers/kotlin_language_server/init.lua
+++ b/lua/nvim-lsp-installer/servers/kotlin_language_server/init.lua
@@ -1,8 +1,7 @@
local server = require "nvim-lsp-installer.server"
local process = require "nvim-lsp-installer.process"
local path = require "nvim-lsp-installer.path"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
+local github = require "nvim-lsp-installer.core.managers.github"
return function(name, root_dir)
return server.Server:new {
@@ -10,15 +9,13 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://github.com/fwcd/kotlin-language-server",
languages = { "kotlin" },
- installer = {
- context.use_github_release_file("fwcd/kotlin-language-server", "server.zip"),
- 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),
- },
+ async = true,
+ installer = function()
+ github.unzip_release_file({
+ repo = "fwcd/kotlin-language-server",
+ asset_file = "server.zip",
+ }).with_receipt()
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path {
diff --git a/lua/nvim-lsp-installer/servers/lemminx/init.lua b/lua/nvim-lsp-installer/servers/lemminx/init.lua
index b7eebd23..97de73f4 100644
--- a/lua/nvim-lsp-installer/servers/lemminx/init.lua
+++ b/lua/nvim-lsp-installer/servers/lemminx/init.lua
@@ -1,54 +1,43 @@
local server = require "nvim-lsp-installer.server"
-local std = require "nvim-lsp-installer.installers.std"
local Data = require "nvim-lsp-installer.data"
-local context = require "nvim-lsp-installer.installers.context"
local platform = require "nvim-lsp-installer.platform"
local process = require "nvim-lsp-installer.process"
+local std = require "nvim-lsp-installer.core.managers.std"
local coalesce, when = Data.coalesce, Data.when
return function(name, root_dir)
- local unzipped_file = coalesce(
- when(platform.is_mac, "lemminx-osx-x86_64"),
- when(platform.is_linux, "lemminx-linux"),
- when(platform.is_win, "lemminx-win32")
- )
-
return server.Server:new {
name = name,
root_dir = root_dir,
languages = { "xml" },
homepage = "https://github.com/eclipse/lemminx",
- installer = {
- function(_, callback, ctx)
- if not unzipped_file then
- ctx.stdio_sink.stderr(
- ("Your operating system or architecture (%q) is not yet supported."):format(platform.arch)
- )
- callback(false)
- else
- callback(true)
- end
- end,
- context.set(function(ctx)
- ctx.requested_server_version = coalesce(ctx.requested_server_version, "0.19.2-655")
- end),
- context.capture(function(ctx)
- return std.unzip_remote(
- ("https://download.jboss.org/jbosstools/vscode/snapshots/lemminx-binary/%s/%s.zip"):format(
- ctx.requested_server_version,
- unzipped_file
- )
- )
- end),
- std.rename(
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ local unzipped_file = assert(
+ coalesce(
+ when(platform.is_mac, "lemminx-osx-x86_64"),
+ when(platform.is_linux, "lemminx-linux"),
+ when(platform.is_win, "lemminx-win32")
+ ),
+ ("Your operating system or architecture (%q) is not yet supported."):format(platform.arch)
+ )
+
+ std.download_file(
+ ("https://download.jboss.org/jbosstools/vscode/snapshots/lemminx-binary/%s/%s.zip"):format(
+ ctx.requested_version:or_else "0.19.2-655", -- TODO: resolve latest version dynamically
+ unzipped_file
+ ),
+ "lemminx.zip"
+ )
+ std.unzip("lemminx.zip", ".")
+ ctx.fs:rename(
platform.is_win and ("%s.exe"):format(unzipped_file) or unzipped_file,
platform.is_win and "lemminx.exe" or "lemminx"
- ),
- context.receipt(function(receipt)
- receipt:with_primary_source(receipt.unmanaged)
- end),
- },
+ )
+ ctx.receipt:with_primary_source(ctx.receipt.unmanaged)
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir },
diff --git a/lua/nvim-lsp-installer/servers/ltex/init.lua b/lua/nvim-lsp-installer/servers/ltex/init.lua
index 5eb10dc0..a9c09b8d 100644
--- a/lua/nvim-lsp-installer/servers/ltex/init.lua
+++ b/lua/nvim-lsp-installer/servers/ltex/init.lua
@@ -1,10 +1,9 @@
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 process = require "nvim-lsp-installer.process"
+local github = require "nvim-lsp-installer.core.managers.github"
local coalesce, when = Data.coalesce, Data.when
@@ -14,28 +13,34 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://valentjn.github.io/vscode-ltex",
languages = { "latex" },
- installer = {
- context.use_github_release_file("valentjn/ltex-ls", function(version)
- return coalesce(
- when(platform.is_mac, "ltex-ls-%s-mac-x64.tar.gz"),
- when(platform.is_linux, "ltex-ls-%s-linux-x64.tar.gz"),
- when(platform.is_win, "ltex-ls-%s-windows-x64.zip")
- ):format(version)
- end),
- context.capture(function(ctx)
- if platform.is_win then
- return std.unzip_remote(ctx.github_release_file)
- else
- return std.untargz_remote(ctx.github_release_file)
- end
- end),
- context.capture(function(ctx)
- return std.rename(("ltex-ls-%s"):format(ctx.requested_server_version), "ltex-ls")
- end),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ if platform.is_win then
+ local release_source = github.unzip_release_file {
+ repo = "valentjn/ltex-ls",
+ asset_file = function(version)
+ return ("ltex-ls-%s-windows-x64.zip"):format(version)
+ end,
+ }
+ release_source.with_receipt()
+ ctx.fs:rename(("ltex-ls-%s"):format(release_source.release), "ltex-ls")
+ else
+ local release_source = github.untargz_release_file {
+ repo = "valentjn/ltex-ls",
+ asset_file = function(version)
+ local target = coalesce(
+ when(platform.is_mac, "ltex-ls-%s-mac-x64.tar.gz"),
+ when(platform.is_linux, "ltex-ls-%s-linux-x64.tar.gz"),
+ when(platform.is_win, "ltex-ls-%s-windows-x64.zip")
+ )
+ return target:format(version)
+ end,
+ }
+ release_source.with_receipt()
+ ctx.fs:rename(("ltex-ls-%s"):format(release_source.release), "ltex-ls")
+ end
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { path.concat { root_dir, "ltex-ls", "bin" } },
diff --git a/lua/nvim-lsp-installer/servers/mm0_ls/init.lua b/lua/nvim-lsp-installer/servers/mm0_ls/init.lua
index a50c7879..6050f3f3 100644
--- a/lua/nvim-lsp-installer/servers/mm0_ls/init.lua
+++ b/lua/nvim-lsp-installer/servers/mm0_ls/init.lua
@@ -13,8 +13,9 @@ return function(name, root_dir)
---@param ctx InstallContext
installer = function(ctx)
git.clone({ "https://github.com/digama0/mm0" }).with_receipt()
- ctx.spawn.cargo { "build", "--release", cwd = path.concat { ctx.cwd:get(), "mm0-rs" } }
- ctx.receipt:with_primary_source(ctx.receipt.git_remote "https://github.com/digama0/mm0")
+ ctx:chdir("mm0-rs", function()
+ ctx.spawn.cargo { "build", "--release" }
+ end)
end,
default_options = {
cmd_env = {
diff --git a/lua/nvim-lsp-installer/servers/omnisharp/init.lua b/lua/nvim-lsp-installer/servers/omnisharp/init.lua
index 19960003..f45df354 100644
--- a/lua/nvim-lsp-installer/servers/omnisharp/init.lua
+++ b/lua/nvim-lsp-installer/servers/omnisharp/init.lua
@@ -2,8 +2,8 @@ local server = require "nvim-lsp-installer.server"
local platform = require "nvim-lsp-installer.platform"
local path = require "nvim-lsp-installer.path"
local Data = require "nvim-lsp-installer.data"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
+local github = require "nvim-lsp-installer.core.managers.github"
+local std = require "nvim-lsp-installer.core.managers.std"
local coalesce, when = Data.coalesce, Data.when
@@ -13,46 +13,42 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://github.com/OmniSharp/omnisharp-roslyn",
languages = { "c#" },
- installer = {
- std.ensure_executables {
- {
- "dotnet",
- "dotnet was not found in path. Refer to https://dotnet.microsoft.com/download for installation instructions.",
- },
- },
- context.use_github_release_file(
- "OmniSharp/omnisharp-roslyn",
- coalesce(
- when(
- platform.is_mac,
- coalesce(
- when(platform.arch == "x64", "omnisharp-osx-x64-net6.0.zip"),
- when(platform.arch == "arm64", "omnisharp-osx-arm64-net6.0.zip")
- )
- ),
- when(
- platform.is_linux,
- coalesce(
- when(platform.arch == "x64", "omnisharp-linux-x64-net6.0.zip"),
- when(platform.arch == "arm64", "omnisharp-linux-arm64-net6.0.zip")
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ std.ensure_executable("dotnet", { help_url = "https://dotnet.microsoft.com/download" })
+
+ -- We write to the omnisharp directory for backwards compatibility reasons
+ ctx.fs:mkdir "omnisharp"
+ ctx:chdir("omnisharp", function()
+ github.unzip_release_file({
+ repo = "OmniSharp/omnisharp-roslyn",
+ asset_file = coalesce(
+ when(
+ platform.is_mac,
+ coalesce(
+ when(platform.arch == "x64", "omnisharp-osx-x64-net6.0.zip"),
+ when(platform.arch == "arm64", "omnisharp-osx-arm64-net6.0.zip")
+ )
+ ),
+ when(
+ platform.is_linux,
+ coalesce(
+ when(platform.arch == "x64", "omnisharp-linux-x64-net6.0.zip"),
+ when(platform.arch == "arm64", "omnisharp-linux-arm64-net6.0.zip")
+ )
+ ),
+ when(
+ platform.is_win,
+ coalesce(
+ when(platform.arch == "x64", "omnisharp-win-x64-net6.0.zip"),
+ when(platform.arch == "arm64", "omnisharp-win-arm64-net6.0.zip")
+ )
)
),
- when(
- platform.is_win,
- coalesce(
- when(platform.arch == "x64", "omnisharp-win-x64-net6.0.zip"),
- when(platform.arch == "arm64", "omnisharp-win-arm64-net6.0.zip")
- )
- )
- )
- ),
- context.capture(function(ctx)
- return std.unzip_remote(ctx.github_release_file, "omnisharp")
- end),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ }).with_receipt()
+ end)
+ end,
default_options = {
cmd = {
"dotnet",
diff --git a/lua/nvim-lsp-installer/servers/opencl_ls/init.lua b/lua/nvim-lsp-installer/servers/opencl_ls/init.lua
index 5586fe6d..50ed529d 100644
--- a/lua/nvim-lsp-installer/servers/opencl_ls/init.lua
+++ b/lua/nvim-lsp-installer/servers/opencl_ls/init.lua
@@ -1,9 +1,8 @@
local server = require "nvim-lsp-installer.server"
local process = require "nvim-lsp-installer.process"
local platform = require "nvim-lsp-installer.platform"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
local Data = require "nvim-lsp-installer.data"
+local github = require "nvim-lsp-installer.core.managers.github"
local coalesce, when = Data.coalesce, Data.when
@@ -13,27 +12,27 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://github.com/Galarius/opencl-language-server",
languages = { "opencl" },
- installer = {
- context.use_github_release_file(
- "Galarius/opencl-language-server",
- coalesce(
- when(platform.is_mac, "opencl-language-server-darwin-x86_64.tar.gz"),
- when(platform.is_linux and platform.arch == "x64", "opencl-language-server-linux-x86_64.tar.gz"),
- when(platform.is_win and platform.arch == "x64", "opencl-language-server-win32-x86_64.zip")
- )
- ),
- context.capture(coalesce(
- when(platform.is_unix, function(ctx)
- return std.untargz_remote(ctx.github_release_file)
- end),
- when(platform.is_win, 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),
- },
+ async = true,
+ installer = function()
+ platform.when {
+ unix = function()
+ local asset_file = coalesce(
+ when(platform.is_mac, "opencl-language-server-darwin-x86_64.tar.gz"),
+ when(platform.is_linux and platform.arch == "x64", "opencl-language-server-linux-x86_64.tar.gz")
+ )
+ github.untargz_release_file({
+ repo = "Galarius/opencl-language-server",
+ asset_file = asset_file,
+ }).with_receipt()
+ end,
+ win = function()
+ github.unzip_release_file({
+ repo = "Galarius/opencl-language-server",
+ asset_file = "opencl-language-server-win32-x86_64.zip",
+ }).with_receipt()
+ end,
+ }
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir },
diff --git a/lua/nvim-lsp-installer/servers/powershell_es/init.lua b/lua/nvim-lsp-installer/servers/powershell_es/init.lua
index 35facc2d..8e2edd4d 100644
--- a/lua/nvim-lsp-installer/servers/powershell_es/init.lua
+++ b/lua/nvim-lsp-installer/servers/powershell_es/init.lua
@@ -1,7 +1,7 @@
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 std = require "nvim-lsp-installer.core.managers.std"
+local github = require "nvim-lsp-installer.core.managers.github"
return function(name, root_dir)
return server.Server:new {
@@ -9,21 +9,14 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://github.com/PowerShell/PowerShellEditorServices",
languages = { "powershell" },
- installer = {
- std.ensure_executables {
- {
- "pwsh",
- "pwsh was not found in path. Refer to https://github.com/PowerShell/PowerShell#get-powershell for instructions.",
- },
- },
- context.use_github_release_file("PowerShell/PowerShellEditorServices", "PowerShellEditorServices.zip"),
- 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),
- },
+ async = true,
+ installer = function()
+ std.ensure_executable("pwsh", { help_url = "https://github.com/PowerShell/PowerShell#get-powershell" })
+ github.unzip_release_file({
+ repo = "PowerShell/PowerShellEditorServices",
+ asset_file = "PowerShellEditorServices.zip",
+ }).with_receipt()
+ end,
default_options = {
bundle_path = path.concat { root_dir },
},
diff --git a/lua/nvim-lsp-installer/servers/prosemd_lsp/init.lua b/lua/nvim-lsp-installer/servers/prosemd_lsp/init.lua
index b7d3f687..7ee6ff6f 100644
--- a/lua/nvim-lsp-installer/servers/prosemd_lsp/init.lua
+++ b/lua/nvim-lsp-installer/servers/prosemd_lsp/init.lua
@@ -1,37 +1,32 @@
local server = require "nvim-lsp-installer.server"
local process = require "nvim-lsp-installer.process"
local platform = require "nvim-lsp-installer.platform"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
local Data = require "nvim-lsp-installer.data"
+local github = require "nvim-lsp-installer.core.managers.github"
+local std = require "nvim-lsp-installer.core.managers.std"
local coalesce, when = Data.coalesce, Data.when
return function(name, root_dir)
- local target = coalesce(
- when(platform.is_mac, "prosemd-lsp-macos"),
- when(platform.is_linux and platform.arch == "x64", "prosemd-lsp-linux"),
- when(platform.is_win and platform.arch == "x64", "prosemd-lsp-windows.exe")
- )
-
return server.Server:new {
name = name,
root_dir = root_dir,
homepage = "https://github.com/kitten/prosemd-lsp",
languages = { "markdown" },
- installer = {
- context.use_github_release_file("kitten/prosemd-lsp", target),
- context.capture(function(ctx)
- return std.download_file(
- ctx.github_release_file,
- platform.is_win and "prosemd-lsp.exe" or "prosemd-lsp"
- )
- end),
- std.chmod("+x", { "prosemd-lsp" }),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ async = true,
+ installer = function()
+ local source = github.release_file {
+ repo = "kitten/prosemd-lsp",
+ asset_file = coalesce(
+ when(platform.is_mac, "prosemd-lsp-macos"),
+ when(platform.is_linux and platform.arch == "x64", "prosemd-lsp-linux"),
+ when(platform.is_win and platform.arch == "x64", "prosemd-lsp-windows.exe")
+ ),
+ }
+ source.with_receipt()
+ std.download_file(source.download_url, platform.is_win and "prosemd-lsp.exe" or "prosemd-lsp")
+ std.chmod("+x", { "prosemd-lsp" })
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir },
diff --git a/lua/nvim-lsp-installer/servers/puppet/init.lua b/lua/nvim-lsp-installer/servers/puppet/init.lua
index 09842f30..9d302c2e 100644
--- a/lua/nvim-lsp-installer/servers/puppet/init.lua
+++ b/lua/nvim-lsp-installer/servers/puppet/init.lua
@@ -1,7 +1,6 @@
local server = require "nvim-lsp-installer.server"
-local context = require "nvim-lsp-installer.installers.context"
-local std = require "nvim-lsp-installer.installers.std"
local process = require "nvim-lsp-installer.process"
+local github = require "nvim-lsp-installer.core.managers.github"
return function(name, root_dir)
return server.Server:new {
@@ -9,17 +8,15 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://github.com/puppetlabs/puppet-editor-services",
languages = { "puppet" },
- installer = {
- context.use_github_release_file("puppetlabs/puppet-editor-services", function(version)
- return ("puppet_editor_services_%s.zip"):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),
- },
+ async = true,
+ installer = function()
+ github.unzip_release_file({
+ repo = "puppetlabs/puppet-editor-services",
+ asset_file = function(version)
+ return ("puppet_editor_services_%s.zip"):format(version)
+ end,
+ }).with_receipt()
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir },
diff --git a/lua/nvim-lsp-installer/servers/quick_lint_js/init.lua b/lua/nvim-lsp-installer/servers/quick_lint_js/init.lua
index 1f292ae9..a90d86cc 100644
--- a/lua/nvim-lsp-installer/servers/quick_lint_js/init.lua
+++ b/lua/nvim-lsp-installer/servers/quick_lint_js/init.lua
@@ -1,64 +1,75 @@
local server = require "nvim-lsp-installer.server"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
local platform = require "nvim-lsp-installer.platform"
-local installers = require "nvim-lsp-installer.installers"
local path = require "nvim-lsp-installer.path"
local Data = require "nvim-lsp-installer.data"
local process = require "nvim-lsp-installer.process"
+local std = require "nvim-lsp-installer.core.managers.std"
+local github_client = require "nvim-lsp-installer.core.managers.github.client"
local coalesce, when = Data.coalesce, Data.when
return function(name, root_dir)
- local release_file = coalesce(
- when(
- platform.is_mac,
- coalesce(
- when(platform.arch == "x64", "macos.tar.gz"),
- when(platform.arch == "arm64", "macos-aarch64.tar.gz")
- )
- ),
- when(
- platform.is_linux,
- coalesce(
- when(platform.arch == "x64", "linux.tar.gz"),
- when(platform.arch == "arm64", "linux-aarch64.tar.gz"),
- when(platform.arch == "arm", "linux-armhf.tar.gz")
- )
- ),
- when(
- platform.is_win,
- coalesce(
- when(platform.arch == "x64", "windows.zip"),
- when(platform.arch == "arm64", "windows-arm64.zip"),
- when(platform.arch == "arm", "windows-arm.zip")
- )
- )
- )
-
return server.Server:new {
name = name,
root_dir = root_dir,
homepage = "https://quick-lint-js.com/",
languages = { "javascript" },
- installer = {
- context.use_github_latest_tag "quick-lint/quick-lint-js",
- context.capture(function(ctx)
- local url = "https://c.quick-lint-js.com/releases/%s/manual/%s"
-
- if platform.is_windows then
- return std.unzip_remote(url:format(ctx.requested_server_version, release_file))
- else
- return std.untargz_remote(url:format(ctx.requested_server_version, release_file))
- end
- end),
- installers.on {
- unix = context.set_working_dir "quick-lint-js",
- },
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_tag(ctx))
- end),
- },
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ local repo = "quick-lint/quick-lint-js"
+ local release_file = assert(
+ coalesce(
+ when(
+ platform.is_mac,
+ coalesce(
+ when(platform.arch == "x64", "macos.tar.gz"),
+ when(platform.arch == "arm64", "macos-aarch64.tar.gz")
+ )
+ ),
+ when(
+ platform.is_linux,
+ coalesce(
+ when(platform.arch == "x64", "linux.tar.gz"),
+ when(platform.arch == "arm64", "linux-aarch64.tar.gz"),
+ when(platform.arch == "arm", "linux-armhf.tar.gz")
+ )
+ ),
+ when(
+ platform.is_win,
+ coalesce(
+ when(platform.arch == "x64", "windows.zip"),
+ when(platform.arch == "arm64", "windows-arm64.zip"),
+ when(platform.arch == "arm", "windows-arm.zip")
+ )
+ )
+ ),
+ "Current platform is not supported."
+ )
+ local version = ctx.requested_version:or_else_get(function()
+ return github_client.fetch_latest_tag(repo)
+ :map(function(tag)
+ return tag.name
+ end)
+ :get_or_throw()
+ end)
+ local url = ("https://c.quick-lint-js.com/releases/%s/manual/%s"):format(version, release_file)
+ platform.when {
+ unix = function()
+ std.download_file(url, "archive.tar.gz")
+ std.untar("archive.tar.gz", { strip_components = 1 })
+ end,
+ win = function()
+ std.download_file(url, "archive.zip")
+ std.unzip("archive.zip", ".")
+ end,
+ }
+ ctx.receipt:with_primary_source {
+ type = "github_tag",
+ repo = repo,
+ tag = version,
+ }
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { path.concat { root_dir, "bin" } },
diff --git a/lua/nvim-lsp-installer/servers/r_language_server/init.lua b/lua/nvim-lsp-installer/servers/r_language_server/init.lua
index 56877f9c..5a637271 100644
--- a/lua/nvim-lsp-installer/servers/r_language_server/init.lua
+++ b/lua/nvim-lsp-installer/servers/r_language_server/init.lua
@@ -8,6 +8,7 @@ options(langserver_library = %q);
options(langserver_quiet = FALSE);
options(repos = list(CRAN = "http://cran.rstudio.com/"));
rlsLib <- getOption("langserver_library");
+.libPaths(new = rlsLib);
didInstallRemotes <- FALSE;
tryCatch(
diff --git a/lua/nvim-lsp-installer/servers/reason_ls/init.lua b/lua/nvim-lsp-installer/servers/reason_ls/init.lua
index 5cb94119..ceca2612 100644
--- a/lua/nvim-lsp-installer/servers/reason_ls/init.lua
+++ b/lua/nvim-lsp-installer/servers/reason_ls/init.lua
@@ -1,36 +1,32 @@
local server = require "nvim-lsp-installer.server"
local platform = require "nvim-lsp-installer.platform"
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 process = require "nvim-lsp-installer.process"
+local github = require "nvim-lsp-installer.core.managers.github"
local coalesce, when = Data.coalesce, Data.when
return function(name, root_dir)
- local archive_name = coalesce(
- when(platform.is_mac, "rls-macos"),
- when(platform.is_linux, "rls-linux"),
- when(platform.is_win, "rls-windows")
- )
return server.Server:new {
name = name,
root_dir = root_dir,
languages = { "reason" },
homepage = "https://github.com/jaredly/reason-language-server",
- installer = {
- context.use_github_release_file("jaredly/reason-language-server", ("%s.zip"):format(archive_name)),
- context.capture(function(ctx)
- return std.unzip_remote(ctx.github_release_file)
- end),
- context.capture(function()
- return std.rename(archive_name, "reason")
- end),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ local archive_name = coalesce(
+ when(platform.is_mac, "rls-macos"),
+ when(platform.is_linux, "rls-linux"),
+ when(platform.is_win, "rls-windows")
+ )
+ github.unzip_release_file({
+ repo = "jaredly/reason-language-server",
+ asset_file = ("%s.zip"):format(archive_name),
+ }).with_receipt()
+ ctx.fs:rename(archive_name, "reason")
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { path.concat { root_dir, "reason" } },
diff --git a/lua/nvim-lsp-installer/servers/rescriptls/init.lua b/lua/nvim-lsp-installer/servers/rescriptls/init.lua
index 4f0e7865..d8a13231 100644
--- a/lua/nvim-lsp-installer/servers/rescriptls/init.lua
+++ b/lua/nvim-lsp-installer/servers/rescriptls/init.lua
@@ -1,7 +1,6 @@
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 github = require "nvim-lsp-installer.core.managers.github"
return function(name, root_dir)
return server.Server:new {
@@ -9,17 +8,15 @@ return function(name, root_dir)
root_dir = root_dir,
languages = { "rescript" },
homepage = "https://github.com/rescript-lang/rescript-vscode",
- installer = {
- context.use_github_release_file("rescript-lang/rescript-vscode", function(version)
- return ("rescript-vscode-%s.vsix"):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),
- },
+ async = true,
+ installer = function()
+ github.unzip_release_file({
+ repo = "rescript-lang/rescript-vscode",
+ asset_file = function(version)
+ return ("rescript-vscode-%s.vsix"):format(version)
+ end,
+ }).with_receipt()
+ end,
default_options = {
cmd = { "node", path.concat { root_dir, "extension", "server", "out", "server.js" }, "--stdio" },
},
diff --git a/lua/nvim-lsp-installer/servers/rust_analyzer/init.lua b/lua/nvim-lsp-installer/servers/rust_analyzer/init.lua
index 16689571..56acc3b5 100644
--- a/lua/nvim-lsp-installer/servers/rust_analyzer/init.lua
+++ b/lua/nvim-lsp-installer/servers/rust_analyzer/init.lua
@@ -1,63 +1,62 @@
local server = require "nvim-lsp-installer.server"
local process = require "nvim-lsp-installer.process"
local platform = require "nvim-lsp-installer.platform"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
local Data = require "nvim-lsp-installer.data"
+local github = require "nvim-lsp-installer.core.managers.github"
+local std = require "nvim-lsp-installer.core.managers.std"
local coalesce, when = Data.coalesce, Data.when
-local libc = platform.get_libc()
-
-local target = coalesce(
- when(
- platform.is_mac,
- coalesce(
- when(platform.arch == "arm64", "rust-analyzer-aarch64-apple-darwin.gz"),
- when(platform.arch == "x64", "rust-analyzer-x86_64-apple-darwin.gz")
- )
- ),
- when(
- platform.is_linux,
- coalesce(
- when(
- libc == "glibc",
- coalesce(
- when(platform.arch == "arm64", "rust-analyzer-aarch64-unknown-linux-gnu.gz"),
- when(platform.arch == "x64", "rust-analyzer-x86_64-unknown-linux-gnu.gz")
- )
- ),
- when(libc == "musl", coalesce(when(platform.arch == "x64", "rust-analyzer-x86_64-unknown-linux-musl.gz")))
- )
- ),
- when(
- platform.is_win,
- coalesce(
- when(platform.arch == "arm64", "rust-analyzer-aarch64-pc-windows-msvc.gz"),
- when(platform.arch == "x64", "rust-analyzer-x86_64-pc-windows-msvc.gz")
- )
- )
-)
-
return function(name, root_dir)
return server.Server:new {
name = name,
root_dir = root_dir,
homepage = "https://rust-analyzer.github.io",
languages = { "rust" },
- installer = {
- context.use_github_release_file("rust-lang/rust-analyzer", target),
- context.capture(function(ctx)
- return std.gunzip_remote(
- ctx.github_release_file,
- platform.is_win and "rust-analyzer.exe" or "rust-analyzer"
+ async = true,
+ installer = function()
+ local libc = platform.get_libc()
+
+ local asset_file = coalesce(
+ when(
+ platform.is_mac,
+ coalesce(
+ when(platform.arch == "arm64", "rust-analyzer-aarch64-apple-darwin.gz"),
+ when(platform.arch == "x64", "rust-analyzer-x86_64-apple-darwin.gz")
+ )
+ ),
+ when(
+ platform.is_linux,
+ coalesce(
+ when(
+ libc == "glibc",
+ coalesce(
+ when(platform.arch == "arm64", "rust-analyzer-aarch64-unknown-linux-gnu.gz"),
+ when(platform.arch == "x64", "rust-analyzer-x86_64-unknown-linux-gnu.gz")
+ )
+ ),
+ when(
+ libc == "musl",
+ coalesce(when(platform.arch == "x64", "rust-analyzer-x86_64-unknown-linux-musl.gz"))
+ )
+ )
+ ),
+ when(
+ platform.is_win,
+ coalesce(
+ when(platform.arch == "arm64", "rust-analyzer-aarch64-pc-windows-msvc.gz"),
+ when(platform.arch == "x64", "rust-analyzer-x86_64-pc-windows-msvc.gz")
+ )
)
- end),
- std.chmod("+x", { "rust-analyzer" }),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ )
+
+ github.gunzip_release_file({
+ repo = "rust-lang/rust-analyzer",
+ asset_file = asset_file,
+ out_file = platform.is_win and "rust-analyzer.exe" or "rust-analyzer",
+ }).with_receipt()
+ std.chmod("+x", { "rust-analyzer" })
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir },
diff --git a/lua/nvim-lsp-installer/servers/serve_d/init.lua b/lua/nvim-lsp-installer/servers/serve_d/init.lua
index 092cbada..bbb7169c 100644
--- a/lua/nvim-lsp-installer/servers/serve_d/init.lua
+++ b/lua/nvim-lsp-installer/servers/serve_d/init.lua
@@ -1,9 +1,10 @@
local server = require "nvim-lsp-installer.server"
local platform = require "nvim-lsp-installer.platform"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
local Data = require "nvim-lsp-installer.data"
local process = require "nvim-lsp-installer.process"
+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 {
@@ -11,25 +12,33 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://github.com/Pure-D/serve-d",
languages = { "d" },
- installer = {
- context.use_github_release_file("Pure-D/serve-d", function(version)
- return Data.coalesce(
- Data.when(platform.is_mac, "serve-d_%s-osx-x86_64.tar.xz"),
- Data.when(platform.is_linux, "serve-d_%s-linux-x86_64.tar.xz"),
- Data.when(platform.is_win, "serve-d_%s-windows-x86_64.zip")
- ):format(version:gsub("^v", ""))
- end),
- 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),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ async = true,
+ installer = function()
+ local repo = "Pure-D/serve-d"
+ platform.when {
+ unix = function()
+ github.untarxz_release_file({
+ repo = repo,
+ asset_file = function(release)
+ local target = coalesce(
+ when(platform.is_mac, "serve-d_%s-osx-x86_64.tar.xz"),
+ when(platform.is_linux and platform.arch == "x64", "serve-d_%s-linux-x86_64.tar.xz")
+ )
+ return target and target:format(release:gsub("^v", ""))
+ end,
+ }).with_receipt()
+ end,
+ win = function()
+ github.unzip_release_file({
+ repo = repo,
+ asset_file = function(release)
+ local target = coalesce(when(platform.arch == "x64"), "serve-d_%s-windows-x86_64.zip")
+ return target and target:format(release:gsub("^v", ""))
+ end,
+ }).with_receipt()
+ end,
+ }
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir },
diff --git a/lua/nvim-lsp-installer/servers/slint_lsp/init.lua b/lua/nvim-lsp-installer/servers/slint_lsp/init.lua
index 2cdfbd63..877adf12 100644
--- a/lua/nvim-lsp-installer/servers/slint_lsp/init.lua
+++ b/lua/nvim-lsp-installer/servers/slint_lsp/init.lua
@@ -1,33 +1,33 @@
local server = require "nvim-lsp-installer.server"
-local Data = require "nvim-lsp-installer.data"
-local std = require "nvim-lsp-installer.installers.std"
local path = require "nvim-lsp-installer.path"
local platform = require "nvim-lsp-installer.platform"
local process = require "nvim-lsp-installer.process"
-local context = require "nvim-lsp-installer.installers.context"
-
-local coalesce, when = Data.coalesce, Data.when
+local github = require "nvim-lsp-installer.core.managers.github"
return function(name, root_dir)
- local archive_name = coalesce(
- when(platform.is_linux and platform.arch == "x64", "slint-lsp-linux.tar.gz"),
- when(platform.is_win and platform.arch == "x64", "slint-lsp-windows.zip")
- )
return server.Server:new {
name = name,
root_dir = root_dir,
homepage = "https://slint-ui.com/",
languages = { "slint" },
- installer = {
- context.use_github_release_file("slint-ui/slint", archive_name),
- context.capture(function(ctx)
- if platform.is_win then
- return std.unzip_remote(ctx.github_release_file)
- else
- return std.untargz_remote(ctx.github_release_file)
- end
- end),
- },
+ async = true,
+ installer = function()
+ local repo = "slint-ui/slint"
+ platform.when {
+ win = function()
+ github.unzip_release_file({
+ repo = repo,
+ asset_file = "slint-lsp-windows.zip",
+ }).with_receipt()
+ end,
+ linux = function()
+ github.untargz_release_file({
+ repo = repo,
+ asset_file = "slint-lsp-linux.tar.gz",
+ }).with_receipt()
+ end,
+ }
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { path.concat { root_dir, "slint-lsp" } },
diff --git a/lua/nvim-lsp-installer/servers/solang/init.lua b/lua/nvim-lsp-installer/servers/solang/init.lua
index e8223def..8a382cf3 100644
--- a/lua/nvim-lsp-installer/servers/solang/init.lua
+++ b/lua/nvim-lsp-installer/servers/solang/init.lua
@@ -1,64 +1,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 process = require "nvim-lsp-installer.process"
+local std = require "nvim-lsp-installer.core.managers.std"
+local github = require "nvim-lsp-installer.core.managers.github"
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(
+ ---@async
+ local function download_solang()
+ local source = github.release_file {
+ repo = "hyperledger-labs/solang",
+ asset_file = 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 and platform.arch == "arm64", "solang-linux-arm64"),
when(platform.is_linux and platform.arch == "x64", "solang-linux-x86-64"),
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" }),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- }
+ ),
+ }
+ source.with_receipt()
+ std.download_file(source.download_url, platform.is_win and "solang.exe" or "solang")
+ std.chmod("+x", { "solang" })
+ return source
+ end
- local llvm_installer = installers.pipe {
- context.use_github_release_file(
- "hyperledger-labs/solang",
- coalesce(
+ ---@async
+ local function download_llvm()
+ local source = github.release_file {
+ repo = "hyperledger-labs/solang",
+ asset_file = coalesce(
when(platform.is_mac and platform.arch == "x64", "llvm13.0-mac-intel.tar.xz"),
when(platform.is_mac and platform.arch == "arm64", "llvm13.0-mac-arm.tar.xz"),
when(platform.is_linux and platform.arch == "x64", "llvm13.0-linux-x86-64.tar.xz"),
when(platform.is_linux and platform.arch == "arm64", "llvm13.0-linux-arm64.tar.xz"),
when(platform.is_win, "llvm13.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),
- }
+ ),
+ }
+ if platform.is_win then
+ std.download_file(source.download_url, "llvm.zip")
+ std.unzip("llvm.zip", ".")
+ else
+ std.download_file(source.download_url, "llvm.tar.xz")
+ std.untar "llvm.tar.xz"
+ end
+ end
return server.Server:new {
name = name,
root_dir = root_dir,
homepage = "https://solang.readthedocs.io/en/latest/",
languages = { "solidity" },
- installer = {
- solang_executable_installer,
- llvm_installer,
- },
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ ctx:run_concurrently { download_solang, download_llvm }
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path {
diff --git a/lua/nvim-lsp-installer/servers/solc/init.lua b/lua/nvim-lsp-installer/servers/solc/init.lua
index bdd2b331..941399ae 100644
--- a/lua/nvim-lsp-installer/servers/solc/init.lua
+++ b/lua/nvim-lsp-installer/servers/solc/init.lua
@@ -1,36 +1,33 @@
local server = require "nvim-lsp-installer.server"
local Data = require "nvim-lsp-installer.data"
-local context = require "nvim-lsp-installer.installers.context"
local platform = require "nvim-lsp-installer.platform"
-local std = require "nvim-lsp-installer.installers.std"
local process = require "nvim-lsp-installer.process"
+local github = require "nvim-lsp-installer.core.managers.github"
+local std = require "nvim-lsp-installer.core.managers.std"
local coalesce, when = Data.coalesce, Data.when
return function(name, root_dir)
- local bin_name = platform.is_win and "solc.exe" or "solc"
return server.Server:new {
name = name,
root_dir = root_dir,
homepage = "https://github.com/ethereum/solidity",
languages = { "solidity" },
- installer = {
- context.use_github_release_file(
- "ethereum/solidity",
- coalesce(
+ async = true,
+ installer = function()
+ local source = github.release_file {
+ repo = "ethereum/solidity",
+ asset_file = coalesce(
when(platform.is_mac, "solc-macos"),
when(platform.is_linux, "solc-static-linux"),
when(platform.is_win, "solc-windows.exe")
- )
- ),
- context.capture(function(ctx)
- return std.download_file(ctx.github_release_file, bin_name)
- end),
- std.chmod("+x", { bin_name }),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ ),
+ }
+ source.with_receipt()
+ local bin_name = platform.is_win and "solc.exe" or "solc"
+ std.download_file(source.download_url, bin_name)
+ std.chmod("+x", { bin_name })
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir },
diff --git a/lua/nvim-lsp-installer/servers/spectral/init.lua b/lua/nvim-lsp-installer/servers/spectral/init.lua
index 61047942..8b174d22 100644
--- a/lua/nvim-lsp-installer/servers/spectral/init.lua
+++ b/lua/nvim-lsp-installer/servers/spectral/init.lua
@@ -13,14 +13,14 @@ return function(name, root_dir)
---@param ctx InstallContext
installer = function(ctx)
git.clone({ "https://github.com/stoplightio/vscode-spectral" }).with_receipt()
- local server_dir = path.concat { ctx.cwd:get(), "server" }
ctx.spawn.npm { "install" }
- ctx.spawn.npm { "install", cwd = server_dir }
+ ctx:chdir("server", function()
+ ctx.spawn.npm { "install" }
+ end)
pcall(npm.run, { "compile" })
- -- TODO: don't do this
- ctx.cwd:set(server_dir)
- ctx.receipt:mark_invalid() -- Due to the `context.set_working_dir` after clone, we essentially erase any trace of the cloned git repo, so we mark this as invalid.
+ ctx:chdir "server"
+ ctx.receipt:mark_invalid() -- Due to the `chdir`, we essentially erase any trace of the cloned git repo, so we mark this as invalid.
end,
default_options = {
cmd = { "node", path.concat { root_dir, "out", "server.js" }, "--stdio" },
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 {
diff --git a/lua/nvim-lsp-installer/servers/terraformls/init.lua b/lua/nvim-lsp-installer/servers/terraformls/init.lua
index 8bcb7f32..bf9e6cb5 100644
--- a/lua/nvim-lsp-installer/servers/terraformls/init.lua
+++ b/lua/nvim-lsp-installer/servers/terraformls/init.lua
@@ -2,9 +2,8 @@ local server = require "nvim-lsp-installer.server"
local process = require "nvim-lsp-installer.process"
local path = require "nvim-lsp-installer.path"
local platform = require "nvim-lsp-installer.platform"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
local Data = require "nvim-lsp-installer.data"
+local github = require "nvim-lsp-installer.core.managers.github"
local coalesce, when = Data.coalesce, Data.when
@@ -14,34 +13,36 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://github.com/hashicorp/terraform-ls",
languages = { "terraform" },
- installer = {
- context.use_github_release_file("hashicorp/terraform-ls", function(version)
- return Data.coalesce(
- when(
- platform.is_mac,
- coalesce(
- when(platform.arch == "arm64", "terraform-ls_%s_darwin_arm64.zip"),
- when(platform.arch == "x64", "terraform-ls_%s_darwin_amd64.zip")
+ async = true,
+ installer = function()
+ github.unzip_release_file({
+ repo = "hashicorp/terraform-ls",
+ asset_file = function(version)
+ local target = coalesce(
+ when(
+ platform.is_mac,
+ coalesce(
+ when(platform.arch == "arm64", "terraform-ls_%s_darwin_arm64.zip"),
+ when(platform.arch == "x64", "terraform-ls_%s_darwin_amd64.zip")
+ )
+ ),
+ when(
+ platform.is_linux,
+ coalesce(
+ when(platform.arch == "arm64", "terraform-ls_%s_linux_arm64.zip"),
+ when(platform.arch == "arm", "terraform-ls_%s_linux_arm.zip"),
+ when(platform.arch == "x64", "terraform-ls_%s_linux_amd64.zip")
+ )
+ ),
+ when(
+ platform.is_win,
+ coalesce(when(platform.arch == "x64", "terraform-ls_%s_windows_amd64.zip"))
)
- ),
- when(
- platform.is_linux,
- coalesce(
- when(platform.arch == "arm64", "terraform-ls_%s_linux_arm64.zip"),
- when(platform.arch == "arm", "terraform-ls_%s_linux_arm.zip"),
- when(platform.arch == "x64", "terraform-ls_%s_linux_amd64.zip")
- )
- ),
- when(platform.is_win, coalesce(when(platform.arch == "x64", "terraform-ls_%s_windows_amd64.zip")))
- ):format(version:gsub("^v", ""))
- end),
- context.capture(function(ctx)
- return std.unzip_remote(ctx.github_release_file, "terraform-ls")
- end),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ )
+ return target and target:format(version:gsub("^v", ""))
+ end,
+ }).with_receipt()
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { path.concat { root_dir, "terraform-ls" } },
diff --git a/lua/nvim-lsp-installer/servers/texlab/init.lua b/lua/nvim-lsp-installer/servers/texlab/init.lua
index 4b1e02c9..5adf0264 100644
--- a/lua/nvim-lsp-installer/servers/texlab/init.lua
+++ b/lua/nvim-lsp-installer/servers/texlab/init.lua
@@ -1,10 +1,8 @@
local server = require "nvim-lsp-installer.server"
local process = require "nvim-lsp-installer.process"
-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 github = require "nvim-lsp-installer.core.managers.github"
local coalesce, when = Data.coalesce, Data.when
@@ -14,25 +12,27 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://github.com/latex-lsp/texlab",
languages = { "latex" },
- installer = {
- context.use_github_release_file(
- "latex-lsp/texlab",
- coalesce(
- when(platform.is_mac, "texlab-x86_64-macos.tar.gz"),
- when(platform.is_linux, "texlab-x86_64-linux.tar.gz"),
- when(platform.is_win, "texlab-x86_64-windows.zip")
- )
- ),
- context.capture(function(ctx)
- return installers.when {
- unix = std.untargz_remote(ctx.github_release_file),
- win = std.unzip_remote(ctx.github_release_file),
- }
- end),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ async = true,
+ installer = function()
+ local repo = "latex-lsp/texlab"
+ platform.when {
+ unix = function()
+ github.untargz_release_file({
+ repo = repo,
+ asset_file = coalesce(
+ when(platform.is_mac, "texlab-x86_64-macos.tar.gz"),
+ when(platform.is_linux and platform.arch == "x64", "texlab-x86_64-linux.tar.gz")
+ ),
+ }).with_receipt()
+ end,
+ win = function()
+ github.unzip_release_file({
+ repo = repo,
+ asset_file = coalesce(when(platform.arch == "x64", "texlab-x86_64-windows.zip")),
+ }).with_receipt()
+ end,
+ }
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir },
diff --git a/lua/nvim-lsp-installer/servers/tflint/init.lua b/lua/nvim-lsp-installer/servers/tflint/init.lua
index 125afa86..65a04dec 100644
--- a/lua/nvim-lsp-installer/servers/tflint/init.lua
+++ b/lua/nvim-lsp-installer/servers/tflint/init.lua
@@ -1,68 +1,61 @@
local server = require "nvim-lsp-installer.server"
local Data = require "nvim-lsp-installer.data"
+local a = require "nvim-lsp-installer.core.async"
local platform = require "nvim-lsp-installer.platform"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
+local github = require "nvim-lsp-installer.core.managers.github"
+local spawn = require "nvim-lsp-installer.core.spawn"
local process = require "nvim-lsp-installer.process"
local coalesce, when = Data.coalesce, Data.when
return function(name, root_dir)
- local os = coalesce(
- when(platform.is_mac, "darwin"),
- when(platform.is_linux, "linux"),
- when(platform.is_win, "windows")
- )
-
- local arch = coalesce(when(platform.arch == "x64", "amd64"), platform.arch)
-
- local target = ("tflint_%s_%s.zip"):format(os, arch)
-
return server.Server:new {
name = name,
root_dir = root_dir,
languages = { "terraform" },
homepage = "https://github.com/terraform-linters/tflint",
- installer = {
- context.use_github_release_file("terraform-linters/tflint", target),
- 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),
- },
+ async = true,
+ installer = function()
+ github.unzip_release_file({
+ repo = "terraform-linters/tflint",
+ asset_file = coalesce(
+ when(platform.is_mac and platform.arch == "x64", "tflint_darwin_amd64.zip"),
+ when(platform.is_mac and platform.arch == "arm64", "tflint_darwin_arm64.zip"),
+ when(platform.is_linux and platform.arch == "x64", "tflint_linux_amd64.zip"),
+ when(platform.is_linux and platform.arch == "arm64", "tflint_linux_arm64.zip"),
+ when(platform.is_linux and platform.arch == "x86", "tflint_linux_386.zip"),
+ when(platform.is_win and platform.arch == "x64", "tflint_windows_amd64.zip")
+ ),
+ }).with_receipt()
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir },
},
commands = {
TFLintInit = {
- function()
- local process = require "nvim-lsp-installer.process"
+ a.scope(function()
local notify = require "nvim-lsp-installer.notify"
- local path = require "nvim-lsp-installer.path"
notify "Installing TFLint plugins…"
- process.spawn(
- "tflint",
- {
- args = { "--init" },
- cwd = path.cwd(),
- stdio_sink = process.simple_sink(),
- env = process.graft_env {
- PATH = process.extend_path { root_dir },
- },
- },
- vim.schedule_wrap(function(success)
- if success then
- notify "Successfully installed TFLint plugins."
- else
- notify "Failed to install TFLint plugins."
+ spawn.tflint({
+ "--init",
+ cwd = vim.loop.getcwd(),
+ with_paths = { root_dir },
+ })
+ :on_success(function()
+ if vim.in_fast_event() then
+ a.scheduler()
+ end
+ notify "Successfully installed TFLint plugins."
+ end)
+ :on_failure(function()
+ if vim.in_fast_event() then
+ a.scheduler()
end
+ notify "Failed to install TFLint plugins."
end)
- )
- end,
+ end),
description = "Runs tflint --init in the current working directory.",
},
},
diff --git a/lua/nvim-lsp-installer/servers/vala_ls/init.lua b/lua/nvim-lsp-installer/servers/vala_ls/init.lua
index b3e51431..1fca178b 100644
--- a/lua/nvim-lsp-installer/servers/vala_ls/init.lua
+++ b/lua/nvim-lsp-installer/servers/vala_ls/init.lua
@@ -1,8 +1,7 @@
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 installers = require "nvim-lsp-installer.installers"
+local std = require "nvim-lsp-installer.core.managers.std"
+local github = require "nvim-lsp-installer.core.managers.github"
local process = require "nvim-lsp-installer.process"
return function(name, root_dir)
@@ -11,40 +10,28 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://wiki.gnome.org/Projects/Vala",
languages = { "vala" },
- installer = {
- std.ensure_executables {
- { "meson", "meson was not found in path. Refer to https://mesonbuild.com/Getting-meson.html" },
- { "ninja", "ninja was not found in path. Refer to https://ninja-build.org/" },
- { "valac", "valac was not found in path. Refer to https://wiki.gnome.org/Projects/Vala" },
- },
- context.use_github_release_file("Prince781/vala-language-server", function(version)
- return ("vala-language-server-%s.tar.xz"):format(version)
- end),
- context.capture(function(ctx)
- return installers.pipe {
- std.untarxz_remote(ctx.github_release_file),
- std.rename(
- ("vala-language-server-%s"):format(ctx.requested_server_version),
- "vala-language-server"
- ),
- }
- end),
- function(_, callback, ctx)
- local c = process.chain {
- cwd = path.concat { ctx.install_dir, "vala-language-server" },
- stdio_sink = ctx.stdio_sink,
- }
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ std.ensure_executable("meson", { help_url = "https://mesonbuild.com/Getting-meson.html" })
+ std.ensure_executable("ninja", { help_url = "https://ninja-build.org/" })
+ std.ensure_executable("valac", { help_url = "https://wiki.gnome.org/Projects/Vala" })
- c.run("meson", { ("-Dprefix=%s"):format(ctx.install_dir), "build" })
- c.run("ninja", { "-C", "build", "install" })
+ local release_source = github.untarxz_release_file {
+ repo = "Prince781/vala-language-server",
+ asset_file = function(version)
+ return ("vala-language-server-%s.tar.xz"):format(version)
+ end,
+ }
+ release_source.with_receipt()
- c.spawn(callback)
- end,
- std.rmrf "vala-language-server",
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ local vala_dirname = ("vala-language-server-%s"):format(release_source.release)
+ ctx:chdir(vala_dirname, function()
+ ctx.spawn.meson { ("-Dprefix=%s"):format(ctx.cwd:get()), "build" }
+ ctx.spawn.ninja { "-C", "build", "install" }
+ end)
+ ctx.fs:rmrf(vala_dirname)
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { path.concat { root_dir, "bin" } },
diff --git a/lua/nvim-lsp-installer/servers/verible/init.lua b/lua/nvim-lsp-installer/servers/verible/init.lua
index ea55531f..396fc6be 100644
--- a/lua/nvim-lsp-installer/servers/verible/init.lua
+++ b/lua/nvim-lsp-installer/servers/verible/init.lua
@@ -1,11 +1,9 @@
local server = require "nvim-lsp-installer.server"
local process = require "nvim-lsp-installer.process"
local platform = require "nvim-lsp-installer.platform"
-local installers = require "nvim-lsp-installer.installers"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
local Data = require "nvim-lsp-installer.data"
local path = require "nvim-lsp-installer.path"
+local github = require "nvim-lsp-installer.core.managers.github"
local coalesce, when = Data.coalesce, Data.when
@@ -15,57 +13,52 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://chipsalliance.github.io/verible/",
languages = { "systemverilog", "verilog" },
- installer = {
- context.use_os_distribution(),
- context.capture(function(ctx)
- return context.use_github_release_file("chipsalliance/verible", function(version)
- if ctx.os_distribution.id == "ubuntu" then
- local target_file = when(
- platform.arch == "x64",
- coalesce(
- when(
- ctx.os_distribution.version.major == 16,
- "verible-%s-Ubuntu-16.04-xenial-x86_64.tar.gz"
- ),
- when(
- ctx.os_distribution.version.major == 18,
- "verible-%s-Ubuntu-18.04-bionic-x86_64.tar.gz"
- ),
- when(
- ctx.os_distribution.version.major == 20,
- "verible-%s-Ubuntu-20.04-focal-x86_64.tar.gz"
- ),
- when(
- ctx.os_distribution.version.major == 22,
- "verible-%s-Ubuntu-22.04-jammy-x86_64.tar.gz"
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ local repo = "chipsalliance/verible"
+ platform.when {
+ linux = function()
+ local os_dist = platform.os_distribution()
+ local source = github.untarxz_release_file {
+ repo = repo,
+ asset_file = function(release)
+ if os_dist.id == "ubuntu" then
+ local target_file = when(
+ platform.arch == "x64",
+ coalesce(
+ when(
+ os_dist.version.major == 16,
+ "verible-%s-Ubuntu-16.04-xenial-x86_64.tar.gz"
+ ),
+ when(
+ os_dist.version.major == 18,
+ "verible-%s-Ubuntu-18.04-bionic-x86_64.tar.gz"
+ ),
+ when(os_dist.version.major == 20, "verible-%s-Ubuntu-20.04-focal-x86_64.tar.gz"),
+ when(os_dist.version.major == 22, "verible-%s-Ubuntu-22.04-jammy-x86_64.tar.gz")
+ )
)
- )
- )
- return target_file and target_file:format(version)
- else
- local target_file = coalesce(
- when(platform.is_win and platform.arch == "x64", "verible-%s-win64.zip")
- )
- return target_file and target_file:format(version)
- end
- end)
- end),
- context.capture(function(ctx)
- return installers.pipe {
- installers.when {
- unix = std.untargz_remote(ctx.github_release_file),
- win = std.unzip_remote(ctx.github_release_file),
- },
- std.rename(
- ("verible-%s%s"):format(ctx.requested_server_version, platform.is_win and "-win64" or ""),
- "verible"
- ),
- }
- end),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ return target_file and target_file:format(release)
+ end
+ end,
+ }
+ source.with_receipt()
+ ctx.fs:rename(("verible-%s"):format(source.release), "verible")
+ end,
+ win = function()
+ local source = github.unzip_release_file {
+ repo = repo,
+ asset_file = function(release)
+ local target_file = coalesce(when(platform.arch == "x64", "verible-%s-win64.zip"))
+ return target_file and target_file:format(release)
+ end,
+ }
+ source.with_receipt()
+ ctx.fs:rename(("verible-%s-win64"):format(source.release), "verible")
+ end,
+ }
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path {
diff --git a/lua/nvim-lsp-installer/servers/zeta_note/init.lua b/lua/nvim-lsp-installer/servers/zeta_note/init.lua
index 01ef807a..2658772e 100644
--- a/lua/nvim-lsp-installer/servers/zeta_note/init.lua
+++ b/lua/nvim-lsp-installer/servers/zeta_note/init.lua
@@ -1,9 +1,9 @@
local server = require "nvim-lsp-installer.server"
local process = require "nvim-lsp-installer.process"
local platform = require "nvim-lsp-installer.platform"
-local std = require "nvim-lsp-installer.installers.std"
-local context = require "nvim-lsp-installer.installers.context"
local Data = require "nvim-lsp-installer.data"
+local github = require "nvim-lsp-installer.core.managers.github"
+local std = require "nvim-lsp-installer.core.managers.std"
local coalesce, when = Data.coalesce, Data.when
@@ -13,23 +13,20 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://github.com/artempyanykh/zeta-note",
languages = { "markdown" },
- installer = {
- context.use_github_release_file(
- "artempyanykh/zeta-note",
- coalesce(
+ async = true,
+ installer = function()
+ local source = github.release_file {
+ repo = "artempyanykh/zeta-note",
+ asset_file = coalesce(
when(platform.is_mac, "zeta-note-macos"),
when(platform.is_linux and platform.arch == "x64", "zeta-note-linux"),
when(platform.is_win and platform.arch == "x64", "zeta-note-windows.exe")
- )
- ),
- context.capture(function(ctx)
- return std.download_file(ctx.github_release_file, platform.is_win and "zeta-note.exe" or "zeta-note")
- end),
- std.chmod("+x", { "zeta-note" }),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ ),
+ }
+ source.with_receipt()
+ std.download_file(source.download_url, platform.is_win and "zeta-note.exe" or "zeta-note")
+ std.chmod("+x", { "zeta-note" })
+ end,
default_options = {
cmd = { "zeta-note" },
cmd_env = {
diff --git a/lua/nvim-lsp-installer/servers/zk/init.lua b/lua/nvim-lsp-installer/servers/zk/init.lua
index 02a416bf..6c8825eb 100644
--- a/lua/nvim-lsp-installer/servers/zk/init.lua
+++ b/lua/nvim-lsp-installer/servers/zk/init.lua
@@ -1,9 +1,8 @@
local server = require "nvim-lsp-installer.server"
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
return function(name, root_dir)
@@ -12,24 +11,27 @@ return function(name, root_dir)
root_dir = root_dir,
homepage = "https://github.com/mickael-menu/zk",
languages = { "markdown" },
- installer = {
- context.use_github_release_file(
- "mickael-menu/zk",
- coalesce(
- when(
- platform.is_mac,
- coalesce(
+ async = true,
+ installer = function()
+ local repo = "mickael-menu/zk"
+ platform.when {
+ mac = function()
+ github.unzip_release_file({
+ repo = repo,
+ asset_file = coalesce(
when(platform.arch == "arm64", function(version)
return ("zk-%s-macos-arm64.zip"):format(version)
end),
when(platform.arch == "x64", function(version)
return ("zk-%s-macos-x86_64.zip"):format(version)
end)
- )
- ),
- when(
- platform.is_linux,
- coalesce(
+ ),
+ }):with_receipt()
+ end,
+ linux = function()
+ github.untargz_release_file({
+ repo = repo,
+ asset_file = coalesce(
when(platform.arch == "arm64", function(version)
return ("zk-%s-linux-arm64.tar.gz"):format(version)
end),
@@ -39,22 +41,11 @@ return function(name, root_dir)
when(platform.arch == "x86", function(version)
return ("zk-%s-linux-i386.tar.gz"):format(version)
end)
- )
- )
- )
- ),
- context.capture(coalesce(
- when(platform.is_mac, function(ctx)
- return std.unzip_remote(ctx.github_release_file)
- end),
- when(platform.is_linux, function(ctx)
- return std.untargz_remote(ctx.github_release_file)
- end)
- )),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ ),
+ }).with_receipt()
+ end,
+ }
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { root_dir },
diff --git a/lua/nvim-lsp-installer/servers/zls/init.lua b/lua/nvim-lsp-installer/servers/zls/init.lua
index 21d52239..c902f4aa 100644
--- a/lua/nvim-lsp-installer/servers/zls/init.lua
+++ b/lua/nvim-lsp-installer/servers/zls/init.lua
@@ -2,41 +2,39 @@ local path = require "nvim-lsp-installer.path"
local server = require "nvim-lsp-installer.server"
local platform = require "nvim-lsp-installer.platform"
local Data = require "nvim-lsp-installer.data"
-local context = require "nvim-lsp-installer.installers.context"
-local std = require "nvim-lsp-installer.installers.std"
local process = require "nvim-lsp-installer.process"
+local github = require "nvim-lsp-installer.core.managers.github"
+local std = require "nvim-lsp-installer.core.managers.std"
local coalesce, when = Data.coalesce, Data.when
return function(name, root_dir)
- local archive_name = coalesce(
- when(platform.is_mac, "x86_64-macos.tar.xz"),
- when(
- platform.is_linux,
- coalesce(
- when(platform.arch == "x64", "x86_64-linux.tar.xz"),
- when(platform.arch == "x86", "i386-linux.tar.xz")
- )
- ),
- when(platform.is_win and platform.arch == "x64", "x86_64-windows.tar.xz")
- )
-
return server.Server:new {
name = name,
root_dir = root_dir,
homepage = "https://github.com/zigtools/zls",
languages = { "zig" },
- installer = {
- context.use_github_release_file("zigtools/zls", archive_name),
- context.capture(function(ctx)
- return std.untarxz_remote(ctx.github_release_file)
- end),
- std.rename("bin", "package"),
- std.chmod("+x", { path.concat { "package", "zls" } }),
- context.receipt(function(receipt, ctx)
- receipt:with_primary_source(receipt.github_release_file(ctx))
- end),
- },
+ async = true,
+ ---@param ctx InstallContext
+ installer = function(ctx)
+ local asset_file = coalesce(
+ when(platform.is_mac, "x86_64-macos.tar.xz"),
+ when(
+ platform.is_linux,
+ coalesce(
+ when(platform.arch == "x64", "x86_64-linux.tar.xz"),
+ when(platform.arch == "x86", "i386-linux.tar.xz")
+ )
+ ),
+ when(platform.is_win and platform.arch == "x64", "x86_64-windows.tar.xz")
+ )
+ github.untarxz_release_file({
+ repo = "zigtools/zls",
+ asset_file = asset_file,
+ }).with_receipt()
+ ctx.fs:rename("bin", "package")
+ std.chmod("+x", { path.concat { "package", "zls" } })
+ end,
default_options = {
cmd_env = {
PATH = process.extend_path { path.concat { root_dir, "package" } },