mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-21 20:11:06 +00:00
fix(lsp): properly register capabilities with new vim.lsp.config. Not needed for blink
This commit is contained in:
parent
6e1de74597
commit
9fa832dc95
2 changed files with 8 additions and 12 deletions
|
|
@ -25,6 +25,9 @@ return {
|
||||||
-- }
|
-- }
|
||||||
-- ```
|
-- ```
|
||||||
opts = function()
|
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 })
|
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
local defaults = require("cmp.config.default")()
|
local defaults = require("cmp.config.default")()
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ return {
|
||||||
timeout_ms = nil,
|
timeout_ms = nil,
|
||||||
},
|
},
|
||||||
-- LSP Server Settings
|
-- LSP Server Settings
|
||||||
---@type table<string, vim.lsp.Config>
|
---@type table<string, vim.lsp.Config|{mason?:boolean, enabled?:boolean}|boolean>
|
||||||
servers = {
|
servers = {
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
-- mason = false, -- set to false if you don't want this server to be installed with mason
|
-- mason = false, -- set to false if you don't want this server to be installed with mason
|
||||||
|
|
@ -163,14 +163,9 @@ return {
|
||||||
end
|
end
|
||||||
vim.diagnostic.config(vim.deepcopy(opts.diagnostics))
|
vim.diagnostic.config(vim.deepcopy(opts.diagnostics))
|
||||||
|
|
||||||
local capabilities = vim.tbl_deep_extend(
|
if opts.capabilities then
|
||||||
"force",
|
vim.lsp.config("*", { capabilities = opts.capabilities })
|
||||||
{},
|
end
|
||||||
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 {}
|
|
||||||
)
|
|
||||||
|
|
||||||
-- get all the servers that are available through mason-lspconfig
|
-- get all the servers that are available through mason-lspconfig
|
||||||
local have_mason = LazyVim.has("mason-lspconfig.nvim")
|
local have_mason = LazyVim.has("mason-lspconfig.nvim")
|
||||||
|
|
@ -181,9 +176,7 @@ return {
|
||||||
local exclude_automatic_enable = {} ---@type string[]
|
local exclude_automatic_enable = {} ---@type string[]
|
||||||
|
|
||||||
local function configure(server)
|
local function configure(server)
|
||||||
local server_opts = vim.tbl_deep_extend("force", {
|
local server_opts = opts.servers[server] or {}
|
||||||
capabilities = vim.deepcopy(capabilities),
|
|
||||||
}, opts.servers[server] or {})
|
|
||||||
|
|
||||||
local setup = opts.setup[server] or opts.setup["*"]
|
local setup = opts.setup[server] or opts.setup["*"]
|
||||||
if setup and setup(server, server_opts) then
|
if setup and setup(server, server_opts) then
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue