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.
47 lines
1.1 KiB
Lua
47 lines
1.1 KiB
Lua
return {
|
|
recommended = function()
|
|
return LazyVim.extras.wants({
|
|
ft = { "json", "jsonc", "json5" },
|
|
root = { "*.json" },
|
|
})
|
|
end,
|
|
|
|
-- add json to treesitter
|
|
{
|
|
"nvim-treesitter/nvim-treesitter",
|
|
opts = { ensure_installed = { "json5" } },
|
|
},
|
|
|
|
-- 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 = {
|
|
jsonls = {
|
|
-- lazy-load schemastore when needed
|
|
before_init = function(_, new_config)
|
|
new_config.settings.json.schemas = new_config.settings.json.schemas or {}
|
|
vim.list_extend(new_config.settings.json.schemas, require("schemastore").json.schemas())
|
|
end,
|
|
settings = {
|
|
json = {
|
|
format = {
|
|
enable = true,
|
|
},
|
|
validate = { enable = true },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|