yamlls
URL: https://github.com/redhat-developer/yaml-language-server
plugins.lsp.servers.yamlls.enable
Whether to enable https://github.com/redhat-developer/yaml-language-server
yaml-language-server
can be installed via yarn
:
yarn global add yaml-language-server
To use a schema for validation, there are two options:
- Add a modeline to the file. A modeline is a comment of the form:
<!-- -->
# yaml-language-server: $schema=<urlToTheSchema|relativeFilePath|absoluteFilePath}>
where the relative filepath is the path relative to the open yaml file, and the absolute filepath is the filepath relative to the filesystem root (‘/’ on unix systems)
- Associated a schema url, relative , or absolute (to root of project,
not to filesystem root) path to the a glob pattern relative to the
detected project root. Check
:LspInfo
to determine the resolved project root.
require('lspconfig').yamlls.setup {
... -- other configuration for setup {}
settings = {
yaml = {
... -- other settings. note this overrides the lspconfig defaults.
schemas = {
["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*",
["../path/relative/to/file.yml"] = "/.github/workflows/*",
["/path/from/root/of/project"] = "/.github/workflows/*",
},
},
}
}
Currently, kubernetes is special-cased in yammls, see the following upstream issues: * #211. * #307.
To override a schema to use a specific k8s schema version (for example, to use 1.18):
require('lspconfig').yamlls.setup {
... -- other configuration for setup {}
settings = {
yaml = {
... -- other settings. note this overrides the lspconfig defaults.
schemas = {
["https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/v1.18.0-standalone-strict/all.json"] = "/*.k8s.yaml",
... -- other schemas
},
},
}
}
.
Type: boolean
Default:
false
Example:
true
Declared by:
plugins.lsp.servers.yamlls.package
The yamlls package to use.
Type: null or package
Default:
pkgs.yaml-language-server
Declared by:
plugins.lsp.servers.yamlls.autostart
Controls if the FileType
autocommand that launches a language server is created.
If false
, allows for deferring language servers until manually launched with
:LspStart
(|lspconfig-commands|).
Type: null or boolean or raw lua code
Default:
null
Plugin default: true
Declared by:
plugins.lsp.servers.yamlls.cmd
A list where each entry corresponds to the blankspace delimited part of the command that launches the server.
The first entry is the binary used to run the language server. Additional entries are passed as arguments.
Type: null or (list of string)
Default:
null
Declared by:
plugins.lsp.servers.yamlls.extraOptions
Extra options for the yamlls language server.
Type: attribute set of anything
Default:
{ }
Declared by:
plugins.lsp.servers.yamlls.filetypes
Set of filetypes for which to attempt to resolve {root_dir}. May be empty, or server may specify a default value.
Type: null or (list of string)
Default:
null
Declared by:
plugins.lsp.servers.yamlls.rootDir
A function (or function handle) which returns the root of the project used to determine if lspconfig should launch a new language server, or attach a previously launched server when you open a new buffer matching the filetype of the server.
Type: null or lua function string
Default:
null
Plugin default: "nil"
Declared by:
plugins.lsp.servers.yamlls.settings
The settings for this LSP.
Type: attribute set of anything
Default:
{ }
Example:
{
callback = {
__raw = ''
function()
print('nixvim')
end
'';
};
foo_bar = 42;
hostname = "localhost:8080";
}
Declared by: