diff options
| author | Hirokazu Hata <h.hata.ai.t@gmail.com> | 2020-01-06 01:46:06 +0900 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2020-01-05 08:46:06 -0800 |
| commit | 7a15a52c0a7d735625ac73dc4d8efe70c5e99707 (patch) | |
| tree | 15c8ad83e84e1ee38168b3cf6f6190e7e16c34ab /lua | |
| parent | terraform-lsp #90 (diff) | |
| download | nvim-lspconfig-7a15a52c0a7d735625ac73dc4d8efe70c5e99707.tar nvim-lspconfig-7a15a52c0a7d735625ac73dc4d8efe70c5e99707.tar.gz nvim-lspconfig-7a15a52c0a7d735625ac73dc4d8efe70c5e99707.tar.bz2 nvim-lspconfig-7a15a52c0a7d735625ac73dc4d8efe70c5e99707.tar.lz nvim-lspconfig-7a15a52c0a7d735625ac73dc4d8efe70c5e99707.tar.xz nvim-lspconfig-7a15a52c0a7d735625ac73dc4d8efe70c5e99707.tar.zst nvim-lspconfig-7a15a52c0a7d735625ac73dc4d8efe70c5e99707.zip | |
yaml-language-server #88
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim_lsp.lua | 1 | ||||
| -rw-r--r-- | lua/nvim_lsp/yamlls.lua | 50 |
2 files changed, 51 insertions, 0 deletions
diff --git a/lua/nvim_lsp.lua b/lua/nvim_lsp.lua index a9bd1d07..dffdb6ae 100644 --- a/lua/nvim_lsp.lua +++ b/lua/nvim_lsp.lua @@ -24,6 +24,7 @@ require 'nvim_lsp/tsserver' require 'nvim_lsp/vimls' require 'nvim_lsp/ocamlls' require 'nvim_lsp/terraformls' +require 'nvim_lsp/yamlls' local M = { util = require 'nvim_lsp/util'; diff --git a/lua/nvim_lsp/yamlls.lua b/lua/nvim_lsp/yamlls.lua new file mode 100644 index 00000000..2f0d0337 --- /dev/null +++ b/lua/nvim_lsp/yamlls.lua @@ -0,0 +1,50 @@ +local skeleton = require 'nvim_lsp/skeleton' +local util = require 'nvim_lsp/util' +local lsp = vim.lsp + +local server_name = "yamlls" +local bin_name = "yaml-language-server" + +local installer = util.npm_installer { + server_name = server_name; + packages = {bin_name}; + binaries = {bin_name}; +} + +skeleton[server_name] = { + default_config = util.utf8_config { + cmd = {bin_name, "--stdio"}; + filetypes = {"yaml"}; + root_dir = util.root_pattern(".git", vim.fn.getcwd()); + 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 + new_config.cmd[1] = install_info.binaries[bin_name] + else + new_config.cmd = {install_info.binaries[bin_name]} + end + end + end; + docs = { + vscode = "redhat.vscode-yaml"; + description = [[ +https://github.com/redhat-developer/yaml-language-server + +`yaml-language-server` can be installed via `:LspInstall yamlls` or by yourself with `npm`: +```sh +npm install -g yaml-language-server +``` +]]; + default_config = { + root_dir = [[root_pattern(".git", vim.fn.getcwd())]]; + }; + }; +} + +skeleton[server_name].install = installer.install +skeleton[server_name].install_info = installer.info +-- vim:et ts=2 sw=2 |
