mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-07-07 16:04:35 +02:00
refactor: LazyVim.lsp.on_attach
This commit is contained in:
parent
6098a36d92
commit
8f7ee56dab
6 changed files with 32 additions and 42 deletions
|
@ -66,10 +66,8 @@ return {
|
|||
-- attach cmp source whenever copilot attaches
|
||||
-- fixes lazy-loading issues with the copilot cmp source
|
||||
LazyVim.lsp.on_attach(function(client)
|
||||
if client.name == "copilot" then
|
||||
copilot_cmp._on_insert_enter({})
|
||||
end
|
||||
end)
|
||||
end, "copilot")
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -36,11 +36,9 @@ return {
|
|||
setup = {
|
||||
angularls = function()
|
||||
LazyVim.lsp.on_attach(function(client)
|
||||
if client.name == "angularls" then
|
||||
--HACK: disable angular renaming capability due to duplicate rename popping up
|
||||
client.server_capabilities.renameProvider = false
|
||||
end
|
||||
end)
|
||||
end, "angularls")
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -61,7 +61,6 @@ return {
|
|||
-- workaround for gopls not supporting semanticTokensProvider
|
||||
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242
|
||||
LazyVim.lsp.on_attach(function(client, _)
|
||||
if client.name == "gopls" then
|
||||
if not client.server_capabilities.semanticTokensProvider then
|
||||
local semantic = client.config.capabilities.textDocument.semanticTokens
|
||||
client.server_capabilities.semanticTokensProvider = {
|
||||
|
@ -73,8 +72,7 @@ return {
|
|||
range = true,
|
||||
}
|
||||
end
|
||||
end
|
||||
end)
|
||||
end, "gopls")
|
||||
-- end workaround
|
||||
end,
|
||||
},
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -58,11 +58,9 @@ return {
|
|||
setup = {
|
||||
[ruff] = function()
|
||||
LazyVim.lsp.on_attach(function(client, _)
|
||||
if client.name == ruff then
|
||||
-- Disable hover in favor of Pyright
|
||||
client.server_capabilities.hoverProvider = false
|
||||
end
|
||||
end)
|
||||
end, ruff)
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -60,10 +60,8 @@ return {
|
|||
-- Neovim < 0.10 does not have dynamic registration for formatting
|
||||
if vim.fn.has("nvim-0.10") == 0 then
|
||||
LazyVim.lsp.on_attach(function(client, _)
|
||||
if client.name == "yamlls" then
|
||||
client.server_capabilities.documentFormattingProvider = true
|
||||
end
|
||||
end)
|
||||
end, "yamlls")
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue