Skip to content

feat: improved lsp setup for nvim > 0.11 #1590

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 2 commits into
base: master
Choose a base branch
from

Conversation

kartikvashistha
Copy link

@kartikvashistha kartikvashistha commented Jun 7, 2025

The aim of this change is to provide a much clearer distinction between how servers are installed & configured (either directly via Mason or manually). This is a slight alternative to this excellent PR for LSP configuration for neovim > 0.11 onwards.

Since the new mason-lspconfig changes enable all servers installed via Mason by default, this might cause confusion for newcomers around server enable if they had a language server installed manually but wanted to re-use the default nvim-lspconfig configs.
Furthermore, not all language servers might be available on Mason for download - however they might already have default configs available on nvim-lspconfig for re-use (example) or have neither available on Mason and nvim-lspconfig.

I'm hoping another benefit of this change is that it should also aid in reducing burden on the mason & nvim-lspconfig maintainers when it comes to answering these specific kind of lsp questions.

As always, I'm open to any feedback here. I'm not too fussed if the above linked PR gets merged over this, but wanted to float this idea by the maintainers and community to gather any & all feedback.

Cheers! 🙂

Minor Changes:

  • Commented and preserved the capabilities step for educational purposes only;
  • Auto formatter might have formatted some code, which I quite like tbh . Happy to revert it if needed.

Copy link
Contributor

@oriori1703 oriori1703 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I quite like the idea of teaching how to use servers that were not installed by mason, so I think I prefer this over #1475 (even though it is also great :)

Though I think the formatting changes should be left out of this PR.
Also, I left a couple of suggestions for minor improvements.

Add lua_ls annotations for improved hover experience and replace vim.fn.empty() with
vim.tbl_isempty()
umutondersu added a commit to umutondersu/nvim that referenced this pull request Jun 12, 2025
umutondersu added a commit to umutondersu/nvim that referenced this pull request Jun 12, 2025
rajive added a commit to rajive/kickstart.nvim that referenced this pull request Jul 4, 2025
Copy link
Contributor

@oriori1703 oriori1703 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the formatting changes?

Other that everything looks great 😄

guru245 added a commit to guru245/kickstart.nvim that referenced this pull request Jul 7, 2025
guru245 added a commit to guru245/kickstart.nvim that referenced this pull request Jul 7, 2025
@gozes
Copy link

gozes commented Jul 11, 2025

Just an FYI, I have ported this fixes to my kickstart base config. after adding the loop to call lsp.config load time went to 200ms just on the lspconfig

rajive added a commit to rajive/kickstart.nvim that referenced this pull request Jul 12, 2025
rajive added a commit to rajive/kickstart.nvim that referenced this pull request Jul 12, 2025
rajive added a commit to rajive/kickstart.nvim that referenced this pull request Jul 12, 2025
rajive added a commit to rajive/kickstart.nvim that referenced this pull request Jul 12, 2025
rajive added a commit to rajive/kickstart.nvim that referenced this pull request Jul 12, 2025
rajive added a commit to rajive/kickstart.nvim that referenced this pull request Jul 12, 2025
rajive added a commit to rajive/kickstart.nvim that referenced this pull request Jul 12, 2025
rajive added a commit to rajive/kickstart.nvim that referenced this pull request Jul 12, 2025
rajive added a commit to rajive/kickstart.nvim that referenced this pull request Jul 12, 2025
rajive added a commit to rajive/kickstart.nvim that referenced this pull request Jul 12, 2025
rajive added a commit to rajive/kickstart.nvim that referenced this pull request Jul 12, 2025
rajive added a commit to rajive/kickstart.nvim that referenced this pull request Jul 12, 2025
moktavizen added a commit to moktavizen/dotfiles that referenced this pull request Jul 14, 2025
moktavizen added a commit to moktavizen/dotfiles that referenced this pull request Jul 14, 2025
moktavizen added a commit to moktavizen/dotfiles that referenced this pull request Jul 14, 2025
moktavizen added a commit to moktavizen/dotfiles that referenced this pull request Jul 14, 2025
moktavizen added a commit to moktavizen/dotfiles that referenced this pull request Jul 14, 2025
moktavizen added a commit to moktavizen/dotfiles that referenced this pull request Jul 14, 2025
@theammir
Copy link

