summaryrefslogtreecommitdiff
path: root/dot_config/nvim_new/lsp/yamlls.lua
diff options
context:
space:
mode:
authorIbrahim Muftee <ibrahim@muftee.net>2025-08-04 07:45:42 -0500
committerIbrahim Muftee <ibrahim@muftee.net>2026-07-01 00:23:31 -0400
commit23d53b5d7bc2f31eed672c0a8d26dc608fb6d0ba (patch)
tree7b23cd20340dd0984bb1a9616744ef81c69d3b4c /dot_config/nvim_new/lsp/yamlls.lua
parent1227ae992f4494d6a3d82d70d0bb9cb01dd50847 (diff)
feat(nvim) slim down new config
Diffstat (limited to 'dot_config/nvim_new/lsp/yamlls.lua')
-rw-r--r--dot_config/nvim_new/lsp/yamlls.lua69
1 files changed, 69 insertions, 0 deletions
diff --git a/dot_config/nvim_new/lsp/yamlls.lua b/dot_config/nvim_new/lsp/yamlls.lua
new file mode 100644
index 0000000..4d2ebca
--- /dev/null
+++ b/dot_config/nvim_new/lsp/yamlls.lua
@@ -0,0 +1,69 @@
+---@brief
+---
+--- https://github.com/redhat-developer/yaml-language-server
+---
+--- `yaml-language-server` can be installed via `yarn`:
+--- ```sh
+--- yarn global add yaml-language-server
+--- ```
+---
+--- To use a schema for validation, there are two options:
+---
+--- 1. 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)
+---
+--- 2. 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 `:checkhealth vim.lsp` to determine the resolved project
+--- root.
+---
+--- ```lua
+--- vim.lsp.config('yamlls', {
+--- ...
+--- 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](https://github.com/redhat-developer/yaml-language-server/issues/211).
+--- * [#307](https://github.com/redhat-developer/yaml-language-server/issues/307).
+---
+--- To override a schema to use a specific k8s schema version (for example, to use 1.18):
+---
+--- ```lua
+--- vim.lsp.config('yamlls', {
+--- ...
+--- settings = {
+--- yaml = {
+--- ... -- other settings. note this overrides the lspconfig defaults.
+--- schemas = {
+--- ["https://raw.githubusercontent.com/yannh/kubernetes-json-schema/refs/heads/master/v1.32.1-standalone-strict/all.json"] = "/*.k8s.yaml",
+--- ... -- other schemas
+--- },
+--- },
+--- }
+--- })
+--- ```
+return {
+ cmd = { 'yaml-language-server', '--stdio' },
+ filetypes = { 'yaml', 'yaml.docker-compose', 'yaml.gitlab', 'yaml.helm-values' },
+ root_markers = { '.git' },
+ settings = {
+ -- https://github.com/redhat-developer/vscode-redhat-telemetry#how-to-disable-telemetry-reporting
+ redhat = { telemetry = { enabled = false } },
+ },
+}