
* fix(yaml): enable validate see https://github.com/redhat-developer/yaml-language-server#language-server-settings * feat(yaml): support line folding
60 lines
1.7 KiB
Lua
60 lines
1.7 KiB
Lua
return {
|
|
|
|
-- add yaml specific modules to treesitter
|
|
{
|
|
"nvim-treesitter/nvim-treesitter",
|
|
opts = function(_, opts)
|
|
if type(opts.ensure_installed) == "table" then
|
|
vim.list_extend(opts.ensure_installed, { "yaml" })
|
|
end
|
|
end,
|
|
},
|
|
|
|
-- correctly setup lspconfig
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
dependencies = {
|
|
"b0o/SchemaStore.nvim",
|
|
version = false, -- last release is way too old
|
|
},
|
|
opts = {
|
|
-- make sure mason installs the server
|
|
servers = {
|
|
yamlls = {
|
|
-- Have to add this for yamlls to understand that we support line folding
|
|
capabilities = {
|
|
textDocument = {
|
|
foldingRange = {
|
|
dynamicRegistration = false,
|
|
lineFoldingOnly = true,
|
|
},
|
|
},
|
|
},
|
|
-- lazy-load schemastore when needed
|
|
on_new_config = function(new_config)
|
|
new_config.settings.yaml.schemas = new_config.settings.yaml.schemas or {}
|
|
vim.list_extend(new_config.settings.yaml.schemas, require("schemastore").yaml.schemas())
|
|
end,
|
|
settings = {
|
|
redhat = { telemetry = { enabled = false } },
|
|
yaml = {
|
|
keyOrdering = false,
|
|
format = {
|
|
enable = true,
|
|
},
|
|
validate = true,
|
|
schemaStore = {
|
|
-- Must disable built-in schemaStore support to use
|
|
-- schemas from SchemaStore.nvim plugin
|
|
enable = false,
|
|
-- Avoid TypeError: Cannot read properties of undefined (reading 'length')
|
|
url = "",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|