Add SchemaStore and configure it for Yaml and Json.

Reformat lsp.lua: tabs to spaces.
This commit is contained in:
Hans Goor 2024-11-23 12:44:27 +01:00
parent b21ce1860d
commit ae871c6d3d
Signed by: eyedevelop
SSH key fingerprint: SHA256:Td89veptDEwCV8J3fjqnknNk7SbwzedYhauyC2nFBYg
2 changed files with 37 additions and 12 deletions

View file

@ -17,6 +17,28 @@ require("mason-lspconfig").setup({
},
})
local lspconfig = require("lspconfig")
lspconfig.yamlls.setup {
settings = {
yaml = {
schemaStore = {
enable = false,
url = "",
},
schemas = require("schemastore").yaml.schemas(),
},
},
}
lspconfig.jsonls.setup {
settings = {
json = {
schemas = require("schemastore").json.schemas(),
validate = { enable = true, },
},
},
}
local cmp = require("cmp")
cmp.setup({
mapping = cmp.mapping.preset.insert({

View file

@ -64,6 +64,9 @@ return require("packer").startup(function(use)
{ "hrsh7th/nvim-cmp" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "L3MON4D3/LuaSnip" },
-- Json/Yaml schemas
{ "b0o/schemastore.nvim", branch = "main" },
}
}