Add JSON schema fetching

This commit is contained in:
Ben Kreeger 2025-09-11 13:38:51 -05:00
parent 70533b3bb4
commit 4bc2f8de91
Signed by: kreeger
GPG Key ID: D5CF8683D4BE4B50
3 changed files with 37 additions and 2 deletions

View File

@ -26,6 +26,7 @@
"nvim-web-devicons": { "branch": "master", "commit": "6e51ca170563330e063720449c21f43e27ca0bc1" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"project-cli-commands.nvim": { "branch": "main", "commit": "9a2a2fdfd38a3d71cc927e3a398ac0ddfa846b3d" },
"schemastore.nvim": { "branch": "main", "commit": "d522e3ed6ed2c7bed7ebe1e42615e79b3aabfe65" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },

31
nvim/lsp/jsonls.lua Normal file
View File

@ -0,0 +1,31 @@
return {
settings = {
json = {
schemas = require("schemastore").json.schemas({
select = {
"devcontainer.json",
"devcontainer-feature.json",
},
replace = {
["devcontainer.json"] = {
description = "devcontainer.json overridden",
-- fileMatch has to be a table
fileMatch = { "devcontainer.json" },
name = "devcontainer.json",
url = "https://raw.githubusercontent.com/devcontainers/spec/refs/heads/main/schemas/devContainer.base.schema.json",
},
},
extra = {
{
description = "devcontainer-feature.json",
-- fileMatch has to be a table
fileMatch = { "devcontainer-feature.json" },
name = "devcontainer-feature.json",
url = "https://raw.githubusercontent.com/devcontainers/spec/refs/heads/main/schemas/devContainerFeature.schema.json",
},
},
}),
validate = { enable = true },
},
},
}

View File

@ -1,12 +1,13 @@
local mason_lsps = {
-- LSPs
"json-lsp",
"jsonls",
"lua_ls",
"ruby_lsp",
"rubocop",
"rust_analyzer",
"terraformls",
"ts_ls",
"yamlls",
-- Formatters
"fixjson",
"goimports",
@ -14,7 +15,6 @@ local mason_lsps = {
"prettierd",
"shellharden",
"stylua",
"yamlfix",
}
local non_mason_lsps = {
@ -51,6 +51,7 @@ return {
"WhoIsSethDaniel/mason-tool-installer.nvim",
{ "j-hui/fidget.nvim", opts = {} },
"saghen/blink.cmp",
"b0o/schemastore.nvim",
},
config = function()
for _, server in ipairs(non_mason_lsps) do
@ -78,6 +79,8 @@ return {
map("lr", vim.lsp.buf.rename, "[r]ename")
map("lsb", require("telescope.builtin").lsp_document_symbols, "[s]ymbols in [b]uffer")
map("lsw", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[s]ymbols in [w]orkspace")
map("lhs", "<cmd>LspInfo<CR>", "[h]ealth [s]tatus")
map("lhr", "<cmd>LspRestart<CR>", "[h]ealth [r]estart")
local client = vim.lsp.get_client_by_id(event.data.client_id)
local augroup = vim.api.nvim_create_augroup