diff options
| author | William Boman <william@redwill.se> | 2021-08-02 12:43:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-02 12:43:39 +0200 |
| commit | 00ce6fea97d572b4c2bae204087dfdcceda8b796 (patch) | |
| tree | 474dbaf4057db95fdd72142c8ccf2ba283d576ea | |
| parent | installers/pip3: actually add space in-between packages (diff) | |
| download | mason-00ce6fea97d572b4c2bae204087dfdcceda8b796.tar mason-00ce6fea97d572b4c2bae204087dfdcceda8b796.tar.gz mason-00ce6fea97d572b4c2bae204087dfdcceda8b796.tar.bz2 mason-00ce6fea97d572b4c2bae204087dfdcceda8b796.tar.lz mason-00ce6fea97d572b4c2bae204087dfdcceda8b796.tar.xz mason-00ce6fea97d572b4c2bae204087dfdcceda8b796.tar.zst mason-00ce6fea97d572b4c2bae204087dfdcceda8b796.zip | |
add sql(l)s (#43)
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer.lua | 2 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/installers/go.lua | 16 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/servers/gopls/init.lua | 16 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/servers/sqlls/init.lua | 13 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/servers/sqls/init.lua | 13 |
6 files changed, 49 insertions, 13 deletions
@@ -110,6 +110,8 @@ end - rome - rust_analyzer - solargraph (ruby) +- sqlls +- sqls - sumneko_lua - svelte - tailwindcss diff --git a/lua/nvim-lsp-installer.lua b/lua/nvim-lsp-installer.lua index 9f9e7ab4..b48119f7 100644 --- a/lua/nvim-lsp-installer.lua +++ b/lua/nvim-lsp-installer.lua @@ -26,6 +26,8 @@ local _SERVERS = { ["rome"] = require("nvim-lsp-installer.servers.rome"), ["rust_analyzer"] = require("nvim-lsp-installer.servers.rust_analyzer"), ["solargraph"] = require("nvim-lsp-installer.servers.solargraph"), + ["sqlls"] = require("nvim-lsp-installer.servers.sqlls"), + ["sqls"] = require("nvim-lsp-installer.servers.sqls"), ["sumneko_lua"] = require("nvim-lsp-installer.servers.sumneko_lua"), ["svelte"] = require("nvim-lsp-installer.servers.svelte"), ["tailwindcss"] = require("nvim-lsp-installer.servers.tailwindcss"), diff --git a/lua/nvim-lsp-installer/installers/go.lua b/lua/nvim-lsp-installer/installers/go.lua new file mode 100644 index 00000000..f4c85248 --- /dev/null +++ b/lua/nvim-lsp-installer/installers/go.lua @@ -0,0 +1,16 @@ +local path = require("nvim-lsp-installer.path") +local shell = require("nvim-lsp-installer.installers.shell") + +local M = {} + +function M.packages(packages) + return shell.raw(("go get %s"):format(table.concat(packages, " ")), { + prefix = [[set -euo pipefail; export GO111MODULE=on; export GOBIN="$PWD"; export GOPATH="$PWD";]] + }) +end + +function M.executable(root_dir, executable) + return path.concat { root_dir, executable } +end + +return M diff --git a/lua/nvim-lsp-installer/servers/gopls/init.lua b/lua/nvim-lsp-installer/servers/gopls/init.lua index fe0ebea9..71127327 100644 --- a/lua/nvim-lsp-installer/servers/gopls/init.lua +++ b/lua/nvim-lsp-installer/servers/gopls/init.lua @@ -1,24 +1,14 @@ local server = require("nvim-lsp-installer.server") local path = require("nvim-lsp-installer.path") -local shell = require("nvim-lsp-installer.installers.shell") +local go = require("nvim-lsp-installer.installers.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 { name = "gopls", root_dir = root_dir, - pre_install_check = function () - if vim.fn.executable("go") ~= 1 then - error("Please install the Go CLI before installing gopls (https://golang.org/doc/install).") - end - end, - installer = shell.raw(install_cmd), + installer = go.packages { "golang.org/x/tools/gopls@latest" }, default_options = { - cmd = { path.concat { root_dir, "gopls" } }, + cmd = { go.executable(root_dir, "gopls") }, } } diff --git a/lua/nvim-lsp-installer/servers/sqlls/init.lua b/lua/nvim-lsp-installer/servers/sqlls/init.lua new file mode 100644 index 00000000..d2c9ef68 --- /dev/null +++ b/lua/nvim-lsp-installer/servers/sqlls/init.lua @@ -0,0 +1,13 @@ +local server = require("nvim-lsp-installer.server") +local npm = require("nvim-lsp-installer.installers.npm") + +local root_dir = server.get_server_root_path("sqlls") + +return server.Server:new { + name = "sqlls", + root_dir = root_dir, + installer = npm.packages { "sql-language-server" }, + default_options = { + cmd = { npm.executable(root_dir, "sql-language-server") }, + } +} diff --git a/lua/nvim-lsp-installer/servers/sqls/init.lua b/lua/nvim-lsp-installer/servers/sqls/init.lua new file mode 100644 index 00000000..5a9eebbc --- /dev/null +++ b/lua/nvim-lsp-installer/servers/sqls/init.lua @@ -0,0 +1,13 @@ +local server = require("nvim-lsp-installer.server") +local go = require("nvim-lsp-installer.installers.go") + +local root_dir = server.get_server_root_path("sqls") + +return server.Server:new { + name = "sqls", + root_dir = root_dir, + installer = go.packages { "github.com/lighttiger2505/sqls" }, + default_options = { + cmd = { go.executable(root_dir, "sqls") }, + } +} |
