refactor: LazyVim.lsp.on_attach

This commit is contained in:
Folke Lemaitre 2024-06-08 08:11:28 +02:00
parent 6098a36d92
commit 8f7ee56dab
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
6 changed files with 32 additions and 42 deletions

View file

@ -1,13 +1,3 @@
LazyVim.lsp.on_attach(function(client, buffer)
if client.name == "yamlls" then
if vim.api.nvim_get_option_value("filetype", { buf = buffer }) == "helm" then
vim.schedule(function()
vim.cmd("LspStop ++force yamlls")
end)
end
end
end)
return {
recommended = function()
return LazyVim.extras.wants({
@ -25,9 +15,19 @@ return {
"neovim/nvim-lspconfig",
opts = {
servers = {
yamlls = {},
helm_ls = {},
},
setup = {
yamlls = function()
LazyVim.lsp.on_attach(function(client, buffer)
if vim.bo[buffer].filetype == "helm" then
vim.schedule(function()
vim.cmd("LspStop ++force yamlls")
end)
end
end, "yamlls")
end,
},
},
},
}