mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-25 10:18:47 +02:00
feat(lang): added json support
This commit is contained in:
parent
15f179c3b0
commit
011356e70e
1 changed files with 36 additions and 0 deletions
36
lua/lazyvim/plugins/extras/lang/json.lua
Normal file
36
lua/lazyvim/plugins/extras/lang/json.lua
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
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 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue