aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-05-17 14:37:13 +0200
committerGitHub <noreply@github.com>2021-05-17 14:37:13 +0200
commitae93866358777fcf6766152dd55980c4778f4c59 (patch)
treea1b36ba2e2aa09688c4cb96b645b03c34b728042 /lua
parentremove :LspInstallAll (diff)
downloadmason-ae93866358777fcf6766152dd55980c4778f4c59.tar
mason-ae93866358777fcf6766152dd55980c4778f4c59.tar.gz
mason-ae93866358777fcf6766152dd55980c4778f4c59.tar.bz2
mason-ae93866358777fcf6766152dd55980c4778f4c59.tar.lz
mason-ae93866358777fcf6766152dd55980c4778f4c59.tar.xz
mason-ae93866358777fcf6766152dd55980c4778f4c59.tar.zst
mason-ae93866358777fcf6766152dd55980c4778f4c59.zip
add support for zx install scripts (#13)
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-lsp-installer/fs.lua42
-rw-r--r--lua/nvim-lsp-installer/installers/npm.lua9
-rw-r--r--lua/nvim-lsp-installer/installers/shell.lua20
-rw-r--r--lua/nvim-lsp-installer/installers/zx.lua62
-rw-r--r--lua/nvim-lsp-installer/path.lua38
-rw-r--r--lua/nvim-lsp-installer/server.lua67
-rw-r--r--lua/nvim-lsp-installer/servers/bashls.lua12
-rw-r--r--lua/nvim-lsp-installer/servers/bashls/init.lua14
-rw-r--r--lua/nvim-lsp-installer/servers/clangd.lua28
-rw-r--r--lua/nvim-lsp-installer/servers/clangd/init.lua14
-rw-r--r--lua/nvim-lsp-installer/servers/clangd/install.mjs20
-rw-r--r--lua/nvim-lsp-installer/servers/cssls.lua12
-rw-r--r--lua/nvim-lsp-installer/servers/cssls/init.lua14
-rw-r--r--lua/nvim-lsp-installer/servers/denols/init.lua (renamed from lua/nvim-lsp-installer/servers/denols.lua)6
-rw-r--r--lua/nvim-lsp-installer/servers/dockerls.lua12
-rw-r--r--lua/nvim-lsp-installer/servers/dockerls/init.lua14
-rw-r--r--lua/nvim-lsp-installer/servers/eslintls/init.lua (renamed from lua/nvim-lsp-installer/servers/eslintls.lua)20
-rw-r--r--lua/nvim-lsp-installer/servers/gopls/init.lua (renamed from lua/nvim-lsp-installer/servers/gopls.lua)12
-rw-r--r--lua/nvim-lsp-installer/servers/graphql.lua16
-rw-r--r--lua/nvim-lsp-installer/servers/graphql/init.lua18
-rw-r--r--lua/nvim-lsp-installer/servers/html.lua12
-rw-r--r--lua/nvim-lsp-installer/servers/html/init.lua14
-rw-r--r--lua/nvim-lsp-installer/servers/jsonls.lua12
-rw-r--r--lua/nvim-lsp-installer/servers/jsonls/init.lua14
-rw-r--r--lua/nvim-lsp-installer/servers/pyright.lua13
-rw-r--r--lua/nvim-lsp-installer/servers/pyright/init.lua15
-rw-r--r--lua/nvim-lsp-installer/servers/solargraph.lua34
-rw-r--r--lua/nvim-lsp-installer/servers/solargraph/init.lua19
-rw-r--r--lua/nvim-lsp-installer/servers/solargraph/install.mjs14
-rw-r--r--lua/nvim-lsp-installer/servers/sumneko_lua.lua57
-rw-r--r--lua/nvim-lsp-installer/servers/sumneko_lua/init.lua41
-rw-r--r--lua/nvim-lsp-installer/servers/sumneko_lua/install.mjs21
-rw-r--r--lua/nvim-lsp-installer/servers/texlab.lua33
-rw-r--r--lua/nvim-lsp-installer/servers/texlab/init.lua21
-rw-r--r--lua/nvim-lsp-installer/servers/texlab/install.mjs21
-rw-r--r--lua/nvim-lsp-installer/servers/tsserver.lua12
-rw-r--r--lua/nvim-lsp-installer/servers/tsserver/init.lua14
-rw-r--r--lua/nvim-lsp-installer/servers/vimls.lua12
-rw-r--r--lua/nvim-lsp-installer/servers/vimls/init.lua14
-rw-r--r--lua/nvim-lsp-installer/servers/vuels.lua14
-rw-r--r--lua/nvim-lsp-installer/servers/vuels/init.lua14
-rw-r--r--lua/nvim-lsp-installer/servers/yamlls.lua12
-rw-r--r--lua/nvim-lsp-installer/servers/yamlls/init.lua14
43 files changed, 546 insertions, 351 deletions
diff --git a/lua/nvim-lsp-installer/fs.lua b/lua/nvim-lsp-installer/fs.lua
new file mode 100644
index 00000000..31bc4044
--- /dev/null
+++ b/lua/nvim-lsp-installer/fs.lua
@@ -0,0 +1,42 @@
+local uv = vim.loop
+local M = {}
+
+local function escape_quotes(str)
+ return string.format("%q", str)
+end
+
+function M.mkdirp(path)
+ if os.execute("mkdir -p " .. escape_quotes(path)) ~= 0 then
+ error(("mkdirp: Could not create directory %s"):format(path))
+ end
+end
+
+function M.dir_exists(path)
+ local ok, stat = pcall(M.fstat, path)
+ if not ok then
+ return false
+ end
+ return stat.type == "directory"
+end
+
+function M.file_exists(path)
+ local ok, stat = pcall(M.fstat, path)
+ if not ok then
+ return false
+ end
+ return stat.type == "file"
+end
+
+function M.fstat(path)
+ local fd = assert(uv.fs_open(path, "r", 438))
+ return assert(uv.fs_fstat(fd))
+end
+
+function M.rmrf(path)
+ -- giggity
+ if os.execute("rm -rf " .. escape_quotes(path)) ~= 0 then
+ error(("Could not remove LSP server directory %s"):format(path))
+ end
+end
+
+return M
diff --git a/lua/nvim-lsp-installer/installers/npm.lua b/lua/nvim-lsp-installer/installers/npm.lua
new file mode 100644
index 00000000..54e71d12
--- /dev/null
+++ b/lua/nvim-lsp-installer/installers/npm.lua
@@ -0,0 +1,9 @@
+local shell = require("nvim-lsp-installer.installers.shell")
+
+local M = {}
+
+function M.packages(packages)
+ return shell.raw(("npm install %s"):format(table.concat(packages, " ")))
+end
+
+return M
diff --git a/lua/nvim-lsp-installer/installers/shell.lua b/lua/nvim-lsp-installer/installers/shell.lua
new file mode 100644
index 00000000..e169d184
--- /dev/null
+++ b/lua/nvim-lsp-installer/installers/shell.lua
@@ -0,0 +1,20 @@
+local M = {}
+
+function M.raw(raw_script)
+ return function (server, on_exit)
+ local shell = vim.o.shell
+ vim.o.shell = "/bin/bash"
+ vim.cmd [[new]]
+ vim.fn.termopen(
+ "set -e;\n" .. raw_script,
+ {
+ cwd = server._root_dir,
+ on_exit = on_exit
+ }
+ )
+ vim.o.shell = shell
+ vim.cmd([[startinsert]]) -- so that the buffer tails the term log nicely
+ end
+end
+
+return M
diff --git a/lua/nvim-lsp-installer/installers/zx.lua b/lua/nvim-lsp-installer/installers/zx.lua
new file mode 100644
index 00000000..20ee9bb1
--- /dev/null
+++ b/lua/nvim-lsp-installer/installers/zx.lua
@@ -0,0 +1,62 @@
+local fs = require("nvim-lsp-installer.fs")
+local path = require("nvim-lsp-installer.path")
+
+local uv = vim.loop
+
+local M = {}
+
+local INSTALL_DIR = path.concat { vim.fn.stdpath("data"), "lsp_servers", ".zx" }
+local ZX_EXECUTABLE = path.concat { INSTALL_DIR, "node_modules", ".bin", "zx" }
+
+local has_installed_zx = false
+
+function M.install_zx(callback, force)
+ force = force or false -- be careful with boolean logic if flipping this
+
+ if has_installed_zx and not force then
+ callback()
+ return
+ end
+
+ if vim.fn.executable("npm") ~= 1 or vim.fn.executable("node") ~= 1 then
+ error("Cannot install zx because npm and/or node not installed.")
+ end
+
+ local is_zx_already_installed = fs.file_exists(ZX_EXECUTABLE)
+ local npm_command = is_zx_already_installed and "update" or "install"
+
+ print(("Preparing for :LspInstall, please wait… ($ npm %s zx)"):format(npm_command))
+
+ fs.mkdirp(INSTALL_DIR)
+
+ uv.spawn("npm", {
+ args = { npm_command, "zx" },
+ cwd = INSTALL_DIR,
+ }, vim.schedule_wrap(function (code)
+ if code ~= 0 then
+ error("Failed to install zx.")
+ end
+ has_installed_zx = true
+ vim.cmd [[ echon "" ]] -- clear the previously printed feedback message… ¯\_(ツ)_/¯
+ callback()
+ end))
+end
+
+function M.file(relpath)
+ local script_path = path.realpath(relpath, 3)
+ return function (server, on_exit)
+ M.install_zx(function ()
+ vim.cmd [[new]]
+ vim.fn.termopen(("set -e; %q %q"):format(
+ ZX_EXECUTABLE,
+ script_path
+ ), {
+ cwd = server._root_dir,
+ on_exit = on_exit
+ })
+ vim.cmd [[startinsert]] -- so that the buffer tails the term log nicely
+ end, false)
+ end
+end
+
+return M
diff --git a/lua/nvim-lsp-installer/path.lua b/lua/nvim-lsp-installer/path.lua
new file mode 100644
index 00000000..294d45e5
--- /dev/null
+++ b/lua/nvim-lsp-installer/path.lua
@@ -0,0 +1,38 @@
+local uv = vim.loop
+
+local sep = (function()
+---@diagnostic disable-next-line: undefined-global
+ if jit then
+---@diagnostic disable-next-line: undefined-global
+ local os = string.lower(jit.os)
+ if os == "linux" or os == "osx" or os == "bsd" then
+ return "/"
+ else
+ return "\\"
+ end
+ else
+ return package.config:sub(1, 1)
+ end
+end)()
+
+local M = {}
+
+function M.cwd()
+ return uv.fs_realpath(".")
+end
+
+function M.concat(path_components)
+ return table.concat(path_components, sep)
+end
+
+-- @param relpath string The relative path to get the realpath(1) to.
+-- @param depth number The depth in the call stack to introspect. This effectively controls which stack frame should be used when producing the realpath.
+-- The file of the elected stack frame will be used as the "starting point" for the provided relpath.
+--
+-- @return The realpath (absolute path). Note that this will currently produce results such as /Users/zuck/./script.js which may not be compatible with some tools.
+function M.realpath(relpath, depth)
+ local callsite_abs_path = debug.getinfo(depth or 2, "S").source:sub(2)
+ return M.concat { vim.fn.fnamemodify(callsite_abs_path, ":h"), relpath }
+end
+
+return M
diff --git a/lua/nvim-lsp-installer/server.lua b/lua/nvim-lsp-installer/server.lua
index 00ed42da..a500441f 100644
--- a/lua/nvim-lsp-installer/server.lua
+++ b/lua/nvim-lsp-installer/server.lua
@@ -1,3 +1,6 @@
+local fs = require("nvim-lsp-installer.fs")
+local path = require("nvim-lsp-installer.path")
+
local M = {}
-- :'<,'>!sort
@@ -21,12 +24,8 @@ local _SERVERS = {
"yamlls",
}
-local function escape_quotes(str)
- return string.format("%q", str)
-end
-
local function get_server(server_name)
- return pcall(require, 'nvim-lsp-installer.servers.' .. server_name)
+ return pcall(require, ("nvim-lsp-installer.servers.%s"):format(server_name))
end
local function get_servers(server_names)
@@ -34,7 +33,7 @@ local function get_servers(server_names)
for _, server_name in pairs(server_names) do
local ok, server = get_server(server_name)
if not ok then
- vim.api.nvim_err_writeln("Unable to find LSP server " .. server_name)
+ vim.api.nvim_err_writeln(("Unable to find LSP server %s. Error=%s"):format(server_name, server))
goto continue
end
result[server_name] = server
@@ -68,30 +67,30 @@ end
function M.install(server_name)
local ok, server = get_server(server_name)
if not ok then
- return vim.api.nvim_err_writeln("Unable to find LSP server " .. server_name)
+ return vim.api.nvim_err_writeln(("Unable to find LSP server %s. Error=%s"):format(server_name, server))
end
local success, error = pcall(server.install, server)
if not success then
pcall(server.uninstall, server)
- return vim.api.nvim_err_writeln("Failed to install " .. server_name .. ". Error=" .. vim.inspect(error))
+ return vim.api.nvim_err_writeln(("Failed to install %s. Error=%s"):format(server_name, vim.inspect(error)))
end
end
function M.uninstall(server_name)
local ok, server = get_server(server_name)
if not ok then
- return vim.api.nvim_err_writeln("Unable to find LSP server " .. server_name)
+ return vim.api.nvim_err_writeln(("Unable to find LSP server %s. Error=%s"):format(server_name, server))
end
local success, error = pcall(server.uninstall, server)
if not success then
- vim.api.nvim_err_writeln('Unable to uninstall ' .. server_name .. '. Error=' .. vim.inspect(error))
+ vim.api.nvim_err_writeln(("Unable to uninstall %s. Error=%s"):format(server_name, vim.inspect(error)))
return success
end
- print("Successfully uninstalled " .. server_name)
+ print(("Successfully uninstalled %s"):format(server_name))
end
function M.get_server_root_path(server)
- return vim.fn.stdpath('data') .. "/lsp_servers/" .. server
+ return path.concat { vim.fn.stdpath("data"), "lsp_servers", server }
end
M.Server = {}
@@ -124,19 +123,17 @@ function M.Server:setup(opts)
-- We require the lspconfig server here in order to do it as late as possible.
-- The reason for this is because once a lspconfig server has been imported, it's
-- automatically registered with lspconfig and causes it to show up in :LspInfo and whatnot.
- require'lspconfig'[self.name].setup(
- vim.tbl_deep_extend('force', self._default_options, opts)
+ require("lspconfig")[self.name].setup(
+ vim.tbl_deep_extend("force", self._default_options, opts)
)
end
function M.Server:is_installed()
- return os.execute('test -d ' .. escape_quotes(self._root_dir)) == 0
+ return fs.dir_exists(self._root_dir)
end
function M.Server:create_root_dir()
- if os.execute('mkdir -p ' .. escape_quotes(self._root_dir)) ~= 0 then
- error('Could not create LSP server directory ' .. self._root_dir)
- end
+ fs.mkdirp(self._root_dir)
end
function M.Server:install()
@@ -151,34 +148,18 @@ function M.Server:install()
self:create_root_dir()
- local shell = vim.o.shell
- vim.o.shell = '/bin/bash'
- vim.cmd [[new]]
- vim.fn.termopen(
- 'set -e;\n' .. self._install_cmd,
- {
- cwd = self._root_dir,
- on_exit = function (_, exit_code)
- if exit_code ~= 0 then
- vim.api.nvim_err_writeln("Server installation failed for " .. self.name .. ". Exit code: " .. exit_code)
- pcall(self.uninstall, self)
- else
- print("Successfully installed " .. self.name)
- end
-
- end
- }
- )
- vim.o.shell = shell
- vim.cmd([[startinsert]]) -- so that the buffer tails the term log nicely
+ self._install_cmd(self, function (_, exit_code)
+ if exit_code ~= 0 then
+ vim.api.nvim_err_writeln(("Server installation failed for %s. Exit code: %d"):format(self.name, exit_code))
+ pcall(self.uninstall, self)
+ else
+ print(("Successfully installed %s"):format(self.name))
+ end
+ end)
end
function M.Server:uninstall()
- -- giggity
- if os.execute('rm -rf ' .. escape_quotes(self._root_dir)) ~= 0 then
- error('Could not remove LSP server directory ' .. self._root_dir)
- end
-
+ fs.rmrf(self._root_dir)
end
return M
diff --git a/lua/nvim-lsp-installer/servers/bashls.lua b/lua/nvim-lsp-installer/servers/bashls.lua
deleted file mode 100644
index 224e8d23..00000000
--- a/lua/nvim-lsp-installer/servers/bashls.lua
+++ /dev/null
@@ -1,12 +0,0 @@
-local server = require('nvim-lsp-installer.server')
-
-local root_dir = server.get_server_root_path('bash')
-
-return server.Server:new {
- name = "bashls",
- root_dir = root_dir,
- install_cmd = [[npm install bash-language-server@latest]],
- default_options = {
- cmd = { root_dir .. "/node_modules/.bin/bash-language-server", "start" },
- },
-}
diff --git a/lua/nvim-lsp-installer/servers/bashls/init.lua b/lua/nvim-lsp-installer/servers/bashls/init.lua
new file mode 100644
index 00000000..323485e8
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/bashls/init.lua
@@ -0,0 +1,14 @@
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local npm = require("nvim-lsp-installer.installers.npm")
+
+local root_dir = server.get_server_root_path("bash")
+
+return server.Server:new {
+ name = "bashls",
+ root_dir = root_dir,
+ install_cmd = npm.packages { "bash-language-server@latest" },
+ default_options = {
+ cmd = { path.concat { root_dir, "node_modules", ".bin", "bash-language-server" }, "start" },
+ },
+}
diff --git a/lua/nvim-lsp-installer/servers/clangd.lua b/lua/nvim-lsp-installer/servers/clangd.lua
deleted file mode 100644
index 45e49d2b..00000000
--- a/lua/nvim-lsp-installer/servers/clangd.lua
+++ /dev/null
@@ -1,28 +0,0 @@
-local server = require('nvim-lsp-installer.server')
-
-local root_dir = server.get_server_root_path('c-family')
-
-local install_cmd = [=[
-if [[ $(uname) == Linux ]]; then
- wget -O clangd.zip https://github.com/clangd/clangd/releases/download/11.0.0/clangd-linux-11.0.0.zip;
-elif [[ $(uname) == Darwin ]]; then
- wget -O clangd.zip https://github.com/clangd/clangd/releases/download/11.0.0/clangd-mac-11.0.0.zip;
-else
- >&2 echo "$(uname) not supported.";
- exit 1;
-fi
-
-unzip clangd.zip;
-rm clangd.zip;
-mv clangd_11.0.0 clangd;
-
-]=]
-
-return server.Server:new {
- name = "clangd",
- root_dir = root_dir,
- install_cmd = install_cmd,
- default_options = {
- cmd = { root_dir .. '/clangd/bin/clangd'},
- }
-}
diff --git a/lua/nvim-lsp-installer/servers/clangd/init.lua b/lua/nvim-lsp-installer/servers/clangd/init.lua
new file mode 100644
index 00000000..b3a12ad2
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/clangd/init.lua
@@ -0,0 +1,14 @@
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local zx = require("nvim-lsp-installer.installers.zx")
+
+local root_dir = server.get_server_root_path("c-family")
+
+return server.Server:new {
+ name = "clangd",
+ root_dir = root_dir,
+ install_cmd = zx.file("./install.mjs"),
+ default_options = {
+ cmd = { path.concat { root_dir, "clangd", "bin", "clangd" } },
+ }
+}
diff --git a/lua/nvim-lsp-installer/servers/clangd/install.mjs b/lua/nvim-lsp-installer/servers/clangd/install.mjs
new file mode 100644
index 00000000..4b75c3f5
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/clangd/install.mjs
@@ -0,0 +1,20 @@
+const VERSION = "11.0.0";
+
+const target = (() => {
+ const platform = os.platform();
+ switch (platform) {
+ case "darwin":
+ return `https://github.com/clangd/clangd/releases/download/${VERSION}/clangd-mac-${VERSION}.zip`;
+ case "win32": {
+ console.error(chalk.red(`${platform} is not yet supported.`));
+ process.exit(1);
+ }
+ default:
+ return `https://github.com/clangd/clangd/releases/download/${VERSION}/clangd-linux-${VERSION}.zip`;
+ }
+})();
+
+await $`wget -O clangd.zip ${target}`;
+await $`unzip clangd.zip`;
+await $`rm clangd.zip`;
+await $`mv clangd_${VERSION} clangd`;
diff --git a/lua/nvim-lsp-installer/servers/cssls.lua b/lua/nvim-lsp-installer/servers/cssls.lua
deleted file mode 100644
index 53bb6378..00000000
--- a/lua/nvim-lsp-installer/servers/cssls.lua
+++ /dev/null
@@ -1,12 +0,0 @@
-local server = require('nvim-lsp-installer.server')
-
-local root_dir = server.get_server_root_path('css')
-
-return server.Server:new {
- name = 'cssls',
- root_dir = root_dir,
- install_cmd = [[npm install vscode-css-languageserver-bin]],
- default_options = {
- cmd = { root_dir .. '/node_modules/.bin/css-languageserver', '--stdio' },
- },
-}
diff --git a/lua/nvim-lsp-installer/servers/cssls/init.lua b/lua/nvim-lsp-installer/servers/cssls/init.lua
new file mode 100644
index 00000000..86b9e1f6
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/cssls/init.lua
@@ -0,0 +1,14 @@
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local npm = require("nvim-lsp-installer.installers.npm")
+
+local root_dir = server.get_server_root_path("css")
+
+return server.Server:new {
+ name = "cssls",
+ root_dir = root_dir,
+ install_cmd = npm.packages { "vscode-css-languageserver-bin" },
+ default_options = {
+ cmd = { path.concat { root_dir, "node_modules", ".bin", "css-languageserver" }, "--stdio" },
+ },
+}
diff --git a/lua/nvim-lsp-installer/servers/denols.lua b/lua/nvim-lsp-installer/servers/denols/init.lua
index 7aa2a9b9..e7415201 100644
--- a/lua/nvim-lsp-installer/servers/denols.lua
+++ b/lua/nvim-lsp-installer/servers/denols/init.lua
@@ -1,4 +1,6 @@
local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local shell = require("nvim-lsp-installer.installers.shell")
local root_dir = server.get_server_root_path("denols")
@@ -10,8 +12,8 @@ curl -fsSL https://deno.land/x/install/install.sh | sh
return server.Server:new {
name = "denols",
root_dir = root_dir,
- install_cmd = install_cmd,
+ install_cmd = shell.raw(install_cmd),
default_options = {
- cmd = { root_dir .. "/bin/deno", "lsp" },
+ cmd = { path.concat { root_dir, "bin", "deno" }, "lsp" },
},
}
diff --git a/lua/nvim-lsp-installer/servers/dockerls.lua b/lua/nvim-lsp-installer/servers/dockerls.lua
deleted file mode 100644
index dbe4645e..00000000
--- a/lua/nvim-lsp-installer/servers/dockerls.lua
+++ /dev/null
@@ -1,12 +0,0 @@
-local server = require('nvim-lsp-installer.server')
-
-local root_dir = server.get_server_root_path('dockerfile')
-
-return server.Server:new {
- name = 'dockerls',
- root_dir = root_dir,
- install_cmd = [[npm install dockerfile-language-server-nodejs@latest]],
- default_options = {
- cmd = { root_dir .. '/node_modules/.bin/docker-langserver', '--stdio' },
- },
-}
diff --git a/lua/nvim-lsp-installer/servers/dockerls/init.lua b/lua/nvim-lsp-installer/servers/dockerls/init.lua
new file mode 100644
index 00000000..2a4b3e81
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/dockerls/init.lua
@@ -0,0 +1,14 @@
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local npm = require("nvim-lsp-installer.installers.npm")
+
+local root_dir = server.get_server_root_path("dockerfile")
+
+return server.Server:new {
+ name = "dockerls",
+ root_dir = root_dir,
+ install_cmd = npm.packages { "dockerfile-language-server-nodejs@latest" },
+ default_options = {
+ cmd = { path.concat { root_dir, "node_modules", ".bin", "docker-langserver" }, "--stdio" },
+ },
+}
diff --git a/lua/nvim-lsp-installer/servers/eslintls.lua b/lua/nvim-lsp-installer/servers/eslintls/init.lua
index 26b5bba6..88f729f9 100644
--- a/lua/nvim-lsp-installer/servers/eslintls.lua
+++ b/lua/nvim-lsp-installer/servers/eslintls/init.lua
@@ -1,7 +1,9 @@
-local lspconfig = require'lspconfig'
-local configs = require'lspconfig/configs'
+local lspconfig = require("lspconfig")
+local configs = require("lspconfig/configs")
-local server = require'nvim-lsp-installer.server'
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local shell = require("nvim-lsp-installer.installers.shell")
configs.eslintls = {
default_config = {
@@ -50,7 +52,7 @@ local ConfirmExecutionResult = {
approved = 4
}
-local root_dir = server.get_server_root_path('eslint')
+local root_dir = server.get_server_root_path("eslint")
local install_cmd = [[
git clone https://github.com/microsoft/vscode-eslint .;
npm install;
@@ -62,9 +64,9 @@ npm install;
return server.Server:new {
name = "eslintls",
root_dir = root_dir,
- install_cmd = install_cmd,
+ install_cmd = shell.raw(install_cmd),
default_options = {
- cmd = {'node', root_dir .. '/server/out/eslintServer.js', '--stdio'},
+ cmd = { "node", path.concat { root_dir, "server", "out", "eslintServer.js" }, "--stdio" },
handlers = {
["eslint/openDoc"] = function (_, _, open_doc)
os.execute(string.format("open %q", open_doc.url))
@@ -76,15 +78,15 @@ return server.Server:new {
return ConfirmExecutionResult.approved
end,
["eslint/probeFailed"] = function ()
- vim.api.nvim_err_writeln('ESLint probe failed.')
+ vim.api.nvim_err_writeln("ESLint probe failed.")
return {id = nil, result = true}
end,
["eslint/noLibrary"] = function ()
- vim.api.nvim_err_writeln('Unable to find ESLint library.')
+ vim.api.nvim_err_writeln("Unable to find ESLint library.")
return {id = nil, result = true}
end,
["eslint/noConfig"] = function ()
- vim.api.nvim_err_writeln('Unable to find ESLint configuration.')
+ vim.api.nvim_err_writeln("Unable to find ESLint configuration.")
return {id = nil, result = true}
end,
},
diff --git a/lua/nvim-lsp-installer/servers/gopls.lua b/lua/nvim-lsp-installer/servers/gopls/init.lua
index f716d9c5..59113191 100644
--- a/lua/nvim-lsp-installer/servers/gopls.lua
+++ b/lua/nvim-lsp-installer/servers/gopls/init.lua
@@ -1,12 +1,12 @@
-local server = require('nvim-lsp-installer.server')
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local shell = require("nvim-lsp-installer.installers.shell")
-local root_dir = server.get_server_root_path('go')
+local root_dir = server.get_server_root_path("go")
local install_cmd = [=[
-
GO111MODULE=on GOBIN="$PWD" GOPATH="$PWD" go get golang.org/x/tools/gopls@latest;
command -v ./gopls &> /dev/null;
-
]=]
return server.Server:new {
@@ -17,8 +17,8 @@ return server.Server:new {
error("Please install the Go CLI before installing gopls (https://golang.org/doc/install).")
end
end,
- install_cmd = install_cmd,
+ install_cmd = shell.raw(install_cmd),
default_options = {
- cmd = {root_dir .. "/gopls"},
+ cmd = { path.concat { root_dir, "gopls" } },
}
}
diff --git a/lua/nvim-lsp-installer/servers/graphql.lua b/lua/nvim-lsp-installer/servers/graphql.lua
deleted file mode 100644
index 1728e81e..00000000
--- a/lua/nvim-lsp-installer/servers/graphql.lua
+++ /dev/null
@@ -1,16 +0,0 @@
-local util = require('lspconfig.util')
-
-local server = require('nvim-lsp-installer.server')
-
-local root_dir = server.get_server_root_path('graphql')
-
-return server.Server:new {
- name = "graphql",
- root_dir = root_dir,
- install_cmd = [[npm install graphql-language-service-cli@latest graphql]],
- default_options = {
- cmd = { root_dir .. "/node_modules/.bin/graphql-lsp", "server", "-m", "stream" },
- filetypes = { 'typescriptreact', 'javascriptreact', 'graphql' },
- root_dir = util.root_pattern('.git', '.graphqlrc'),
- },
-}
diff --git a/lua/nvim-lsp-installer/servers/graphql/init.lua b/lua/nvim-lsp-installer/servers/graphql/init.lua
new file mode 100644
index 00000000..279b6e25
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/graphql/init.lua
@@ -0,0 +1,18 @@
+local util = require("lspconfig.util")
+
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local npm = require("nvim-lsp-installer.installers.npm")
+
+local root_dir = server.get_server_root_path("graphql")
+
+return server.Server:new {
+ name = "graphql",
+ root_dir = root_dir,
+ install_cmd = npm.packages { "graphql-language-service-cli@latest", "graphql" },
+ default_options = {
+ cmd = { path.concat { root_dir, "node_modules", ".bin", "graphql-lsp" }, "server", "-m", "stream" },
+ filetypes = { "typescriptreact", "javascriptreact", "graphql" },
+ root_dir = util.root_pattern(".git", ".graphqlrc"),
+ },
+}
diff --git a/lua/nvim-lsp-installer/servers/html.lua b/lua/nvim-lsp-installer/servers/html.lua
deleted file mode 100644
index 36acc429..00000000
--- a/lua/nvim-lsp-installer/servers/html.lua
+++ /dev/null
@@ -1,12 +0,0 @@
-local server = require('nvim-lsp-installer.server')
-
-local root_dir = server.get_server_root_path('html')
-
-return server.Server:new {
- name = "html",
- root_dir = root_dir,
- install_cmd = [[npm install vscode-html-languageserver-bin]],
- default_options = {
- cmd = { root_dir .. '/node_modules/.bin/html-languageserver', '--stdio' },
- },
-}
diff --git a/lua/nvim-lsp-installer/servers/html/init.lua b/lua/nvim-lsp-installer/servers/html/init.lua
new file mode 100644
index 00000000..8038ea5e
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/html/init.lua
@@ -0,0 +1,14 @@
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local npm = require("nvim-lsp-installer.installers.npm")
+
+local root_dir = server.get_server_root_path("html")
+
+return server.Server:new {
+ name = "html",
+ root_dir = root_dir,
+ install_cmd = npm.packages { "vscode-html-languageserver-bin" },
+ default_options = {
+ cmd = { path.concat { root_dir, "node_modules", ".bin", "html-languageserver" }, "--stdio" },
+ },
+}
diff --git a/lua/nvim-lsp-installer/servers/jsonls.lua b/lua/nvim-lsp-installer/servers/jsonls.lua
deleted file mode 100644
index f826f6bd..00000000
--- a/lua/nvim-lsp-installer/servers/jsonls.lua
+++ /dev/null
@@ -1,12 +0,0 @@
-local server = require('nvim-lsp-installer.server')
-
-local root_dir = server.get_server_root_path('json')
-
-return server.Server:new {
- name = "jsonls",
- root_dir = root_dir,
- install_cmd = [[npm i vscode-json-languageserver]],
- default_options = {
- cmd = { root_dir .. '/node_modules/.bin/vscode-json-languageserver', '--stdio' },
- },
-}
diff --git a/lua/nvim-lsp-installer/servers/jsonls/init.lua b/lua/nvim-lsp-installer/servers/jsonls/init.lua
new file mode 100644
index 00000000..b99a8103
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/jsonls/init.lua
@@ -0,0 +1,14 @@
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local npm = require("nvim-lsp-installer.installers.npm")
+
+local root_dir = server.get_server_root_path("json")
+
+return server.Server:new {
+ name = "jsonls",
+ root_dir = root_dir,
+ install_cmd = npm.packages { "vscode-json-languageserver" },
+ default_options = {
+ cmd = { path.concat { root_dir, "node_modules", ".bin", "vscode-json-languageserver" }, "--stdio" },
+ },
+}
diff --git a/lua/nvim-lsp-installer/servers/pyright.lua b/lua/nvim-lsp-installer/servers/pyright.lua
deleted file mode 100644
index e356deb0..00000000
--- a/lua/nvim-lsp-installer/servers/pyright.lua
+++ /dev/null
@@ -1,13 +0,0 @@
-local server = require('nvim-lsp-installer.server')
-
-local root_dir = server.get_server_root_path('python')
-
-return server.Server:new {
- name = "pyright",
- root_dir = root_dir,
- install_cmd = [[npm install pyright]],
- default_options = {
- cmd = { root_dir .. '/node_modules/.bin/pyright-langserver', '--stdio' },
- on_attach = server.common_on_attach,
- },
-}
diff --git a/lua/nvim-lsp-installer/servers/pyright/init.lua b/lua/nvim-lsp-installer/servers/pyright/init.lua
new file mode 100644
index 00000000..a01b9882
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/pyright/init.lua
@@ -0,0 +1,15 @@
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local npm = require("nvim-lsp-installer.installers.npm")
+
+local root_dir = server.get_server_root_path("python")
+
+return server.Server:new {
+ name = "pyright",
+ root_dir = root_dir,
+ install_cmd = npm.packages { "pyright" },
+ default_options = {
+ cmd = { path.concat { root_dir, "node_modules", ".bin", "pyright-langserver" }, "--stdio" },
+ on_attach = server.common_on_attach,
+ },
+}
diff --git a/lua/nvim-lsp-installer/servers/solargraph.lua b/lua/nvim-lsp-installer/servers/solargraph.lua
deleted file mode 100644
index 4e3e1808..00000000
--- a/lua/nvim-lsp-installer/servers/solargraph.lua
+++ /dev/null
@@ -1,34 +0,0 @@
-local server = require('nvim-lsp-installer.server')
-
-local root_dir = server.get_server_root_path('ruby')
-
-local install_cmd = [[
-wget -O solargraph.tar $(curl -s https://api.github.com/repos/castwide/solargraph/tags | grep 'tarball_url' | cut -d\" -f4 | head -n1);
-rm -rf solargraph;
-mkdir solargraph;
-tar -xzf solargraph.tar -C solargraph --strip-components 1;
-rm solargraph.tar;
-cd solargraph;
-
-bundle install --without development --path vendor/bundle;
-
-echo '#!/usr/bin/env bash' > solargraph;
-echo 'cd "$(dirname "$0")" || exit' >> solargraph;
-echo 'bundle exec solargraph $*' >> solargraph;
-
-chmod +x solargraph;
-]]
-
-return server.Server:new {
- name = "solargraph",
- root_dir = root_dir,
- install_cmd = install_cmd,
- pre_install_check = function ()
- if vim.fn.executable('bundle') ~= 1 then
- error("bundle not installed")
- end
- end,
- default_options = {
- cmd = { root_dir .. '/solargraph/solargraph', 'stdio' },
- }
-}
diff --git a/lua/nvim-lsp-installer/servers/solargraph/init.lua b/lua/nvim-lsp-installer/servers/solargraph/init.lua
new file mode 100644
index 00000000..b808d917
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/solargraph/init.lua
@@ -0,0 +1,19 @@
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local zx = require("nvim-lsp-installer.installers.zx")
+
+local root_dir = server.get_server_root_path("ruby")
+
+return server.Server:new {
+ name = "solargraph",
+ root_dir = root_dir,
+ install_cmd = zx.file("./install.mjs"),
+ pre_install_check = function ()
+ if vim.fn.executable("bundle") ~= 1 then
+ error("bundle not installed")
+ end
+ end,
+ default_options = {
+ cmd = { path.concat { root_dir, "solargraph", "solargraph" }, "stdio" },
+ }
+}
diff --git a/lua/nvim-lsp-installer/servers/solargraph/install.mjs b/lua/nvim-lsp-installer/servers/solargraph/install.mjs
new file mode 100644
index 00000000..a525fa56
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/solargraph/install.mjs
@@ -0,0 +1,14 @@
+await $`git clone https://github.com/castwide/solargraph.git .`;
+
+await $`bundle config set --local without 'development'`;
+await $`bundle config set --local path 'vendor/bundle'`;
+await $`bundle install`;
+
+await fs.writeFile(
+ "./solargraph",
+ `#!/usr/bin/env bash
+cd "$(dirname "$0")" || exit 1
+bundle exec solargraph $*`
+);
+
+await $`chmod +x solargraph`;
diff --git a/lua/nvim-lsp-installer/servers/sumneko_lua.lua b/lua/nvim-lsp-installer/servers/sumneko_lua.lua
deleted file mode 100644
index 0469a57b..00000000
--- a/lua/nvim-lsp-installer/servers/sumneko_lua.lua
+++ /dev/null
@@ -1,57 +0,0 @@
-local server = require('nvim-lsp-installer.server')
-
-local root_dir = server.get_server_root_path('lua')
-
-local install_cmd = [=[
-rm -rf lua-language-server;
-git clone https://github.com/sumneko/lua-language-server;
-cd lua-language-server/;
-git submodule update --init --recursive;
-cd 3rd/luamake;
-if [[ $(uname) == Darwin ]]; then
- ninja -f compile/ninja/macos.ninja;
-elif [[ $(uname) == Linux ]]; then
- ninja -f compile/ninja/linux.ninja;
-else
- >&2 echo "$(uname) not supported.";
- exit 1;
-fi
-cd ../../;
-./3rd/luamake/luamake rebuild;
-]=]
-
-local uname_alias = {
- Darwin = 'macOS',
-}
-local uname = vim.fn.system('uname'):gsub("%s+", "")
-local bin_dir = uname_alias[uname] or uname
-
-return server.Server:new {
- name = "sumneko_lua",
- root_dir = root_dir,
- install_cmd = install_cmd,
- pre_install_check = function()
- if vim.fn.executable('ninja') ~= 1 then
- error("ninja not installed (see https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages)")
- end
- end,
- default_options = {
- cmd = { root_dir .. "/lua-language-server/bin/" .. bin_dir .. "/lua-language-server" , "-E", root_dir .. "/lua-language-server/main.lua"},
- settings = {
- Lua = {
- diagnostics = {
- -- Get the language server to recognize the `vim` global
- globals = {'vim'}
- },
- workspace = {
- -- Make the server aware of Neovim runtime files
- library = {
- [vim.fn.expand('$VIMRUNTIME/lua')] = true,
- [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
- },
- maxPreload = 10000
- }
- }
- },
- }
-}
diff --git a/lua/nvim-lsp-installer/servers/sumneko_lua/init.lua b/lua/nvim-lsp-installer/servers/sumneko_lua/init.lua
new file mode 100644
index 00000000..aeb03e82
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/sumneko_lua/init.lua
@@ -0,0 +1,41 @@
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local zx = require("nvim-lsp-installer.installers.zx")
+
+local root_dir = server.get_server_root_path("lua")
+
+local uname_alias = {
+ Darwin = "macOS",
+}
+local uname = vim.fn.system("uname"):gsub("%s+", "")
+local bin_dir = uname_alias[uname] or uname
+
+return server.Server:new {
+ name = "sumneko_lua",
+ root_dir = root_dir,
+ install_cmd = zx.file("./install.mjs"),
+ pre_install_check = function()
+ if vim.fn.executable("ninja") ~= 1 then
+ error("ninja not installed (see https://github.com/ninja-build/ninja/wiki/Pre-built-Ninja-packages)")
+ end
+ end,
+ default_options = {
+ cmd = { path.concat { root_dir, "bin", bin_dir, "lua-language-server" }, "-E", path.concat { root_dir, "main.lua" } },
+ settings = {
+ Lua = {
+ diagnostics = {
+ -- Get the language server to recognize the `vim` global
+ globals = {"vim"}
+ },
+ workspace = {
+ -- Make the server aware of Neovim runtime files
+ library = {
+ [vim.fn.expand("$VIMRUNTIME/lua")] = true,
+ [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true,
+ },
+ maxPreload = 10000
+ }
+ }
+ },
+ }
+}
diff --git a/lua/nvim-lsp-installer/servers/sumneko_lua/install.mjs b/lua/nvim-lsp-installer/servers/sumneko_lua/install.mjs
new file mode 100644
index 00000000..18b7a97d
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/sumneko_lua/install.mjs
@@ -0,0 +1,21 @@
+await $`git clone https://github.com/sumneko/lua-language-server.git .`;
+await $`git submodule update --init --recursive`;
+
+cd("3rd/luamake");
+switch (os.platform()) {
+ case "darwin": {
+ await $`ninja -f compile/ninja/macos.ninja`;
+ break;
+ }
+ case "win32": {
+ console.error(chalk.red("Windows is currently not supported."));
+ process.exit(1);
+ }
+ default: {
+ await $`ninja -f compile/ninja/linux.ninja`;
+ break;
+ }
+}
+
+cd(".");
+await $`./3rd/luamake/luamake rebuild`;
diff --git a/lua/nvim-lsp-installer/servers/texlab.lua b/lua/nvim-lsp-installer/servers/texlab.lua
deleted file mode 100644
index 1b93db1e..00000000
--- a/lua/nvim-lsp-installer/servers/texlab.lua
+++ /dev/null
@@ -1,33 +0,0 @@
-local server = require('nvim-lsp-installer.server')
-
-local root_dir = server.get_server_root_path('latex')
-
-local install_cmd = [=[
-if [[ $(uname) == Linux ]]; then
- wget -O texlab.tar.gz https://github.com/latex-lsp/texlab/releases/download/v2.2.2/texlab-x86_64-linux.tar.gz
-elif [[ $(uname) == Darwin ]]; then
- wget -O texlab.tar.gz https://github.com/latex-lsp/texlab/releases/download/v2.2.2/texlab-x86_64-macos.tar.gz
-else
- >&2 echo "$(uname) not supported.";
- exit 1;
-fi
-
-tar xf texlab.tar.gz
-
-]=]
-
-return server.Server:new {
- name = "texlab",
- root_dir = root_dir,
- install_cmd = install_cmd,
- pre_install_check = function ()
- if vim.fn.executable("wget") ~=1 then
- error("Missing wget. Please, refer to https://www.gnu.org/software/wget/ to install it.")
- elseif vim.fn.executable("pdflatex") ~=1 then
- error("The program pdflatex wasn't found. Please install a TeX distribution: https://www.latex-project.org/get/#tex-distributions")
- end
- end,
- default_options = {
- cmd = {root_dir .. '/texlab'},
- }
-}
diff --git a/lua/nvim-lsp-installer/servers/texlab/init.lua b/lua/nvim-lsp-installer/servers/texlab/init.lua
new file mode 100644
index 00000000..02bb3a3e
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/texlab/init.lua
@@ -0,0 +1,21 @@
+local server = require('nvim-lsp-installer.server')
+local path = require("nvim-lsp-installer.path")
+local zx = require("nvim-lsp-installer.installers.zx")
+
+local root_dir = server.get_server_root_path('latex')
+
+return server.Server:new {
+ name = "texlab",
+ root_dir = root_dir,
+ install_cmd = zx.file("./install.mjs"),
+ pre_install_check = function ()
+ if vim.fn.executable("wget") ~=1 then
+ error("Missing wget. Please, refer to https://www.gnu.org/software/wget/ to install it.")
+ elseif vim.fn.executable("pdflatex") ~=1 then
+ error("The program pdflatex wasn't found. Please install a TeX distribution: https://www.latex-project.org/get/#tex-distributions")
+ end
+ end,
+ default_options = {
+ cmd = { path.concat { root_dir, "texlab" } },
+ }
+}
diff --git a/lua/nvim-lsp-installer/servers/texlab/install.mjs b/lua/nvim-lsp-installer/servers/texlab/install.mjs
new file mode 100644
index 00000000..1b73bcc3
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/texlab/install.mjs
@@ -0,0 +1,21 @@
+const VERSION = "v2.2.2"
+
+const platform = os.platform();
+
+const target = (() => {
+ switch (platform) {
+ case "darwin":
+ return `https://github.com/latex-lsp/texlab/releases/download/${VERSION}/texlab-x86_64-macos.tar.gz`;
+ case "win32": {
+ console.error(chalk.red("Windows is currently not supported."));
+ process.exit(1);
+ break;
+ }
+ default:
+ return `https://github.com/latex-lsp/texlab/releases/download/${VERSION}/texlab-x86_64-linux.tar.gz`;
+ }
+})();
+
+await $`wget -O texlab.tar.gz ${target}`
+await $`tar xf texlab.tar.gz`
+await $`rm texlab.tar.gz`
diff --git a/lua/nvim-lsp-installer/servers/tsserver.lua b/lua/nvim-lsp-installer/servers/tsserver.lua
deleted file mode 100644
index 0294dc79..00000000
--- a/lua/nvim-lsp-installer/servers/tsserver.lua
+++ /dev/null
@@ -1,12 +0,0 @@
-local server = require('nvim-lsp-installer.server')
-
-local root_dir = server.get_server_root_path('tsserver')
-
-return server.Server:new {
- name = "tsserver",
- root_dir = root_dir,
- install_cmd = [[npm install typescript-language-server]],
- default_options = {
- cmd = { root_dir .. '/node_modules/.bin/typescript-language-server', '--stdio' },
- },
-}
diff --git a/lua/nvim-lsp-installer/servers/tsserver/init.lua b/lua/nvim-lsp-installer/servers/tsserver/init.lua
new file mode 100644
index 00000000..cc714506
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/tsserver/init.lua
@@ -0,0 +1,14 @@
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local npm = require("nvim-lsp-installer.installers.npm")
+
+local root_dir = server.get_server_root_path("tsserver")
+
+return server.Server:new {
+ name = "tsserver",
+ root_dir = root_dir,
+ install_cmd = npm.packages { "typescript-language-server" },
+ default_options = {
+ cmd = { path.concat { root_dir, "node_modules", ".bin", "typescript-language-server" }, "--stdio" },
+ },
+}
diff --git a/lua/nvim-lsp-installer/servers/vimls.lua b/lua/nvim-lsp-installer/servers/vimls.lua
deleted file mode 100644
index 94041007..00000000
--- a/lua/nvim-lsp-installer/servers/vimls.lua
+++ /dev/null
@@ -1,12 +0,0 @@
-local server = require('nvim-lsp-installer.server')
-
-local root_dir = server.get_server_root_path('vim')
-
-return server.Server:new {
- name = "vimls",
- root_dir = root_dir,
- install_cmd = [[npm install vim-language-server@latest]],
- default_options = {
- cmd = { root_dir .. "/node_modules/.bin/vim-language-server", "--stdio" },
- }
-}
diff --git a/lua/nvim-lsp-installer/servers/vimls/init.lua b/lua/nvim-lsp-installer/servers/vimls/init.lua
new file mode 100644
index 00000000..afc7e73b
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/vimls/init.lua
@@ -0,0 +1,14 @@
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local npm = require("nvim-lsp-installer.installers.npm")
+
+local root_dir = server.get_server_root_path("vim")
+
+return server.Server:new {
+ name = "vimls",
+ root_dir = root_dir,
+ install_cmd = npm.packages { "vim-language-server@latest" },
+ default_options = {
+ cmd = { path.concat { root_dir, "node_modules", ".bin", "vim-language-server" }, "--stdio" },
+ }
+}
diff --git a/lua/nvim-lsp-installer/servers/vuels.lua b/lua/nvim-lsp-installer/servers/vuels.lua
deleted file mode 100644
index 5c0fda3c..00000000
--- a/lua/nvim-lsp-installer/servers/vuels.lua
+++ /dev/null
@@ -1,14 +0,0 @@
-local util = require("lspconfig.util")
-
-local server = require("nvim-lsp-installer.server")
-
-local root_dir = server.get_server_root_path("vuels")
-
-return server.Server:new {
- name = "vuels",
- root_dir = root_dir,
- install_cmd = [[npm install vls]],
- default_options = {
- cmd = { root_dir .. "/node_modules/.bin/vls", "--stdio"},
- },
-}
diff --git a/lua/nvim-lsp-installer/servers/vuels/init.lua b/lua/nvim-lsp-installer/servers/vuels/init.lua
new file mode 100644
index 00000000..c5e3977e
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/vuels/init.lua
@@ -0,0 +1,14 @@
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local npm = require("nvim-lsp-installer.installers.npm")
+
+local root_dir = server.get_server_root_path("vuels")
+
+return server.Server:new {
+ name = "vuels",
+ root_dir = root_dir,
+ install_cmd = npm.packages { "vls" },
+ default_options = {
+ cmd = { path.concat { root_dir, "node_modules", ".bin", "vls" }, "--stdio"},
+ },
+}
diff --git a/lua/nvim-lsp-installer/servers/yamlls.lua b/lua/nvim-lsp-installer/servers/yamlls.lua
deleted file mode 100644
index 03f1e75a..00000000
--- a/lua/nvim-lsp-installer/servers/yamlls.lua
+++ /dev/null
@@ -1,12 +0,0 @@
-local server = require('nvim-lsp-installer.server')
-
-local root_dir = server.get_server_root_path('yaml')
-
-return server.Server:new {
- name = "yamlls",
- root_dir = root_dir,
- install_cmd = [[npm install yaml-language-server]],
- default_options = {
- cmd = { root_dir .. '/node_modules/.bin/yaml-language-server', '--stdio' },
- }
-}
diff --git a/lua/nvim-lsp-installer/servers/yamlls/init.lua b/lua/nvim-lsp-installer/servers/yamlls/init.lua
new file mode 100644
index 00000000..a93069a0
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/yamlls/init.lua
@@ -0,0 +1,14 @@
+local server = require("nvim-lsp-installer.server")
+local path = require("nvim-lsp-installer.path")
+local npm = require("nvim-lsp-installer.installers.npm")
+
+local root_dir = server.get_server_root_path("yaml")
+
+return server.Server:new {
+ name = "yamlls",
+ root_dir = root_dir,
+ install_cmd = npm.packages { "yaml-language-server" },
+ default_options = {
+ cmd = { path.concat { root_dir, "node_modules", ".bin", "yaml-language-server" }, "--stdio" },
+ }
+}