aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim_lsp/bashls.lua
diff options
context:
space:
mode:
authorAshkan Kiani <ashkan.k.kiani@gmail.com>2019-11-15 17:26:22 -0800
committerGitHub <noreply@github.com>2019-11-15 17:26:22 -0800
commit5686a90890105e6271307e86b472f729af1cc4f8 (patch)
tree7d691ac0e7ea2feb58c5862dd52a1c8bfbef6fb4 /lua/nvim_lsp/bashls.lua
parent[docgen] Update README.md (diff)
downloadnvim-lspconfig-5686a90890105e6271307e86b472f729af1cc4f8.tar
nvim-lspconfig-5686a90890105e6271307e86b472f729af1cc4f8.tar.gz
nvim-lspconfig-5686a90890105e6271307e86b472f729af1cc4f8.tar.bz2
nvim-lspconfig-5686a90890105e6271307e86b472f729af1cc4f8.tar.lz
nvim-lspconfig-5686a90890105e6271307e86b472f729af1cc4f8.tar.xz
nvim-lspconfig-5686a90890105e6271307e86b472f729af1cc4f8.tar.zst
nvim-lspconfig-5686a90890105e6271307e86b472f729af1cc4f8.zip
Redo installation. (#17)
* Redo installation. Servers which want to be auto installed should specify skeleton[name].install() and it will be automatically added to the list of installable servers. - Add :LspInstall and :LspInstallInfo - Auto generate docs for servers with .install() available. - Add util.npm_installer - Refactor utf8 capabilities common config into a single function - Add contribution notes. - Also expose util.base_install_dir for other installers potentially - Fix tsserver's arguments and add javascript filetypes
Diffstat (limited to 'lua/nvim_lsp/bashls.lua')
-rw-r--r--lua/nvim_lsp/bashls.lua49
1 files changed, 49 insertions, 0 deletions
diff --git a/lua/nvim_lsp/bashls.lua b/lua/nvim_lsp/bashls.lua
new file mode 100644
index 00000000..b2ae5187
--- /dev/null
+++ b/lua/nvim_lsp/bashls.lua
@@ -0,0 +1,49 @@
+local skeleton = require 'nvim_lsp/skeleton'
+local util = require 'nvim_lsp/util'
+local lsp = vim.lsp
+
+local cwd = vim.loop.cwd()
+
+local server_name = "bashls"
+local bin_name = "bash-language-server"
+
+local installer = util.npm_installer {
+ server_name = server_name;
+ packages = { "bash-language-server" };
+ binaries = {bin_name};
+}
+
+skeleton[server_name] = {
+ default_config = {
+ cmd = {"bash-language-server", "start"};
+ filetypes = {"sh"};
+ root_dir = function() return cwd end;
+ log_level = lsp.protocol.MessageType.Warning;
+ settings = {};
+ };
+ on_new_config = function(new_config)
+ local install_info = installer.info()
+ if install_info.is_installed then
+ if type(new_config.cmd) == 'table' then
+ -- Try to preserve any additional args from upstream changes.
+ new_config.cmd[1] = install_info.binaries[bin_name]
+ else
+ new_config.cmd = {install_info.binaries[bin_name]}
+ end
+ end
+ end;
+ -- on_attach = function(client, bufnr) end;
+ docs = {
+ description = [[
+For install instruction visit:
+https://github.com/mads-hartmann/bash-language-server#installation
+]];
+ default_config = {
+ root_dir = "vim's starting directory";
+ };
+ };
+};
+
+skeleton[server_name].install = installer.install
+skeleton[server_name].install_info = installer.info
+-- vim:et ts=2 sw=2