diff options
Diffstat (limited to 'lua/nvim-lsp-installer/servers')
18 files changed, 100 insertions, 148 deletions
diff --git a/lua/nvim-lsp-installer/servers/dartls/init.lua b/lua/nvim-lsp-installer/servers/dartls/init.lua index 433b5667..8f0437fe 100644 --- a/lua/nvim-lsp-installer/servers/dartls/init.lua +++ b/lua/nvim-lsp-installer/servers/dartls/init.lua @@ -1,6 +1,5 @@ local server = require "nvim-lsp-installer.server" -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" return function(name, root_dir) return server.Server:new { @@ -8,17 +7,8 @@ return function(name, root_dir) root_dir = root_dir, homepage = "https://github.com/dart-lang/sdk", languages = { "dart" }, - installer = { - std.ensure_executables { - { - "dart", - "dart was not found in path. Refer to https://dart.dev/get-dart for installation instructions.", - }, - }, - context.receipt(function(receipt) - receipt:with_primary_source(receipt.system "dart") - end), - }, + async = true, + installer = std.system_executable("dart", { help_url = "https://dart.dev/get-dart" }), default_options = {}, } end diff --git a/lua/nvim-lsp-installer/servers/efm/init.lua b/lua/nvim-lsp-installer/servers/efm/init.lua index c665df7a..0077b66e 100644 --- a/lua/nvim-lsp-installer/servers/efm/init.lua +++ b/lua/nvim-lsp-installer/servers/efm/init.lua @@ -1,5 +1,5 @@ local server = require "nvim-lsp-installer.server" -local go = require "nvim-lsp-installer.installers.go" +local go = require "nvim-lsp-installer.core.managers.go" return function(name, root_dir) return server.Server:new { @@ -7,6 +7,7 @@ return function(name, root_dir) root_dir = root_dir, homepage = "https://github.com/mattn/efm-langserver", languages = {}, + async = true, installer = go.packages { "github.com/mattn/efm-langserver" }, default_options = { cmd_env = go.env(root_dir), diff --git a/lua/nvim-lsp-installer/servers/golangci_lint_ls/init.lua b/lua/nvim-lsp-installer/servers/golangci_lint_ls/init.lua index 7dc0156c..3a0e8db7 100644 --- a/lua/nvim-lsp-installer/servers/golangci_lint_ls/init.lua +++ b/lua/nvim-lsp-installer/servers/golangci_lint_ls/init.lua @@ -1,5 +1,5 @@ local server = require "nvim-lsp-installer.server" -local go = require "nvim-lsp-installer.installers.go" +local go = require "nvim-lsp-installer.core.managers.go" return function(name, root_dir) return server.Server:new { @@ -7,6 +7,7 @@ return function(name, root_dir) root_dir = root_dir, homepage = "https://github.com/nametake/golangci-lint-langserver", languages = { "go" }, + async = true, installer = go.packages { "github.com/nametake/golangci-lint-langserver", "github.com/golangci/golangci-lint/cmd/golangci-lint", diff --git a/lua/nvim-lsp-installer/servers/gopls/init.lua b/lua/nvim-lsp-installer/servers/gopls/init.lua index 9b1f8c09..a540a856 100644 --- a/lua/nvim-lsp-installer/servers/gopls/init.lua +++ b/lua/nvim-lsp-installer/servers/gopls/init.lua @@ -1,5 +1,5 @@ local server = require "nvim-lsp-installer.server" -local go = require "nvim-lsp-installer.installers.go" +local go = require "nvim-lsp-installer.core.managers.go" return function(name, root_dir) return server.Server:new { @@ -7,6 +7,7 @@ return function(name, root_dir) root_dir = root_dir, homepage = "https://pkg.go.dev/golang.org/x/tools/gopls", languages = { "go" }, + async = true, installer = go.packages { "golang.org/x/tools/gopls" }, default_options = { cmd_env = go.env(root_dir), diff --git a/lua/nvim-lsp-installer/servers/groovyls/init.lua b/lua/nvim-lsp-installer/servers/groovyls/init.lua index 8dbb1b5c..a40dc32e 100644 --- a/lua/nvim-lsp-installer/servers/groovyls/init.lua +++ b/lua/nvim-lsp-installer/servers/groovyls/init.lua @@ -1,7 +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 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 { @@ -9,19 +10,19 @@ return function(name, root_dir) root_dir = root_dir, languages = { "groovy" }, homepage = "https://github.com/GroovyLanguageServer/groovy-language-server", - installer = { - std.ensure_executables { { "javac", "javac was not found in path." } }, - std.git_clone "https://github.com/GroovyLanguageServer/groovy-language-server", - context.promote_install_dir(), - std.gradlew { - args = { "build" }, - }, - context.receipt(function(receipt) - receipt:with_primary_source( - receipt.git_remote "https://github.com/GroovyLanguageServer/groovy-language-server" - ) - end), - }, + async = true, + ---@param ctx InstallContext + installer = function(ctx) + std.ensure_executable "javac" + git.clone({ "https://github.com/GroovyLanguageServer/groovy-language-server" }).with_receipt() + ctx:promote_cwd() + ctx.spawn.gradlew { + "build", + env = process.graft_env { + PATH = process.extend_path { ctx.cwd:get() }, + }, + } + end, default_options = { cmd = { "java", "-jar", path.concat { root_dir, "build", "libs", "groovyls-all.jar" } }, }, diff --git a/lua/nvim-lsp-installer/servers/haxe_language_server/init.lua b/lua/nvim-lsp-installer/servers/haxe_language_server/init.lua index 25c77cb0..f07cdd33 100644 --- a/lua/nvim-lsp-installer/servers/haxe_language_server/init.lua +++ b/lua/nvim-lsp-installer/servers/haxe_language_server/init.lua @@ -1,8 +1,8 @@ local server = require "nvim-lsp-installer.server" -local std = require "nvim-lsp-installer.installers.std" -local npm = require "nvim-lsp-installer.installers.npm" local path = require "nvim-lsp-installer.path" -local context = require "nvim-lsp-installer.installers.context" +local std = require "nvim-lsp-installer.core.managers.std" +local git = require "nvim-lsp-installer.core.managers.git" +local npm = require "nvim-lsp-installer.core.managers.npm" return function(name, root_dir) return server.Server:new { @@ -10,20 +10,14 @@ return function(name, root_dir) root_dir = root_dir, homepage = "https://github.com/vshaxe/haxe-language-server", languages = { "haxe" }, - installer = { - std.ensure_executables { - { - "haxelib", - "haxelib was not found in path. Refer to https://haxe.org/ for installation instructions.", - }, - }, - std.git_clone "https://github.com/vshaxe/haxe-language-server", - npm.install(), - npm.exec("lix", { "run", "vshaxe-build", "-t", "language-server" }), - context.receipt(function(receipt) - receipt:with_primary_source(receipt.git_remote "https://github.com/vshaxe/haxe-language-server") - end), - }, + async = true, + ---@param ctx InstallContext + installer = function(ctx) + std.ensure_executable("haxelib", { help_url = "https://haxe.org" }) + git.clone({ "https://github.com/vshaxe/haxe-language-server" }).with_receipt() + ctx.spawn.npm { "install" } + npm.exec { "lix", "run", "vshaxe-build", "-t", "language-server" } + end, default_options = { cmd = { "node", path.concat { root_dir, "bin", "server.js" } }, }, diff --git a/lua/nvim-lsp-installer/servers/jdtls/init.lua b/lua/nvim-lsp-installer/servers/jdtls/init.lua index 6acc4995..1e466c85 100644 --- a/lua/nvim-lsp-installer/servers/jdtls/init.lua +++ b/lua/nvim-lsp-installer/servers/jdtls/init.lua @@ -1,4 +1,5 @@ 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" @@ -61,12 +62,12 @@ return function(name, root_dir) callback(true) return end - eclipse.fetch_latest_jdtls_version(function(err, latest_version) - if err then + 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 + ctx.requested_server_version = latest_version:get_or_nil() callback(true) end end) diff --git a/lua/nvim-lsp-installer/servers/jsonnet_ls/init.lua b/lua/nvim-lsp-installer/servers/jsonnet_ls/init.lua index 0acbe9d4..7a20d8c7 100644 --- a/lua/nvim-lsp-installer/servers/jsonnet_ls/init.lua +++ b/lua/nvim-lsp-installer/servers/jsonnet_ls/init.lua @@ -1,12 +1,13 @@ -local server = require "nvim-lsp-installer.server" -local go = require "nvim-lsp-installer.installers.go" local path = require "nvim-lsp-installer.path" +local server = require "nvim-lsp-installer.server" +local go = require "nvim-lsp-installer.core.managers.go" return function(name, root_dir) return server.Server:new { name = name, root_dir = root_dir, homepage = "https://github.com/grafana/jsonnet-language-server", + async = true, installer = go.packages { "github.com/grafana/jsonnet-language-server" }, default_options = { -- TODO: use env instead of cmd once https://github.com/neovim/nvim-lspconfig/pull/1559 is merged diff --git a/lua/nvim-lsp-installer/servers/mm0_ls/init.lua b/lua/nvim-lsp-installer/servers/mm0_ls/init.lua index 14ec1bc9..a50c7879 100644 --- a/lua/nvim-lsp-installer/servers/mm0_ls/init.lua +++ b/lua/nvim-lsp-installer/servers/mm0_ls/init.lua @@ -1,8 +1,7 @@ local server = require "nvim-lsp-installer.server" -local std = require "nvim-lsp-installer.installers.std" -local context = require "nvim-lsp-installer.installers.context" local path = require "nvim-lsp-installer.path" local process = require "nvim-lsp-installer.process" +local git = require "nvim-lsp-installer.core.managers.git" return function(name, root_dir) return server.Server:new { @@ -10,20 +9,13 @@ return function(name, root_dir) root_dir = root_dir, languages = { "metamath-zero" }, homepage = "https://github.com/digama0/mm0", - installer = { - std.git_clone "https://github.com/digama0/mm0", - ---@type ServerInstallerFunction - function(_, callback, ctx) - process.spawn("cargo", { - args = { "build", "--release" }, - cwd = path.concat { ctx.install_dir, "mm0-rs" }, - stdio_sink = ctx.stdio_sink, - }, callback) - end, - context.receipt(function(receipt) - receipt:with_primary_source(receipt.git_remote "https://github.com/digama0/mm0") - end), - }, + async = true, + ---@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") + end, default_options = { cmd_env = { PATH = process.extend_path { path.concat { root_dir, "mm0-rs", "target", "release" } }, diff --git a/lua/nvim-lsp-installer/servers/nimls/init.lua b/lua/nvim-lsp-installer/servers/nimls/init.lua index b554f1d8..e92a891a 100644 --- a/lua/nvim-lsp-installer/servers/nimls/init.lua +++ b/lua/nvim-lsp-installer/servers/nimls/init.lua @@ -1,8 +1,6 @@ local server = require "nvim-lsp-installer.server" -local std = require "nvim-lsp-installer.installers.std" local process = require "nvim-lsp-installer.process" -local path = require "nvim-lsp-installer.path" -local context = require "nvim-lsp-installer.installers.context" +local git = require "nvim-lsp-installer.core.managers.git" return function(name, root_dir) return server.Server:new { @@ -10,19 +8,12 @@ return function(name, root_dir) root_dir = root_dir, homepage = "https://github.com/PMunch/nimlsp", languages = { "nim" }, - installer = { - std.git_clone "https://github.com/PMunch/nimlsp.git", - function(_, callback, ctx) - process.spawn("nimble", { - args = { "build", "-y", "--localdeps" }, - cwd = ctx.install_dir, - stdio_sink = ctx.stdio_sink, - }, callback) - end, - context.receipt(function(receipt) - receipt:with_primary_source(receipt.git_remote "https://github.com/PMunch/nimlsp.git") - end), - }, + async = true, + ---@param ctx InstallContext + installer = function(ctx) + git.clone({ "https://github.com/PMunch/nimlsp.git" }).with_receipt() + ctx.spawn.nimble { "build", "-y", "--localdeps" } + end, default_options = { cmd_env = { PATH = process.extend_path { root_dir }, diff --git a/lua/nvim-lsp-installer/servers/scry/init.lua b/lua/nvim-lsp-installer/servers/scry/init.lua index 8c092ad2..43a2ccd6 100644 --- a/lua/nvim-lsp-installer/servers/scry/init.lua +++ b/lua/nvim-lsp-installer/servers/scry/init.lua @@ -1,8 +1,8 @@ local server = require "nvim-lsp-installer.server" -local std = require "nvim-lsp-installer.installers.std" local process = require "nvim-lsp-installer.process" local path = require "nvim-lsp-installer.path" -local context = require "nvim-lsp-installer.installers.context" +local std = require "nvim-lsp-installer.core.managers.std" +local git = require "nvim-lsp-installer.core.managers.git" return function(name, root_dir) return server.Server:new { @@ -10,30 +10,18 @@ return function(name, root_dir) root_dir = root_dir, languages = { "crystal" }, homepage = "https://github.com/crystal-lang-tools/scry", - installer = { - std.ensure_executables { - { - "crystal", - "crystal was not found in path. Refer to https://crystal-lang.org/install/ for installation instructions.", - }, - { - "shards", - "shards was not found in path. Refer to https://crystal-lang.org/install/ for installation instructions.", - }, - }, - std.git_clone "https://github.com/crystal-lang-tools/scry.git", - ---@type ServerInstallerFunction - function(_, callback, ctx) - process.spawn("shards", { - args = { "build", "--verbose", "--release" }, - cwd = ctx.install_dir, - stdio_sink = ctx.stdio_sink, - }, callback) - end, - context.receipt(function(receipt) - receipt:with_primary_source(receipt.git_remote "https://github.com/crystal-lang-tools/scry.git") - end), - }, + async = true, + ---@param ctx InstallContext + installer = function(ctx) + std.ensure_executable("crystal", { + help_url = "https://crystal-lang.org/install/", + }) + std.ensure_executable("shards", { + help_url = "https://crystal-lang.org/install/", + }) + git.clone({ "https://github.com/crystal-lang-tools/scry.git" }).with_receipt() + ctx.spawn.shards { "build", "--verbose", "--release" } + end, default_options = { cmd_env = { PATH = process.extend_path { path.concat { root_dir, "bin" } }, diff --git a/lua/nvim-lsp-installer/servers/solargraph/init.lua b/lua/nvim-lsp-installer/servers/solargraph/init.lua index d0b44450..e03a29f1 100644 --- a/lua/nvim-lsp-installer/servers/solargraph/init.lua +++ b/lua/nvim-lsp-installer/servers/solargraph/init.lua @@ -1,5 +1,5 @@ local server = require "nvim-lsp-installer.server" -local gem = require "nvim-lsp-installer.installers.gem" +local gem = require "nvim-lsp-installer.core.managers.gem" return function(name, root_dir) return server.Server:new { @@ -7,6 +7,7 @@ return function(name, root_dir) root_dir = root_dir, languages = { "ruby" }, homepage = "https://solargraph.org", + async = true, installer = gem.packages { "solargraph" }, default_options = { cmd_env = gem.env(root_dir), diff --git a/lua/nvim-lsp-installer/servers/sorbet/init.lua b/lua/nvim-lsp-installer/servers/sorbet/init.lua index bb5f97bb..3b0ab025 100644 --- a/lua/nvim-lsp-installer/servers/sorbet/init.lua +++ b/lua/nvim-lsp-installer/servers/sorbet/init.lua @@ -1,5 +1,5 @@ local server = require "nvim-lsp-installer.server" -local gem = require "nvim-lsp-installer.installers.gem" +local gem = require "nvim-lsp-installer.core.managers.gem" return function(name, root_dir) return server.Server:new { @@ -7,6 +7,7 @@ return function(name, root_dir) root_dir = root_dir, homepage = "https://sorbet.org/", languages = { "ruby" }, + async = true, installer = gem.packages { "sorbet" }, default_options = { cmd_env = gem.env(root_dir), diff --git a/lua/nvim-lsp-installer/servers/sourcekit/init.lua b/lua/nvim-lsp-installer/servers/sourcekit/init.lua index b7f3d3a1..d55148b5 100644 --- a/lua/nvim-lsp-installer/servers/sourcekit/init.lua +++ b/lua/nvim-lsp-installer/servers/sourcekit/init.lua @@ -1,6 +1,5 @@ local server = require "nvim-lsp-installer.server" -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" return function(name, root_dir) return server.Server:new { @@ -8,17 +7,8 @@ return function(name, root_dir) root_dir = root_dir, homepage = "https://github.com/apple/sourcekit-lsp", languages = { "swift" }, - installer = { - std.ensure_executables { - { - "sourcekit-lsp", - "sourcekit-lsp was not found in path. Refer to https://github.com/apple/sourcekit-lsp for installation instructions.", - }, - }, - context.receipt(function(receipt) - receipt:with_primary_source(receipt.system "sourcekit-lsp") - end), - }, + async = true, + installer = std.system_executable("sourcekit-lsp", { help_url = "https://github.com/apple/sourcekit-lsp" }), default_options = {}, } end diff --git a/lua/nvim-lsp-installer/servers/sourcery/init.lua b/lua/nvim-lsp-installer/servers/sourcery/init.lua index 487f97d5..c4efeaf6 100644 --- a/lua/nvim-lsp-installer/servers/sourcery/init.lua +++ b/lua/nvim-lsp-installer/servers/sourcery/init.lua @@ -1,5 +1,5 @@ local server = require "nvim-lsp-installer.server" -local pip3 = require "nvim-lsp-installer.installers.pip3" +local pip3 = require "nvim-lsp-installer.core.managers.pip3" return function(name, root_dir) return server.Server:new { @@ -7,6 +7,7 @@ return function(name, root_dir) root_dir = root_dir, languages = { "python" }, homepage = "https://docs.sourcery.ai/", + async = true, installer = pip3.packages { "sourcery-cli" }, default_options = { cmd_env = pip3.env(root_dir), diff --git a/lua/nvim-lsp-installer/servers/spectral/init.lua b/lua/nvim-lsp-installer/servers/spectral/init.lua index e308369c..61047942 100644 --- a/lua/nvim-lsp-installer/servers/spectral/init.lua +++ b/lua/nvim-lsp-installer/servers/spectral/init.lua @@ -1,9 +1,7 @@ local server = require "nvim-lsp-installer.server" -local npm = require "nvim-lsp-installer.installers.npm" -local std = require "nvim-lsp-installer.installers.std" -local installers = require "nvim-lsp-installer.installers" -local context = require "nvim-lsp-installer.installers.context" local path = require "nvim-lsp-installer.path" +local git = require "nvim-lsp-installer.core.managers.git" +local npm = require "nvim-lsp-installer.core.managers.npm" return function(name, root_dir) return server.Server:new { @@ -11,21 +9,19 @@ return function(name, root_dir) root_dir = root_dir, languages = { "openapi", "asyncapi" }, homepage = "https://stoplight.io/open-source/spectral/", - installer = { - std.git_clone "https://github.com/stoplightio/vscode-spectral", - npm.install(), - installers.branch_context { - context.set_working_dir "server", - npm.install(), - }, - installers.always_succeed(npm.run "compile"), - context.set_working_dir "server", - context.receipt(function(receipt, 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. - :with_primary_source(receipt.git_remote "https://github.com/stoplightio/vscode-spectral") - end), - }, + async = true, + ---@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 } + 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. + end, default_options = { cmd = { "node", path.concat { root_dir, "out", "server.js" }, "--stdio" }, }, diff --git a/lua/nvim-lsp-installer/servers/sqls/init.lua b/lua/nvim-lsp-installer/servers/sqls/init.lua index 40a11d67..9cad121b 100644 --- a/lua/nvim-lsp-installer/servers/sqls/init.lua +++ b/lua/nvim-lsp-installer/servers/sqls/init.lua @@ -1,5 +1,5 @@ local server = require "nvim-lsp-installer.server" -local go = require "nvim-lsp-installer.installers.go" +local go = require "nvim-lsp-installer.core.managers.go" return function(name, root_dir) return server.Server:new { @@ -7,6 +7,7 @@ return function(name, root_dir) root_dir = root_dir, languages = { "sql" }, homepage = "https://github.com/lighttiger2505/sqls", + async = true, installer = go.packages { "github.com/lighttiger2505/sqls" }, default_options = { cmd_env = go.env(root_dir), diff --git a/lua/nvim-lsp-installer/servers/theme_check/init.lua b/lua/nvim-lsp-installer/servers/theme_check/init.lua index 7bd9ddc9..e2f402e5 100644 --- a/lua/nvim-lsp-installer/servers/theme_check/init.lua +++ b/lua/nvim-lsp-installer/servers/theme_check/init.lua @@ -1,5 +1,5 @@ local server = require "nvim-lsp-installer.server" -local gem = require "nvim-lsp-installer.installers.gem" +local gem = require "nvim-lsp-installer.core.managers.gem" return function(name, root_dir) return server.Server:new { @@ -7,6 +7,7 @@ return function(name, root_dir) root_dir = root_dir, languages = { "liquid" }, homepage = "https://github.com/Shopify/theme-check", + async = true, installer = gem.packages { "theme-check" }, default_options = { cmd_env = gem.env(root_dir), |
