Eagerly autoload LSP config (works around https://github.com/yegappan/lsp/issues/384)

This commit is contained in:
Danielle McLean 2023-10-24 14:59:27 +11:00
parent 4e365962ba
commit 816b62b2ae
Signed by: 00dani
GPG key ID: 52C059C3B22A753E
2 changed files with 3 additions and 10 deletions

View file

@ -105,7 +105,7 @@ import "./statusline.vim"
statusline.Init()
import "./lsp.vim"
lsp.LazyConfigure()
lsp.Configure()
set formatexpr=lsp#lsp#FormatExpr()
set keywordprg=:LspHover

View file

@ -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<string>): void