fix: Adding in yamlls setup with the newer lspconfig arrangement

This commit is contained in:
2026-08-17 10:02:56 -05:00
parent baa8f03870
commit 76845fee2c
2 changed files with 15 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ declare -A lsp_arr=(
["pylsp"]="Install the pylsp provider: python-language-server or pylsp"
["pylint"]="Install the pylint provider: pylint"
["rust-analyzer"]="Install the rust-analyzer provider"
["pyright"]="Install the pyright provider"
["yaml-language-server"]="Install the yamlls provider: yaml-language-server (via npm globally or system package)"
)
echo '----- Checking for LSP servers...'

View File

@@ -1,6 +1,11 @@
-- YAML LSP specific settings with a number of custom tags specifically for use with AWS CloudFormation templates
return {
cmd = function (dispatchers, _)
return vim.lsp.rpc.start({'yaml-language-server', '--stdio'}, dispatchers)
end,
filetypes = { 'yaml', 'yaml.docker-compose', 'yaml.gitlab', 'yaml.helm-values' },
root_markers = { '.git' },
settings = {
redhat = { telemetry = { enabled = false } },
yaml = {
@@ -29,5 +34,13 @@ return {
schemaStore = { enable = true },
validate = true,
}
}
},
on_init = function(client)
-- From nvim-lspconfig's yamlls.lua
--- https://github.com/neovim/nvim-lspconfig/pull/4016
--- Since formatting is disabled by default if you check `client:supports_method('textDocument/formatting')`
--- during `LspAttach` it will return `false`. This hack sets the capability to `true` to facilitate
--- autocmd's which check this capability
client.server_capabilities.documentFormattingProvider = true
end,
}