aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md139
-rw-r--r--lua/nvim_lsp.lua1
-rw-r--r--lua/nvim_lsp/yamlls.lua50
3 files changed, 190 insertions, 0 deletions
diff --git a/README.md b/README.md
index 51b7a523..01f2e986 100644
--- a/README.md
+++ b/README.md
@@ -219,6 +219,7 @@ that config.
- [texlab](#texlab)
- [tsserver](#tsserver)
- [vimls](#vimls)
+- [yamlls](#yamlls)
## bashls
@@ -2521,3 +2522,141 @@ require'nvim_lsp'.vimls.setup{}
settings = {}
```
+## yamlls
+
+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
+```
+
+Can be installed in Nvim with `:LspInstall yamlls`
+This server accepts configuration via the `settings` key.
+<details><summary>Available settings:</summary>
+
+- **`yaml.completion`**: `boolean`
+
+ Default: `true`
+
+ Enable/disable completion feature
+
+- **`yaml.customTags`**: `array`
+
+ Default: `{}`
+
+ Custom tags for the parser to use
+
+- **`yaml.format.bracketSpacing`**: `boolean`
+
+ Default: `true`
+
+ Print spaces between brackets in objects
+
+- **`yaml.format.enable`**: `boolean`
+
+ Default: `true`
+
+ Enable/disable default YAML formatter
+
+- **`yaml.format.printWidth`**: `integer`
+
+ Default: `80`
+
+ Specify the line length that the printer will wrap on
+
+- **`yaml.format.proseWrap`**: `enum { "preserve", "never", "always" }`
+
+ Default: `"preserve"`
+
+ Always: wrap prose if it exeeds the print width, Never: never wrap the prose, Preserve: wrap prose as-is
+
+- **`yaml.format.singleQuote`**: `boolean`
+
+ Use single quotes instead of double quotes
+
+- **`yaml.hover`**: `boolean`
+
+ Default: `true`
+
+ Enable/disable hover feature
+
+- **`yaml.schemaStore.enable`**: `boolean`
+
+ Default: `true`
+
+ Automatically pull available YAML schemas from JSON Schema Store
+
+- **`yaml.schemas`**: `object`
+
+ Default: `vim.empty_dict()`
+
+ Associate schemas to YAML files in the current workspace
+
+- **`yaml.trace.server`**: `enum { "off", "messages", "verbose" }`
+
+ Default: `"off"`
+
+ Traces the communication between VSCode and the YAML language service.
+
+- **`yaml.validate`**: `boolean`
+
+ Default: `true`
+
+ Enable/disable validation feature
+
+</details>
+
+```lua
+require'nvim_lsp'.yamlls.setup{}
+
+ Default Values:
+ capabilities = {
+ offsetEncoding = { "utf-8", "utf-16" },
+ textDocument = {
+ completion = {
+ completionItem = {
+ commitCharactersSupport = false,
+ deprecatedSupport = false,
+ documentationFormat = { "markdown", "plaintext" },
+ preselectSupport = false,
+ snippetSupport = false
+ },
+ completionItemKind = {
+ valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }
+ },
+ contextSupport = false,
+ dynamicRegistration = false
+ },
+ documentHighlight = {
+ dynamicRegistration = false
+ },
+ hover = {
+ contentFormat = { "markdown", "plaintext" },
+ dynamicRegistration = false
+ },
+ references = {
+ dynamicRegistration = false
+ },
+ signatureHelp = {
+ dynamicRegistration = false,
+ signatureInformation = {
+ documentationFormat = { "markdown", "plaintext" }
+ }
+ },
+ synchronization = {
+ didSave = true,
+ dynamicRegistration = false,
+ willSave = false,
+ willSaveWaitUntil = false
+ }
+ }
+ }
+ cmd = { "yaml-language-server", "--stdio" }
+ filetypes = { "yaml" }
+ log_level = 2
+ on_init = <function 1>
+ root_dir = root_pattern(".git", vim.fn.getcwd())
+ settings = {}
+```
+
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