nvim-lua / kickstart.nvim

A launch point for your personal nvim configuration
MIT License
18.86k stars 21.57k forks source link

Language servers removed from `servers` table still take affect #930

Closed samualtnorman closed 4 months ago

samualtnorman commented 4 months ago

Describe the bug

I would expect language servers removed from the servers table to no longer take affect. This is particularly annoying if a language has multiple LSP server options and I change my mind and switch to another.

To Reproduce

  1. Add a language server to the servers table
  2. Start Neovim and wait for Mason to do its thing
  3. Remove it and restart Neovim

Desktop

Neovim Version

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1693350652

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/nix/store/7r7hqkq5gkbh6hxq9s309y6s1li1m99j-neovim-unwrapped-0.9.4/share/nvim"
dam9000 commented 4 months ago

You can run this to remove installed packages that are not listed in ensure_installed:

:MasonToolsClean

Or add this to init.lua:

diff --git a/init.lua b/init.lua
index 88658ef..c125657 100644
--- a/init.lua
+++ b/init.lua
@@ -610,6 +610,9 @@ require('lazy').setup({
       })
       require('mason-tool-installer').setup { ensure_installed = ensure_installed }

+      -- remove mason installed packages that are not listed in ensure_installed
+      require('mason-tool-installer').clean()
+
       require('mason-lspconfig').setup {
         handlers = {
           function(server_name)

Not sure if this should be the default behaviour or not, perhaps it would be too disruptive and then we would get questions like: "Why are the packages that I manually install using Mason uninstalled when I restart nvim?"

dam9000 commented 4 months ago

@samualtnorman Btw, you seem to be a NixOS user, can you check if you could help with this issue: https://github.com/nvim-lua/kickstart.nvim/issues/924 "Telescope bindings don't work [on NixOS]"

samualtnorman commented 4 months ago

You can run this to remove installed packages that are not listed in ensure_installed:

:MasonToolsClean

Or add this to init.lua:

diff --git a/init.lua b/init.lua
index 88658ef..c125657 100644
--- a/init.lua
+++ b/init.lua
@@ -610,6 +610,9 @@ require('lazy').setup({
       })
       require('mason-tool-installer').setup { ensure_installed = ensure_installed }

+      -- remove mason installed packages that are not listed in ensure_installed
+      require('mason-tool-installer').clean()
+
       require('mason-lspconfig').setup {
         handlers = {
           function(server_name)

Not sure if this should be the default behaviour or not, perhaps it would be too disruptive and then we would get questions like: "Why are the packages that I manually install using Mason uninstalled when I restart nvim?"

ty this lua snippet seems to be what I'm looking for