From 8d7870ae5e422ff64a1088f27abb296de48f19f6 Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Sat, 28 Oct 2023 13:33:07 +1100 Subject: [PATCH] Nicer message when not all LSPs are installed --- dot-config/vim/lsp.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dot-config/vim/lsp.vim b/dot-config/vim/lsp.vim index 3cfdbfa..c0e9b29 100644 --- a/dot-config/vim/lsp.vim +++ b/dot-config/vim/lsp.vim @@ -153,8 +153,17 @@ export def Configure(): void # modify the dicts it gets, rather than making a fresh copy to mess with. final installedServers = InstalledServers() if len(lspServers) != len(installedServers) - echo $'{len(lspServers) - len(installedServers)} language servers are configured, but not installed. You may want to run :LspInstall.' + # Since this code runs during Vim initialisation, this message would + # normally pause Vim's startup so the user can read it. We don't want + # that, so we're gonna delay it using an autocmd. + const missingCount = len(lspServers) - len(installedServers) + const warn = $'{missingCount} language server{missingCount > 1 ? "s are" : " is"} configured, but not installed. You may want to run :LspInstall.' + augroup dot/vim/lsp.vim + autocmd! + exe $'autocmd VimEnter * ++once echo "{escape(warn, '"\\')}"' + augroup END endif + g:lsp#lsp#AddServer(installedServers) g:lsp#options#OptionsSet(lspOptions) enddef