]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Use a copy of the server list when restarting (#540)
authorNick Jensen <nickspoons@users.noreply.github.com>
Sun, 22 Sep 2024 00:19:42 +0000 (12:19 +1200)
committerGitHub <noreply@github.com>
Sun, 22 Sep 2024 00:19:42 +0000 (17:19 -0700)
If the original server list is used, it is cleared during the step of
removing filetype buffers, so no servers are actually restarted, as the
`lspservers` list is empty by the time the `for` loop is reached.

autoload/lsp/lsp.vim

index d6e0d54cd53574c322df2317d2432cffa8e1f2e4..3e6461b9c4cdcbaa462f2e71fa5fa3edfd3bc780 100644 (file)
@@ -547,7 +547,7 @@ enddef
 
 # Restart the LSP server for the current buffer
 def RestartServer()
-  var lspservers: list<dict<any>> = buf.CurbufGetServers()
+  var lspservers: list<dict<any>> = buf.CurbufGetServers()->copy()
   if lspservers->empty()
     util.WarnMsg($'No Lsp servers found for "{@%}"')
     return