diff options
Diffstat (limited to 'lua/nvim_lsp/bashls.lua')
| -rw-r--r-- | lua/nvim_lsp/bashls.lua | 49 |
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 |
