Files
dotfiles/nvim/after/lsp/yamlls.lua

47 lines
1.6 KiB
Lua

-- 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 = {
customTags = {
"!fn",
"!And",
"!If",
"!Not",
"!Equals",
"!Or",
"!FindInMap sequence",
"!Base64",
"!Cidr",
"!Ref",
"!Ref Scalar",
"!Sub",
"!GetAtt",
"!GetAZs",
"!ImportValue",
"!Select",
"!Split",
"!Join sequence"
},
format = { enable = true, singleQuote = true },
hover = true,
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,
}