-
Notifications
You must be signed in to change notification settings - Fork 40.3k
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
base: master
Are you sure you want to change the base?
Changes from 11 commits
3f0cd75
f70dcb3
4b81900
5502cea
a590ab6
dac395d
531073d
81c5210
9e0c7b6
0018683
f9628e5
718c90d
82949b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -482,8 +482,8 @@ require('lazy').setup({ | |
-- Automatically install LSPs and related tools to stdpath for Neovim | ||
-- Mason must be loaded before its dependents so we need to set it up here. | ||
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` | ||
{ 'mason-org/mason.nvim', opts = {} }, | ||
'mason-org/mason-lspconfig.nvim', | ||
{ 'mason-orgmason.nvim', opts = {} }, | ||
{ 'mason-org/mason-lspconfig.nvim', opts = {} }, | ||
'WhoIsSethDaniel/mason-tool-installer.nvim', | ||
|
||
-- Useful status updates for LSP. | ||
|
@@ -655,12 +655,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() | ||
umutondersu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
-- Enable the following language servers | ||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed. | ||
-- | ||
|
@@ -719,20 +713,14 @@ require('lazy').setup({ | |
}) | ||
require('mason-tool-installer').setup { ensure_installed = ensure_installed } | ||
|
||
require('mason-lspconfig').setup { | ||
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) | ||
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) | ||
end, | ||
}, | ||
} | ||
-- Installed LSPs are configured and enabled automatically with mason-lspconfig | ||
-- The loop below is for overriding the default configuration of LSPs with the ones in the servers table | ||
for server_name, config in pairs(servers) do | ||
vim.lsp.config(server_name, config) | ||
umutondersu marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the right approach 👍 . Using Nvim 0.11+ should not use nvim-lspconfig will soon be deleting all of its There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That alone won't do anything. You can't just swap [servername].setup with vim.lsp.config. You should now provide the config in its entirety. |
||
end | ||
|
||
-- NOTE: Some servers may require an old setup until they are updated. For the full list refer here: https://github.com/neovim/nvim-lspconfig/issues/3705 | ||
-- These servers will have to be manually set up with require("lspconfig").server_name.setup{} | ||
end, | ||
}, | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.