mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-12-25 12:14:19 +01:00
## Description `vim.lsp.config` doesn't provide `on_new_config`, which is causing `b0o/SchemaStore.nvim` fail to load. This PR replaces `on_new_config` with `before_init` fixing the issue. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
61 lines
1.6 KiB
Lua
61 lines
1.6 KiB
Lua
return {
|
|
recommended = function()
|
|
return LazyVim.extras.wants({
|
|
ft = "yaml",
|
|
})
|
|
end,
|
|
|
|
-- yaml schema support
|
|
{
|
|
"b0o/SchemaStore.nvim",
|
|
lazy = true,
|
|
version = false, -- last release is way too old
|
|
},
|
|
|
|
-- correctly setup lspconfig
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
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
|
|
before_init = function(_, new_config)
|
|
new_config.settings.yaml.schemas = vim.tbl_deep_extend(
|
|
"force",
|
|
new_config.settings.yaml.schemas or {},
|
|
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 = "",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|