From 816b62b2aea57c3922a2e0a0eb856b139642d32e Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Tue, 24 Oct 2023 14:59:27 +1100 Subject: [PATCH] Eagerly autoload LSP config (works around https://github.com/yegappan/lsp/issues/384) --- dot-config/vim/init.vim | 2 +- dot-config/vim/lsp.vim | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/dot-config/vim/init.vim b/dot-config/vim/init.vim index d7b3a69..e2974e6 100644 --- a/dot-config/vim/init.vim +++ b/dot-config/vim/init.vim @@ -105,7 +105,7 @@ import "./statusline.vim" statusline.Init() import "./lsp.vim" -lsp.LazyConfigure() +lsp.Configure() set formatexpr=lsp#lsp#FormatExpr() set keywordprg=:LspHover diff --git a/dot-config/vim/lsp.vim b/dot-config/vim/lsp.vim index 3d2a361..9a1c804 100644 --- a/dot-config/vim/lsp.vim +++ b/dot-config/vim/lsp.vim @@ -140,13 +140,6 @@ def ListMissingServers(argLead: string, cmdLine: string, cursorPos: number): lis return MissingServers()->mapnew((_, server): string => server.name) enddef -export def LazyConfigure(): void - augroup lspLazyConfigure - autocmd! - autocmd VimEnter * ++once Configure() - augroup END -enddef - export def Configure(): void # We have to use final rather than const because LspAddServer() assumes it can # modify the dicts it gets, rather than making a fresh copy to mess with. @@ -154,8 +147,8 @@ export def Configure(): void if len(lspServers) != len(installedServers) echo $'{len(lspServers) - len(installedServers)} language servers are configured, but not installed. You may want to run :LspInstall.' endif - g:LspAddServer(installedServers) - g:LspOptionsSet(lspOptions) + g:lsp#lsp#AddServer(installedServers) + g:lsp#options#OptionsSet(lspOptions) enddef export def Install(...serverNames: list): void