From 41f718991ecd24e2b3787929637dd5092d34bf3f Mon Sep 17 00:00:00 2001 From: Andreas Louv Date: Sun, 16 Apr 2023 17:18:23 +0200 Subject: [PATCH] Add an autocmd for the LSP servers internal ID This is to not fail if the user provides two servers with the same name. --- autoload/lsp/lsp.vim | 2 +- autoload/lsp/lspserver.vim | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/autoload/lsp/lsp.vim b/autoload/lsp/lsp.vim index 7c86f8f..1d8efab 100644 --- a/autoload/lsp/lsp.vim +++ b/autoload/lsp/lsp.vim @@ -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 diff --git a/autoload/lsp/lspserver.vim b/autoload/lsp/lspserver.vim index 31cb666..4ef4645 100644 --- a/autoload/lsp/lspserver.vim +++ b/autoload/lsp/lspserver.vim @@ -127,6 +127,10 @@ def ServerInitReply(lspserver: dict, initResult: dict): void if exists($'#User#LspServerReady{lspserver.name}') exe $'doautocmd User LspServerReady{lspserver.name}' endif + # Used internally, and shouldn't be used by users + if exists($'#User#LspServerReady_{lspserver.id}') + exe $'doautocmd User LspServerReady_{lspserver.id}' + endif # if the outline window is opened, then request the symbols for the current # buffer -- 2.50.0