]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Make sure that "LspAttached" is only called once all servers are attached
authorAndreas Louv <andreas@louv.dk>
Wed, 12 Apr 2023 21:32:31 +0000 (23:32 +0200)
committerAndreas Louv <andreas@louv.dk>
Thu, 13 Apr 2023 05:38:15 +0000 (07:38 +0200)
autoload/lsp/lsp.vim

index c8db52cc58acc064ec66d7202dde3bc0d8df6ecd..fdb39786c4d16414235b3c10586647a3a99b552a 100644 (file)
@@ -424,7 +424,17 @@ def BufferInit(lspserverId: number, bnr: number): void
   inlayhints.BufferInit(lspserver, bnr)
 
   if exists('#User#LspAttached')
-    doautocmd <nomodeline> User LspAttached
+    var allServersReady = true
+    var lspservers: list<dict<any>> = buf.BufLspServersGet(bnr)
+    for lspsrv in lspservers
+      if !lspsrv.ready
+        allServersReady = false
+      endif
+    endfor
+
+    if allServersReady
+      doautocmd <nomodeline> User LspAttached
+    endif
   endif
 enddef