nvim: updated yamlls schemas for k8s + friends

This commit is contained in:
Daniel Lundin 2024-02-08 10:23:41 +01:00
parent affaebbc13
commit 09b2992cce
2 changed files with 35 additions and 25 deletions

View file

@ -0,0 +1,35 @@
return {
{
"neovim/nvim-lspconfig",
opts = {
inlay_hints = { enabled = true },
capabilities = {
workspace = {
didChangeWatchedFiles = {
dynamicRegistration = false,
},
},
},
---@type lspconfig.options
servers = {
yamlls = {
settings = {
yaml = {
schemas = {
kubernetes = "*.yaml",
["http://json.schemastore.org/github-workflow"] = ".github/workflows/*",
["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}",
["http://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}",
["http://json.schemastore.org/kustomization"] = "kustomization.{yml,yaml}",
["http://json.schemastore.org/chart"] = "Chart.{yml,yaml}",
["https://json.schemastore.org/dependabot-v2"] = ".github/dependabot.{yml,yaml}",
["https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"] = "*api*.{yml,yaml}",
["https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.29.1/all.json"] = "/*.yaml",
},
},
},
},
},
},
},
}

View file

@ -1,25 +0,0 @@
return {
{
"someone-stole-my-name/yaml-companion.nvim",
dependencies = {
{ "neovim/nvim-lspconfig" },
{ "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope.nvim" },
},
config = function()
require("yaml-companion").setup()
require("telescope").load_extension("yaml_schema")
local cfg = require("yaml-companion").setup({
-- Add any options here, or leave empty to use the default settings
-- Additional schemas available in Telescope picker
schemas = {
{
name = "Kubernetes 1.25.9",
uri = "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.25.9-standalone-strict/all.json",
},
},
})
require("lspconfig")["yamlls"].setup(cfg)
end,
},
}