update json

This commit is contained in:
xfy
2024-09-11 09:36:00 +08:00
parent 3b7963c50a
commit aeb0df7f4f
3 changed files with 22 additions and 3 deletions

View File

@ -0,0 +1,3 @@
return {
{ "b0o/schemastore.nvim", version = false }, -- json schema store
}

View File

@ -1,11 +1,10 @@
return {
{ "b0o/schemastore.nvim" }, -- json schema store
{
"neovim/nvim-lspconfig",
dependencies = {
{ "hrsh7th/cmp-nvim-lsp" },
{ "antosha417/nvim-lsp-file-operations", config = true },
{ "folke/neodev.nvim", opts = {} },
{ "folke/neodev.nvim", opts = {} },
},
opts = { document_highlight = { enabled = false } },
config = function()
@ -100,6 +99,23 @@ return {
lspconfig["vtsls"].setup(require("rua.config.vtsls"))
map("n", "<leader>co", "<cmd> OrganizeImports <CR>", { desc = "Organize imports" })
end,
["jsonls"] = function()
lspconfig["jsonls"].setup({
-- 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 },
},
}
})
end,
["lua_ls"] = function()
lspconfig["lua_ls"].setup({
capabilities = capabilities,

View File

@ -15,7 +15,7 @@ return {
"javascript",
"typescript",
"tsx",
"json",
"json5",
"vue",
"markdown",
"markdown_inline",