- "desc": "https://github.com/redhat-developer/yaml-language-server\n\n`yaml-language-server` can be installed via `yarn`:\n\n``` sh\nyarn global add yaml-language-server\n```\n\nTo use a schema for validation, there are two options:\n\n1. Add a modeline to the file. A modeline is a comment of the form:\n\n```{=html}\n<!-- -->\n```\n # yaml-language-server: $schema=<urlToTheSchema|relativeFilePath|absoluteFilePath}>\n\nwhere the relative filepath is the path relative to the open yaml file,\nand the absolute filepath is the filepath relative to the filesystem\nroot ('/' on unix systems)\n\n2. Associated a schema url, relative , or absolute (to root of project,\n not to filesystem root) path to the a glob pattern relative to the\n detected project root. Check `:LspInfo` to determine the resolved\n project root.\n\n``` lua\nrequire('lspconfig').yamlls.setup {\n ... -- other configuration for setup {}\n settings = {\n yaml = {\n ... -- other settings. note this overrides the lspconfig defaults.\n schemas = {\n [\"https://json.schemastore.org/github-workflow.json\"] = \"/.github/workflows/*\",\n [\"../path/relative/to/file.yml\"] = \"/.github/workflows/*\",\n [\"/path/from/root/of/project\"] = \"/.github/workflows/*\",\n },\n },\n }\n}\n```\n\nCurrently, kubernetes is special-cased in yammls, see the following\nupstream issues: \\*\n[#211](https://github.com/redhat-developer/yaml-language-server/issues/211).\n\\*\n[#307](https://github.com/redhat-developer/yaml-language-server/issues/307).\n\nTo override a schema to use a specific k8s schema version (for example,\nto use 1.18):\n\n``` lua\nrequire('lspconfig').yamlls.setup {\n ... -- other configuration for setup {}\n settings = {\n yaml = {\n ... -- other settings. note this overrides the lspconfig defaults.\n schemas = {\n [\"https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/v1.18.0-standalone-strict/all.json\"] = \"/*.k8s.yaml\",\n ... -- other schemas\n },\n },\n }\n}\n```\n",
0 commit comments