-
Notifications
You must be signed in to change notification settings - Fork 38.3k
fix(lsp): updated config for mason to v2 #1663
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
init.lua
Outdated
@@ -483,7 +483,7 @@ require('lazy').setup({ | |||
-- 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-org/mason-lspconfig.nvim', opts = {} }, |
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.
This is not only unnecessary, it causes mason-lspconfig to setup LSP's when other plugins might have been interested in doing that prior to it. For example, for nvim-java this causes two jdtls instances where the first one is setup by mason-lspconfig and prevents the second one which is properly steup from functioning properly.
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.
Thanks for letting me know, it was setting up luals twice as well. It should be fixed 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.
Thank you for having done this job! It actually helped me with something else.
The mason-lspconfig.nvim plugin removed the 'handlers' feature in its v2.0.0 release. This change adapts the LSP configuration to follow the new recommended setup and keeps using the nvim-lspconfig api to configure the servers
This seems to do a similar thing as 1590 which already has some traction |
There are a couple of similars pr, but 1590 and 1475 both swap to the new LSP built in API besides fixing mason, which is only availabe in version >0.11. I think is the same reason we still have blink and lazy instead of using vim.lsp and vim.pack. |
Traction does not mean quality.
I don't like them. Both state a different goal than they are achieving. Both are pushing their authors preferences. On the other hand this one does exactly what it says and does it correctly. |
reference to nvim-lua#1663 merge request: nvim-lua#1663
This pull request updates the LSP configuration to align with the changes in
mason-lspconfig.nvim
v2.0.0
.The
handlers
feature has been removed frommason-lspconfig.nvim
. The PR adapts to that change by iterating through the servers table and callingrequire('lspconfig')[server_name].setup(server_config)
for each server. This approach maintains the use of thenvim-lspconfig
API for server configuration.This change simplifies the LSP configuration and ensures compatibility with the latest version of
mason-lspconfig.nvim
.