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() statusline.Init()
import "./lsp.vim" import "./lsp.vim"
lsp.LazyConfigure() lsp.Configure()
set formatexpr=lsp#lsp#FormatExpr() set formatexpr=lsp#lsp#FormatExpr()
set keywordprg=:LspHover 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) return MissingServers()->mapnew((_, server): string => server.name)
enddef enddef
export def LazyConfigure(): void
augroup lspLazyConfigure
autocmd!
autocmd VimEnter * ++once Configure()
augroup END
enddef
export def Configure(): void export def Configure(): void
# We have to use final rather than const because LspAddServer() assumes it can # 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. # 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) if len(lspServers) != len(installedServers)
echo $'{len(lspServers) - len(installedServers)} language servers are configured, but not installed. You may want to run :LspInstall.' echo $'{len(lspServers) - len(installedServers)} language servers are configured, but not installed. You may want to run :LspInstall.'
endif endif
g:LspAddServer(installedServers) g:lsp#lsp#AddServer(installedServers)
g:LspOptionsSet(lspOptions) g:lsp#options#OptionsSet(lspOptions)
enddef enddef
export def Install(...serverNames: list<string>): void export def Install(...serverNames: list<string>): void