fix(lsp): properly register capabilities with new vim.lsp.config. Not needed for blink

This commit is contained in:
Folke Lemaitre
2025-09-16 15:41:20 +02:00
parent 6e1de74597
commit 9fa832dc95
2 changed files with 8 additions and 12 deletions

View File

@@ -25,6 +25,9 @@ return {
-- }
-- ```
opts = function()
-- Register nvim-cmp lsp capabilities
vim.lsp.config("*", { capabilities = require("cmp_nvim_lsp").default_capabilities() })
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
local cmp = require("cmp")
local defaults = require("cmp.config.default")()

View File

@@ -63,7 +63,7 @@ return {
timeout_ms = nil,
},
-- LSP Server Settings
---@type table<string, vim.lsp.Config>
---@type table<string, vim.lsp.Config|{mason?:boolean, enabled?:boolean}|boolean>
servers = {
lua_ls = {
-- mason = false, -- set to false if you don't want this server to be installed with mason
@@ -163,14 +163,9 @@ return {
end
vim.diagnostic.config(vim.deepcopy(opts.diagnostics))
local capabilities = vim.tbl_deep_extend(
"force",
{},
vim.lsp.protocol.make_client_capabilities(),
LazyVim.has("nvim-cmp") and require("cmp_nvim_lsp").default_capabilities() or {},
LazyVim.has("blink.nvim") and require("blink.cmp").get_lsp_capabilities() or {},
opts.capabilities or {}
)
if opts.capabilities then
vim.lsp.config("*", { capabilities = opts.capabilities })
end
-- get all the servers that are available through mason-lspconfig
local have_mason = LazyVim.has("mason-lspconfig.nvim")
@@ -181,9 +176,7 @@ return {
local exclude_automatic_enable = {} ---@type string[]
local function configure(server)
local server_opts = vim.tbl_deep_extend("force", {
capabilities = vim.deepcopy(capabilities),
}, opts.servers[server] or {})
local server_opts = opts.servers[server] or {}
local setup = opts.setup[server] or opts.setup["*"]
if setup and setup(server, server_opts) then