]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Skip invalid servers instead of aborting in LspAddServer()
authorMagnus Groß <magnus@mggross.com>
Wed, 31 May 2023 20:01:47 +0000 (22:01 +0200)
committerMagnus Groß <magnus@mggross.com>
Wed, 31 May 2023 21:03:51 +0000 (23:03 +0200)
If the user calls LspAddServer() with a list of servers, where the very
first entry does not exist, but all the remaining ones do, then no
servers are added at all. This doesn't make much sense, as the other
entries might be valid entries.

Fix this by simply continuing with the next entry instead of returning
when encountering an error.

autoload/lsp/lsp.vim

index d3f5e33eed37bdc5cb2587aad872361f8a8026f5..00aadac6cb7fef136f0ff3740c52bb8f3c08d694 100644 (file)
@@ -598,13 +598,13 @@ export def AddServer(serverList: list<dict<any>>)
       if !opt.lspOptions.ignoreMissingServer
         util.ErrMsg($'LSP server {server.path} is not found')
       endif
-      return
+      continue
     endif
     var args: list<string> = []
     if server->has_key('args')
       if server.args->type() != v:t_list
         util.ErrMsg($'Arguments for LSP server {server.args} is not a List')
-        return
+        continue
       endif
       args = server.args
     endif
@@ -623,7 +623,7 @@ export def AddServer(serverList: list<dict<any>>)
     if server->has_key('processDiagHandler')
       if server.processDiagHandler->type() != v:t_func
         util.ErrMsg($'Setting of processDiagHandler {server.processDiagHandler} is not a Funcref nor lambda')
-        return
+        continue
       endif
       ProcessDiagHandler = server.processDiagHandler
     endif
@@ -640,7 +640,7 @@ export def AddServer(serverList: list<dict<any>>)
 
     if server.omnicompl->type() != v:t_bool
       util.ErrMsg($'Setting of omnicompl {server.omnicompl} is not a Boolean')
-      return
+      continue
     endif
 
     if !server->has_key('syncInit')