aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-07-10 16:02:44 +0200
committerWilliam Boman <william@redwill.se>2021-07-10 16:02:44 +0200
commit156478b14cf4ce19262253b044aca27f5f448bc5 (patch)
tree43d25f4776f3036e0bf686572bb0e53c06a6e896 /lua
parentclangd, rust_analyzer: simplify install script a bit (diff)
downloadmason-156478b14cf4ce19262253b044aca27f5f448bc5.tar
mason-156478b14cf4ce19262253b044aca27f5f448bc5.tar.gz
mason-156478b14cf4ce19262253b044aca27f5f448bc5.tar.bz2
mason-156478b14cf4ce19262253b044aca27f5f448bc5.tar.lz
mason-156478b14cf4ce19262253b044aca27f5f448bc5.tar.xz
mason-156478b14cf4ce19262253b044aca27f5f448bc5.tar.zst
mason-156478b14cf4ce19262253b044aca27f5f448bc5.zip
npm, pip3: add executable(root_dir, executable) util function
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-lsp-installer/installers/npm.lua5
-rw-r--r--lua/nvim-lsp-installer/installers/pip3.lua11
-rw-r--r--lua/nvim-lsp-installer/installers/zx.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/angularls/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/bashls/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/cmake/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/cssls/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/dockerls/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/elmls/init.lua15
-rw-r--r--lua/nvim-lsp-installer/servers/fortls/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/graphql/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/html/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/intelephense/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/jsonls/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/purescriptls/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/pyright/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/rome/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/svelte/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/tsserver/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/vimls/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/vuels/init.lua3
-rw-r--r--lua/nvim-lsp-installer/servers/yamlls/init.lua3
22 files changed, 37 insertions, 51 deletions
diff --git a/lua/nvim-lsp-installer/installers/npm.lua b/lua/nvim-lsp-installer/installers/npm.lua
index 54e71d12..882b7f92 100644
--- a/lua/nvim-lsp-installer/installers/npm.lua
+++ b/lua/nvim-lsp-installer/installers/npm.lua
@@ -1,3 +1,4 @@
+local path = require("nvim-lsp-installer.path")
local shell = require("nvim-lsp-installer.installers.shell")
local M = {}
@@ -6,4 +7,8 @@ function M.packages(packages)
return shell.raw(("npm install %s"):format(table.concat(packages, " ")))
end
+function M.executable(root_dir, executable)
+ return path.concat { root_dir, "node_modules", ".bin", executable }
+end
+
return M
diff --git a/lua/nvim-lsp-installer/installers/pip3.lua b/lua/nvim-lsp-installer/installers/pip3.lua
index 83b7e43a..9f5da078 100644
--- a/lua/nvim-lsp-installer/installers/pip3.lua
+++ b/lua/nvim-lsp-installer/installers/pip3.lua
@@ -1,13 +1,18 @@
+local path = require("nvim-lsp-installer.path")
local shell = require("nvim-lsp-installer.installers.shell")
local M = {}
-M.REL_INSTALL_DIR = "venv"
+local REL_INSTALL_DIR = "venv"
function M.packages(packages)
- return shell.raw(("./%s/bin/pip3 install -U %s"):format(M.REL_INSTALL_DIR, table.concat(packages, "")), {
- prefix = ("set -euo pipefail; python3 -m venv %q;"):format(M.REL_INSTALL_DIR)
+ return shell.raw(("./%s/bin/pip3 install -U %s"):format(REL_INSTALL_DIR, table.concat(packages, "")), {
+ prefix = ("set -euo pipefail; python3 -m venv %q;"):format(REL_INSTALL_DIR)
})
end
+function M.executable(root_dir, executable)
+ return path.concat { root_dir, REL_INSTALL_DIR, "bin", executable }
+end
+
return M
diff --git a/lua/nvim-lsp-installer/installers/zx.lua b/lua/nvim-lsp-installer/installers/zx.lua
index 44b0a718..6aeb007b 100644
--- a/lua/nvim-lsp-installer/installers/zx.lua
+++ b/lua/nvim-lsp-installer/installers/zx.lua
@@ -2,13 +2,14 @@ local fs = require("nvim-lsp-installer.fs")
local path = require("nvim-lsp-installer.path")
local installers = require("nvim-lsp-installer.installers")
local shell = require("nvim-lsp-installer.installers.shell")
+local npm = require("nvim-lsp-installer.installers.npm")
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 ZX_EXECUTABLE = npm.executable(INSTALL_DIR, "zx")
local has_installed_zx = false
diff --git a/lua/nvim-lsp-installer/servers/angularls/init.lua b/lua/nvim-lsp-installer/servers/angularls/init.lua
index a0a7f6a8..14cde314 100644
--- a/lua/nvim-lsp-installer/servers/angularls/init.lua
+++ b/lua/nvim-lsp-installer/servers/angularls/init.lua
@@ -1,6 +1,5 @@
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")
-- Angular requires a node_modules directory to probe for @angular/language-service and typescript
@@ -16,7 +15,7 @@ local default_probe_dir = get_probe_dir(vim.fn.getcwd())
local root_dir = server.get_server_root_path("angularls")
-local executable_path = path.concat { root_dir, "node_modules", ".bin", "ngserver" }
+local executable_path = npm.executable(root_dir, "ngserver")
return server.Server:new {
name = "angularls",
diff --git a/lua/nvim-lsp-installer/servers/bashls/init.lua b/lua/nvim-lsp-installer/servers/bashls/init.lua
index 4c556c37..e8a6f70f 100644
--- a/lua/nvim-lsp-installer/servers/bashls/init.lua
+++ b/lua/nvim-lsp-installer/servers/bashls/init.lua
@@ -1,5 +1,4 @@
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")
@@ -9,6 +8,6 @@ return server.Server:new {
root_dir = root_dir,
installer = npm.packages { "bash-language-server@latest" },
default_options = {
- cmd = { path.concat { root_dir, "node_modules", ".bin", "bash-language-server" }, "start" },
+ cmd = { npm.executable(root_dir, "bash-language-server"), "start" },
},
}
diff --git a/lua/nvim-lsp-installer/servers/cmake/init.lua b/lua/nvim-lsp-installer/servers/cmake/init.lua
index b22e36e9..9c637311 100644
--- a/lua/nvim-lsp-installer/servers/cmake/init.lua
+++ b/lua/nvim-lsp-installer/servers/cmake/init.lua
@@ -1,5 +1,4 @@
local server = require("nvim-lsp-installer.server")
-local path = require("nvim-lsp-installer.path")
local pip3 = require("nvim-lsp-installer.installers.pip3")
local root_dir = server.get_server_root_path("cmake")
@@ -9,7 +8,7 @@ return server.Server:new {
root_dir = root_dir,
installer = pip3.packages { "cmake-language-server" },
default_options = {
- cmd = { path.concat { root_dir, pip3.REL_INSTALL_DIR, "bin", "cmake-language-server" } },
+ cmd = { pip3.executable(root_dir, "cmake-language-server") },
},
}
diff --git a/lua/nvim-lsp-installer/servers/cssls/init.lua b/lua/nvim-lsp-installer/servers/cssls/init.lua
index 1d0e6ea5..fc9f0f80 100644
--- a/lua/nvim-lsp-installer/servers/cssls/init.lua
+++ b/lua/nvim-lsp-installer/servers/cssls/init.lua
@@ -1,5 +1,4 @@
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")
@@ -9,6 +8,6 @@ return server.Server:new {
root_dir = root_dir,
installer = npm.packages { "vscode-css-languageserver-bin" },
default_options = {
- cmd = { path.concat { root_dir, "node_modules", ".bin", "css-languageserver" }, "--stdio" },
+ cmd = { npm.executable(root_dir, "css-languageserver") , "--stdio" },
},
}
diff --git a/lua/nvim-lsp-installer/servers/dockerls/init.lua b/lua/nvim-lsp-installer/servers/dockerls/init.lua
index ef8defa2..10b0cbec 100644
--- a/lua/nvim-lsp-installer/servers/dockerls/init.lua
+++ b/lua/nvim-lsp-installer/servers/dockerls/init.lua
@@ -1,5 +1,4 @@
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")
@@ -9,6 +8,6 @@ return server.Server:new {
root_dir = root_dir,
installer = npm.packages { "dockerfile-language-server-nodejs@latest" },
default_options = {
- cmd = { path.concat { root_dir, "node_modules", ".bin", "docker-langserver" }, "--stdio" },
+ cmd = { npm.executable(root_dir, "docker-langserver"), "--stdio" },
},
}
diff --git a/lua/nvim-lsp-installer/servers/elmls/init.lua b/lua/nvim-lsp-installer/servers/elmls/init.lua
index 6cd47c22..a175cd8f 100644
--- a/lua/nvim-lsp-installer/servers/elmls/init.lua
+++ b/lua/nvim-lsp-installer/servers/elmls/init.lua
@@ -1,25 +1,18 @@
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("elm")
-local bin_dir = path.concat { root_dir, "node_modules", ".bin" }
-
-local function bin(executable)
- return path.concat { bin_dir, executable }
-end
-
return server.Server:new {
name = "elmls",
root_dir = root_dir,
installer = npm.packages { "elm", "elm-test", "elm-format", "@elm-tooling/elm-language-server" },
default_options = {
- cmd = { bin("elm-language-server") },
+ cmd = { npm.executable(root_dir, "elm-language-server") },
init_options = {
- elmPath = bin("elm"),
- elmFormatPath = bin("elm-format"),
- elmTestPath = bin("elm-test"),
+ elmPath = npm.executable(root_dir, "elm"),
+ elmFormatPath = npm.exe(root_dir, "elm-format"),
+ elmTestPath = npm.exe(root_dir, "elm-test"),
elmAnalyseTrigger = "change",
},
}
diff --git a/lua/nvim-lsp-installer/servers/fortls/init.lua b/lua/nvim-lsp-installer/servers/fortls/init.lua
index 610e2950..e53baa4b 100644
--- a/lua/nvim-lsp-installer/servers/fortls/init.lua
+++ b/lua/nvim-lsp-installer/servers/fortls/init.lua
@@ -1,5 +1,4 @@
local server = require("nvim-lsp-installer.server")
-local path = require("nvim-lsp-installer.path")
local pip3 = require("nvim-lsp-installer.installers.pip3")
local root_dir = server.get_server_root_path("fortls")
@@ -9,7 +8,7 @@ return server.Server:new {
root_dir = root_dir,
installer = pip3.packages { "fortran-language-server" },
default_options = {
- cmd = { path.concat { root_dir, pip3.REL_INSTALL_DIR, "bin", "fortls" } },
+ cmd = { pip3.executable(root_dir, "fortls") },
},
}
diff --git a/lua/nvim-lsp-installer/servers/graphql/init.lua b/lua/nvim-lsp-installer/servers/graphql/init.lua
index bb6b637f..ec4ecb8f 100644
--- a/lua/nvim-lsp-installer/servers/graphql/init.lua
+++ b/lua/nvim-lsp-installer/servers/graphql/init.lua
@@ -1,7 +1,6 @@
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")
@@ -11,7 +10,7 @@ return server.Server:new {
root_dir = root_dir,
installer = npm.packages { "graphql-language-service-cli@latest", "graphql" },
default_options = {
- cmd = { path.concat { root_dir, "node_modules", ".bin", "graphql-lsp" }, "server", "-m", "stream" },
+ cmd = { npm.executable(root_dir, "graphql-lsp"), "server", "-m", "stream" },
filetypes = { "typescriptreact", "javascriptreact", "graphql" },
root_dir = util.root_pattern(
-- Sourced from https://graphql-config.com/usage/ and https://git.io/Js2dt
diff --git a/lua/nvim-lsp-installer/servers/html/init.lua b/lua/nvim-lsp-installer/servers/html/init.lua
index e6c4a814..7fce1c82 100644
--- a/lua/nvim-lsp-installer/servers/html/init.lua
+++ b/lua/nvim-lsp-installer/servers/html/init.lua
@@ -1,5 +1,4 @@
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")
@@ -9,6 +8,6 @@ return server.Server:new {
root_dir = root_dir,
installer = npm.packages { "vscode-html-languageserver-bin" },
default_options = {
- cmd = { path.concat { root_dir, "node_modules", ".bin", "html-languageserver" }, "--stdio" },
+ cmd = { npm.executable(root_dir, "html-languageserver"), "--stdio" },
},
}
diff --git a/lua/nvim-lsp-installer/servers/intelephense/init.lua b/lua/nvim-lsp-installer/servers/intelephense/init.lua
index 861fe89e..a878cc16 100644
--- a/lua/nvim-lsp-installer/servers/intelephense/init.lua
+++ b/lua/nvim-lsp-installer/servers/intelephense/init.lua
@@ -1,5 +1,4 @@
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("php")
@@ -9,6 +8,6 @@ return server.Server:new {
root_dir = root_dir,
installer = npm.packages { "intelephense" },
default_options = {
- cmd = { path.concat { root_dir, "node_modules", ".bin", "intelephense" }, "--stdio" },
+ cmd = { npm.executable(root_dir, "intelephense"), "--stdio" },
},
}
diff --git a/lua/nvim-lsp-installer/servers/jsonls/init.lua b/lua/nvim-lsp-installer/servers/jsonls/init.lua
index f1a2a643..cc9ba2bb 100644
--- a/lua/nvim-lsp-installer/servers/jsonls/init.lua
+++ b/lua/nvim-lsp-installer/servers/jsonls/init.lua
@@ -1,5 +1,4 @@
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")
@@ -9,6 +8,6 @@ return server.Server:new {
root_dir = root_dir,
installer = npm.packages { "vscode-json-languageserver" },
default_options = {
- cmd = { path.concat { root_dir, "node_modules", ".bin", "vscode-json-languageserver" }, "--stdio" },
+ cmd = { npm.executable(root_dir, "vscode-json-languageserver"), "--stdio" },
},
}
diff --git a/lua/nvim-lsp-installer/servers/purescriptls/init.lua b/lua/nvim-lsp-installer/servers/purescriptls/init.lua
index c992bf75..204b7571 100644
--- a/lua/nvim-lsp-installer/servers/purescriptls/init.lua
+++ b/lua/nvim-lsp-installer/servers/purescriptls/init.lua
@@ -1,5 +1,4 @@
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("purescript")
@@ -9,6 +8,6 @@ return server.Server:new {
root_dir = root_dir,
installer = npm.packages { "purescript-language-server" },
default_options = {
- cmd = { path.concat { root_dir, "node_modules", ".bin", "purescript-language-server" }, "--stdio" },
+ cmd = { npm.executable(root_dir, "purescript-language-server"), "--stdio" },
},
}
diff --git a/lua/nvim-lsp-installer/servers/pyright/init.lua b/lua/nvim-lsp-installer/servers/pyright/init.lua
index 0e3bc23c..17f8e6f3 100644
--- a/lua/nvim-lsp-installer/servers/pyright/init.lua
+++ b/lua/nvim-lsp-installer/servers/pyright/init.lua
@@ -1,5 +1,4 @@
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")
@@ -9,6 +8,6 @@ return server.Server:new {
root_dir = root_dir,
installer = npm.packages { "pyright" },
default_options = {
- cmd = { path.concat { root_dir, "node_modules", ".bin", "pyright-langserver" }, "--stdio" },
+ cmd = { npm.executable(root_dir, "pyright-langserver"), "--stdio" },
},
}
diff --git a/lua/nvim-lsp-installer/servers/rome/init.lua b/lua/nvim-lsp-installer/servers/rome/init.lua
index 98659405..4d7a7843 100644
--- a/lua/nvim-lsp-installer/servers/rome/init.lua
+++ b/lua/nvim-lsp-installer/servers/rome/init.lua
@@ -1,5 +1,4 @@
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("rome")
@@ -9,6 +8,6 @@ return server.Server:new {
root_dir = root_dir,
installer = npm.packages { "rome@10.0.7-nightly.2021.7.2" }, -- https://github.com/rome/tools/pull/1409
default_options = {
- cmd = { path.concat { root_dir, "node_modules", ".bin", "rome" }, "lsp" },
+ cmd = { npm.executable(root_dir, "rome") , "lsp" },
},
}
diff --git a/lua/nvim-lsp-installer/servers/svelte/init.lua b/lua/nvim-lsp-installer/servers/svelte/init.lua
index 1389ed5d..9181f41a 100644
--- a/lua/nvim-lsp-installer/servers/svelte/init.lua
+++ b/lua/nvim-lsp-installer/servers/svelte/init.lua
@@ -1,5 +1,4 @@
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("svelte")
@@ -9,6 +8,6 @@ return server.Server:new {
root_dir = root_dir,
installer = npm.packages { "svelte-language-server" },
default_options = {
- cmd = { path.concat { root_dir, "node_modules", ".bin", "svelteserver" }, "--stdio" },
+ cmd = { npm.executable(root_dir, "svelteserver"), "--stdio" },
},
}
diff --git a/lua/nvim-lsp-installer/servers/tsserver/init.lua b/lua/nvim-lsp-installer/servers/tsserver/init.lua
index e0ca22bd..a6baf82e 100644
--- a/lua/nvim-lsp-installer/servers/tsserver/init.lua
+++ b/lua/nvim-lsp-installer/servers/tsserver/init.lua
@@ -1,5 +1,4 @@
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")
@@ -9,6 +8,6 @@ return server.Server:new {
root_dir = root_dir,
installer = npm.packages { "typescript-language-server" },
default_options = {
- cmd = { path.concat { root_dir, "node_modules", ".bin", "typescript-language-server" }, "--stdio" },
+ cmd = { npm.executable(root_dir, "typescript-language-server"), "--stdio" },
},
}
diff --git a/lua/nvim-lsp-installer/servers/vimls/init.lua b/lua/nvim-lsp-installer/servers/vimls/init.lua
index 3c8fc7dd..6a86b9de 100644
--- a/lua/nvim-lsp-installer/servers/vimls/init.lua
+++ b/lua/nvim-lsp-installer/servers/vimls/init.lua
@@ -1,5 +1,4 @@
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")
@@ -9,6 +8,6 @@ return server.Server:new {
root_dir = root_dir,
installer = npm.packages { "vim-language-server@latest" },
default_options = {
- cmd = { path.concat { root_dir, "node_modules", ".bin", "vim-language-server" }, "--stdio" },
+ cmd = { npm.executable(root_dir, "vim-language-server"), "--stdio" },
}
}
diff --git a/lua/nvim-lsp-installer/servers/vuels/init.lua b/lua/nvim-lsp-installer/servers/vuels/init.lua
index a4403da6..6e57685f 100644
--- a/lua/nvim-lsp-installer/servers/vuels/init.lua
+++ b/lua/nvim-lsp-installer/servers/vuels/init.lua
@@ -1,5 +1,4 @@
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")
@@ -9,6 +8,6 @@ return server.Server:new {
root_dir = root_dir,
installer = npm.packages { "vls" },
default_options = {
- cmd = { path.concat { root_dir, "node_modules", ".bin", "vls" }, "--stdio"},
+ cmd = { npm.executable(root_dir, "vls") , "--stdio" },
},
}
diff --git a/lua/nvim-lsp-installer/servers/yamlls/init.lua b/lua/nvim-lsp-installer/servers/yamlls/init.lua
index 09ca7ba7..d0ad40ad 100644
--- a/lua/nvim-lsp-installer/servers/yamlls/init.lua
+++ b/lua/nvim-lsp-installer/servers/yamlls/init.lua
@@ -1,5 +1,4 @@
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")
@@ -9,6 +8,6 @@ return server.Server:new {
root_dir = root_dir,
installer = npm.packages { "yaml-language-server" },
default_options = {
- cmd = { path.concat { root_dir, "node_modules", ".bin", "yaml-language-server" }, "--stdio" },
+ cmd = { npm.executable(root_dir, "yaml-language-server"), "--stdio" },
}
}