Skip to content

feat: add support for new LSP config API in Neovim 0.11+ #1475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -647,12 +647,6 @@ require('lazy').setup({
},
}

-- LSP servers and clients are able to communicate to each other what features they support.
-- By default, Neovim doesn't support everything that is in the LSP specification.
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
local capabilities = require('blink.cmp').get_lsp_capabilities()

-- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
--
Expand Down Expand Up @@ -716,15 +710,29 @@ require('lazy').setup({
automatic_installation = false,
handlers = {
function(server_name)
local server = servers[server_name] or {}
-- This handles overriding only values explicitly passed
-- by the server configuration above. Useful when disabling
-- certain features of an LSP (for example, turning off formatting for ts_ls)
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
require('lspconfig')[server_name].setup(server)
local config = servers[server_name] or {}
vim.lsp.config(server_name, config)
vim.lsp.enable(server_name)
end,
},
}
-- NOTE: Some servers still require the nvim-lspconfig setup until they are updated
-- Add this template inside the handler function after initializing config if you encounter issues with any lsp
--
-- if server == 'example_server' or server == 'example_server2' then
-- -- This handles overriding only values explicitly passed
-- -- by the server configuration above. Useful when disabling
-- -- certain features of an LSP (for example, turning off formatting for ts_ls)
-- local capabilities = require('blink.cmp').get_lsp_capabilities()
-- config.capabilities = vim.tbl_deep_extend('force', {}, capabilities, config.capabilities or {})
-- require('mason-lspconfig')[server].setup(config)
-- return
-- end
--
-- LSP servers and clients are able to communicate to each other what features they support.
-- With nvim-lspconfig setup, Neovim doesn't support everything that is in the LSP specification.
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
end,
},

Expand Down