41 lines
949 B
Lua
41 lines
949 B
Lua
-- This is part of LazyVim's code, with my modifications.
|
|
-- See: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/extras/lang/json.lua
|
|
|
|
return {
|
|
|
|
{
|
|
'nvim-treesitter/nvim-treesitter',
|
|
opts = function(_, opts)
|
|
if type(opts.ensure_installed) == 'table' then
|
|
vim.list_extend(opts.ensure_installed, { 'json', 'json5', 'jsonc' })
|
|
end
|
|
end,
|
|
},
|
|
|
|
{
|
|
'neovim/nvim-lspconfig',
|
|
dependencies = { 'b0o/SchemaStore.nvim', version = false },
|
|
opts = {
|
|
servers = {
|
|
jsonls = {
|
|
-- lazy-load schemastore when needed
|
|
on_new_config = 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 },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|