Just an FYI, I have ported this fixes to my kickstart base config. after adding the loop to call lsp.config load time went to 200ms just on the lspconfig

It's something I'm experiencing with lots of LSPs installed via Mason with automatic_enable = true. More than half of my startup time goes to enable the LSPs. I wonder why is it so expensive, though.

theammir added a commit to theammir/kickstart.nvim that referenced this pull request Jul 19, 2025
@moktavizen
Copy link

Just an FYI, I have ported this fixes to my kickstart base config. after adding the loop to call lsp.config load time went to 200ms just on the lspconfig

It's something I'm experiencing with lots of LSPs installed via Mason with automatic_enable = true. More than half of my startup time goes to enable the LSPs. I wonder why is it so expensive, though.

I also noticed that, right now loading LSP at VeryLazy event is enough to fix it.

-- Main LSP Configuration
'neovim/nvim-lspconfig',
event = 'VeryLazy',
cmd = { 'LspInfo', 'LspInstall', 'LspUninstall' },

@theammir
Copy link

Just an FYI, I have ported this fixes to my kickstart base config. after adding the loop to call lsp.config load time went to 200ms just on the lspconfig

It's something I'm experiencing with lots of LSPs installed via Mason with automatic_enable = true. More than half of my startup time goes to enable the LSPs. I wonder why is it so expensive, though.

I also noticed that, right now loading LSP at VeryLazy event is enough to fix it.

-- Main LSP Configuration
'neovim/nvim-lspconfig',
event = 'VeryLazy',
cmd = { 'LspInfo', 'LspInstall', 'LspUninstall' },

Works great! Do you want to open a PR maybe? Or is it a temporary solution that shouldn't really belong?

evanlesmez pushed a commit to evanlesmez/kickstart.nvim that referenced this pull request Aug 1, 2025
setarcos added a commit to setarcos/kickstart.nvim that referenced this pull request Aug 3, 2025
@logrusx
Copy link

logrusx commented Aug 3, 2025

Overal I like the idea of separating the mason and other servers.

However this PR is dealing with mason-lspconfig 2.0 rather than nvim 0.11 and it does more than it says.

The idea of separating mason and other servers may be a subject of another PR.

I recommend #1663 over this one as it does exactly what it says and does it correctly.


-- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
-- NOTE: The following line is now commented as blink.cmp extends capabilites by default from its internal code:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, don't you need to put:

{ 'saghen/blink.cmp', opts = {} },

in the dependencies for the capabilities to get populated?

@silverdyne
Copy link

Just an FYI, I have ported this fixes to my kickstart base config. after adding the loop to call lsp.config load time went to 200ms just on the lspconfig

It's something I'm experiencing with lots of LSPs installed via Mason with automatic_enable = true. More than half of my startup time goes to enable the LSPs. I wonder why is it so expensive, though.

I also noticed that, right now loading LSP at VeryLazy event is enough to fix it.

-- Main LSP Configuration
'neovim/nvim-lspconfig',
event = 'VeryLazy',
cmd = { 'LspInfo', 'LspInstall', 'LspUninstall' },

Unfortunately, this only seems to work if the LSP servers are already installed and configured.

I tried this with a fresh nvim install and for some reason, no servers would be installed until I removed those two lines.

@fadookie
Copy link

I manually patched this change into my modular kickstart config and it seems to fix the issue I was having with my configs for LSPs not propagating. I was also wondering how to install non-mason LSPs. This PR addresses both my questions, thank you!

fadookie added a commit to fadookie/kickstart.nvim that referenced this pull request Aug 14, 2025
…h mason-lspconfig 2.0 and nvim >0.1 that was causing my LSP config not to propogate to the LSP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants