From 4bc2f8de915fa263cbbaf79793e4e0762e000ece Mon Sep 17 00:00:00 2001 From: Ben Kreeger Date: Thu, 11 Sep 2025 13:38:51 -0500 Subject: [PATCH] Add JSON schema fetching --- nvim/lazy-lock.json | 1 + nvim/lsp/jsonls.lua | 31 +++++++++++++++++++++++++++++++ nvim/lua/plugins/40-lsp.lua | 7 +++++-- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 nvim/lsp/jsonls.lua diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index e5c00eb..f29ae38 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -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" }, diff --git a/nvim/lsp/jsonls.lua b/nvim/lsp/jsonls.lua new file mode 100644 index 0000000..f9373ad --- /dev/null +++ b/nvim/lsp/jsonls.lua @@ -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 }, + }, + }, +} diff --git a/nvim/lua/plugins/40-lsp.lua b/nvim/lua/plugins/40-lsp.lua index 695978f..99c0588 100644 --- a/nvim/lua/plugins/40-lsp.lua +++ b/nvim/lua/plugins/40-lsp.lua @@ -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", "LspInfo", "[h]ealth [s]tatus") + map("lhr", "LspRestart", "[h]ealth [r]estart") local client = vim.lsp.get_client_by_id(event.data.client_id) local augroup = vim.api.nvim_create_augroup