]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Add an autocmd for the LSP servers internal ID
authorAndreas Louv <andreas@louv.dk>
Sun, 16 Apr 2023 15:18:23 +0000 (17:18 +0200)
committerAndreas Louv <andreas@louv.dk>
Sun, 16 Apr 2023 15:18:24 +0000 (17:18 +0200)
This is to not fail if the user provides two servers with the same name.

autoload/lsp/lsp.vim
autoload/lsp/lspserver.vim

index 7c86f8f43486d7556f7b8ee5d9e43b24b6854c86..1d8efabc88bfeb160cd04efc314d5ddd8c1cbb95 100644 (file)
@@ -488,7 +488,7 @@ export def AddFile(bnr: number): void
       BufferInit(lspserver.id, bnr)
     else
       augroup LSPBufferAutocmds
-        exe $'autocmd User LspServerReady{lspserver.name} ++once BufferInit({lspserver.id}, {bnr})'
+        exe $'autocmd User LspServerReady_{lspserver.id} ++once BufferInit({lspserver.id}, {bnr})'
       augroup END
     endif
   endfor
index 31cb666f2ce97e24426aa7fc7022551ba5112716..4ef4645487d83d820e5e7a3381a5c8ea2b725de4 100644 (file)
@@ -127,6 +127,10 @@ def ServerInitReply(lspserver: dict<any>, initResult: dict<any>): void
   if exists($'#User#LspServerReady{lspserver.name}')
     exe $'doautocmd <nomodeline> User LspServerReady{lspserver.name}'
   endif
+  # Used internally, and shouldn't be used by users
+  if exists($'#User#LspServerReady_{lspserver.id}')
+    exe $'doautocmd <nomodeline> User LspServerReady_{lspserver.id}'
+  endif
 
   # if the outline window is opened, then request the symbols for the current
   # buffer