-
Notifications
You must be signed in to change notification settings - Fork 33.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?
Conversation
Do we really need backward compatibility with Neovim 0 10? I'd consider going with a lighter, happy-path solution. Since the project mainly targets newcomers and servers educational purposes, they'd likely prefer to avoid dealing with legacy approaches. |
I think that would be the right approach as well. The reason I intended to maintain backwards compatibility is that some parts of the code is still trying to maintain 0.10 like the |
There is also the problem new syntax not supporting all lsp configs. For example tailwindcss requires the old setup. Could be a good idea to delay this until most lsp configs migrate. |
|
Signed-off-by: Umut Sahin Onder <[email protected]>
In my opinion, we shouldn't bother with backwards compatibility since Kickstart is mostly aimed at beginners who will download the latest version of Neovim as per the instructions in the repo readme |
I have removed backwards compatibility and added useful comments for LSPs that still require the old setup |
This comment was marked as resolved.
This comment was marked as resolved.
I couldn't replicate the issue. I do not think it would be related to these changes as conform.nvim does not use an LSP. In any case If you could check your conform logs by using |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Rory Hendrickson <[email protected]>
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mason-lspconfig.nvim v2.0.0 removes this now. It auto-enables installed LSPs if they're using the new vim.lsp.* API. See https://github.com/mason-org/mason-lspconfig.nvim/releases/tag/v2.0.0
init.lua
Outdated
for server, config in pairs(servers) do | ||
-- 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) | ||
config.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) | ||
vim.lsp.config(name, config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the original hunk of the patch is relevant (and should be used?) now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I don't know how to mention lines, but shouldn't it be vim.lsp.config(server, config)
? As well as vim.lsp.enable(server)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that was fixed in a later commit in this PR, I was quoting from an earlier one.
AFAIK
I've been updating my old neovim configs with the latest kickstart but the LSP settings weren't reflected in |
If we were to move LSP configs to their own file, I don't know how mason-tool-installer would work without the servers table maybe by iterating over file names? In your config I see that you still have the servers table. If It is still gonna be preset wouldn't be better to use vim.lsp.config with a loop (like my first hunk) rather than having 2 separate places for LSP servers? |
As mentioned in previous conversations, Mason v2 has started introducing a significant delay during startup. For now, I’ve pinned the Mason version to avoid this issue. From my testing, the problem appears to be related to mason-tool-installer; without it, I don’t experience any delays. It would be helpful to hear from someone with more insight into this before proceeding further with Mason v2. |
My personal temporary solution is to set |
Summary