Files
LazyVim/lua/lazyvim/plugins/extras/lang/json.lua
2023-01-10 11:14:27 +01:00

37 lines
925 B
Lua

return {
-- add json to treesitter
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, { "json", "json5", "jsonc" })
end,
},
-- correctly setup lspconfig
{
"neovim/nvim-lspconfig",
dependencies = { "b0o/SchemaStore.nvim" },
opts = {
-- make sure mason installs the server
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 },
},
},
},
},
},
},
}