aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/servers
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-04-05 14:19:07 +0200
committerGitHub <noreply@github.com>2021-04-05 14:19:07 +0200
commitdcf117a8a60d887a2c2ff9d5617a9c39c5ee95fb (patch)
tree419e086d757624aa9e2bcaa456e02a6c8f7a3968 /lua/nvim-lsp-installer/servers
parenteslintls: avoid globbing/word splitting (diff)
downloadmason-dcf117a8a60d887a2c2ff9d5617a9c39c5ee95fb.tar
mason-dcf117a8a60d887a2c2ff9d5617a9c39c5ee95fb.tar.gz
mason-dcf117a8a60d887a2c2ff9d5617a9c39c5ee95fb.tar.bz2
mason-dcf117a8a60d887a2c2ff9d5617a9c39c5ee95fb.tar.lz
mason-dcf117a8a60d887a2c2ff9d5617a9c39c5ee95fb.tar.xz
mason-dcf117a8a60d887a2c2ff9d5617a9c39c5ee95fb.tar.zst
mason-dcf117a8a60d887a2c2ff9d5617a9c39c5ee95fb.zip
rename Installer to Server for clarity (#3)
Diffstat (limited to 'lua/nvim-lsp-installer/servers')
-rw-r--r--lua/nvim-lsp-installer/servers/bashls.lua12
-rw-r--r--lua/nvim-lsp-installer/servers/cssls.lua12
-rw-r--r--lua/nvim-lsp-installer/servers/dockerls.lua12
-rw-r--r--lua/nvim-lsp-installer/servers/eslintls.lua80
-rw-r--r--lua/nvim-lsp-installer/servers/graphql.lua16
-rw-r--r--lua/nvim-lsp-installer/servers/html.lua12
-rw-r--r--lua/nvim-lsp-installer/servers/jsonls.lua12
-rw-r--r--lua/nvim-lsp-installer/servers/pyright.lua13
-rw-r--r--lua/nvim-lsp-installer/servers/solargraph.lua34
-rw-r--r--lua/nvim-lsp-installer/servers/sumneko_lua.lua57
-rw-r--r--lua/nvim-lsp-installer/servers/tsserver.lua12
-rw-r--r--lua/nvim-lsp-installer/servers/vimls.lua12
-rw-r--r--lua/nvim-lsp-installer/servers/yamlls.lua12
13 files changed, 296 insertions, 0 deletions
diff --git a/lua/nvim-lsp-installer/servers/bashls.lua b/lua/nvim-lsp-installer/servers/bashls.lua
new file mode 100644
index 00000000..224e8d23
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/bashls.lua
@@ -0,0 +1,12 @@
+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/cssls.lua b/lua/nvim-lsp-installer/servers/cssls.lua
new file mode 100644
index 00000000..53bb6378
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/cssls.lua
@@ -0,0 +1,12 @@
+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/dockerls.lua b/lua/nvim-lsp-installer/servers/dockerls.lua
new file mode 100644
index 00000000..dbe4645e
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/dockerls.lua
@@ -0,0 +1,12 @@
+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/eslintls.lua b/lua/nvim-lsp-installer/servers/eslintls.lua
new file mode 100644
index 00000000..b8f0f448
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/eslintls.lua
@@ -0,0 +1,80 @@
+local lspconfig = require'lspconfig'
+local configs = require'lspconfig/configs'
+
+local server = require'nvim-lsp-installer.server'
+
+if not lspconfig.eslintls then
+ configs.eslintls = {
+ default_config = {
+ filetypes = {'javascript', 'javascriptreact', 'typescript', 'typescriptreact'},
+ root_dir = lspconfig.util.root_pattern(".eslintrc*", "package.json", ".git"),
+ settings = {
+ nodePath = '', -- If this is a non-null/undefined value the eslint LSP runs into runtime exceptions.
+ validate = 'on',
+ run = 'onType',
+ workingDirectory = {mode = "auto"},
+ workspaceFolder = {
+ uri = "/",
+ name = "root",
+ },
+ codeAction = {
+ disableRuleComment = {
+ enable = true,
+ location = "sameLine",
+ },
+ showDocumentation = {
+ enable = true
+ }
+ },
+ },
+ },
+ }
+end
+
+local ConfirmExecutionResult = {
+ deny = 1,
+ confirmationPending = 2,
+ confirmationCanceled = 3,
+ approved = 4
+}
+
+local root_dir = server.get_server_root_path('eslint')
+local install_cmd = [[
+git clone https://github.com/microsoft/vscode-eslint .;
+npm install;
+cd server;
+npm install;
+npx tsc;
+]]
+
+return server.Server:new {
+ name = "eslintls",
+ root_dir = root_dir,
+ install_cmd = install_cmd,
+ default_options = {
+ cmd = {'node', root_dir .. '/server/out/eslintServer.js', '--stdio'},
+ handlers = {
+ ["eslint/openDoc"] = function (_, _, open_doc)
+ os.execute(string.format("open %q", open_doc.url))
+ return {id = nil, result = true}
+ end,
+ ["eslint/confirmESLintExecution"] = function ()
+ -- VSCode language servers have a policy to request explicit approval
+ -- before applying code changes. We just approve it immediately.
+ return ConfirmExecutionResult.approved
+ end,
+ ["eslint/probeFailed"] = function ()
+ 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.')
+ return {id = nil, result = true}
+ end,
+ ["eslint/noConfig"] = function ()
+ vim.api.nvim_err_writeln('Unable to find ESLint configuration.')
+ return {id = nil, result = true}
+ end,
+ },
+ },
+}
diff --git a/lua/nvim-lsp-installer/servers/graphql.lua b/lua/nvim-lsp-installer/servers/graphql.lua
new file mode 100644
index 00000000..1728e81e
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/graphql.lua
@@ -0,0 +1,16 @@
+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/html.lua b/lua/nvim-lsp-installer/servers/html.lua
new file mode 100644
index 00000000..36acc429
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/html.lua
@@ -0,0 +1,12 @@
+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/jsonls.lua b/lua/nvim-lsp-installer/servers/jsonls.lua
new file mode 100644
index 00000000..e856f50f
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/jsonls.lua
@@ -0,0 +1,12 @@
+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 install vscode-json-languageserver-bin]],
+ default_options = {
+ cmd = { root_dir .. '/node_modules/.bin/json-languageserver', '--stdio' },
+ },
+}
diff --git a/lua/nvim-lsp-installer/servers/pyright.lua b/lua/nvim-lsp-installer/servers/pyright.lua
new file mode 100644
index 00000000..e356deb0
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/pyright.lua
@@ -0,0 +1,13 @@
+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/solargraph.lua b/lua/nvim-lsp-installer/servers/solargraph.lua
new file mode 100644
index 00000000..c9f99e7c
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/solargraph.lua
@@ -0,0 +1,34 @@
+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 = 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/sumneko_lua.lua b/lua/nvim-lsp-installer/servers/sumneko_lua.lua
new file mode 100644
index 00000000..81ac2bcb
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/sumneko_lua.lua
@@ -0,0 +1,57 @@
+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 ninja/macos.ninja;
+elif [[ $(uname) == Linux ]]; then
+ ninja -f 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 = 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/tsserver.lua b/lua/nvim-lsp-installer/servers/tsserver.lua
new file mode 100644
index 00000000..0294dc79
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/tsserver.lua
@@ -0,0 +1,12 @@
+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/vimls.lua b/lua/nvim-lsp-installer/servers/vimls.lua
new file mode 100644
index 00000000..94041007
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/vimls.lua
@@ -0,0 +1,12 @@
+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/yamlls.lua b/lua/nvim-lsp-installer/servers/yamlls.lua
new file mode 100644
index 00000000..03f1e75a
--- /dev/null
+++ b/lua/nvim-lsp-installer/servers/yamlls.lua
@@ -0,0 +1,12 @@
+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' },
+ }
+}