More idiomatically vim9script the LSP setup
This commit is contained in:
parent
87147d44a3
commit
3720e61674
2 changed files with 14 additions and 10 deletions
|
@ -104,6 +104,6 @@ g:mucomplete#can_complete = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import "./lsp.vim"
|
||||||
set keywordprg=:LspHover
|
set keywordprg=:LspHover
|
||||||
|
lsp.LazyConfigure()
|
||||||
source $XDG_CONFIG_HOME/vim/lsp.vim
|
|
||||||
|
|
|
@ -65,17 +65,21 @@ const lspOptions = {
|
||||||
aleSupport: true,
|
aleSupport: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
autocmd VimEnter * ++once {
|
export def LazyConfigure(): void
|
||||||
|
autocmd VimEnter * ++once Configure()
|
||||||
|
enddef
|
||||||
|
|
||||||
|
export def Configure(): void
|
||||||
|
g:LspAddServer(lspServers->deepcopy()->filter((_, server) => executable(server.path) == 1))
|
||||||
|
g:LspOptionsSet(lspOptions)
|
||||||
|
enddef
|
||||||
|
|
||||||
|
export def Install(): void
|
||||||
# TODO: work out a way nicer approach to automatically installing any
|
# TODO: work out a way nicer approach to automatically installing any
|
||||||
# missing language servers. Maybe use a command or something.
|
# missing language servers. Maybe use a command or something.
|
||||||
const missing = lspServers->copy()
|
const missing = lspServers->copy()
|
||||||
->filter((_, server) => !executable(server.path))
|
->filter((_, server) => executable(server.path) == 0)
|
||||||
const jobs = missing->copy()
|
const jobs = missing->copy()
|
||||||
->mapnew((_, server) => async#job#start(server.install, {normalize: 'raw'}))
|
->mapnew((_, server) => async#job#start(server.install, {normalize: 'raw'}))
|
||||||
async#job#wait(jobs)
|
async#job#wait(jobs)
|
||||||
# :call is required here because these functions from vim-lsp won't be
|
enddef
|
||||||
# loaded yet when this file is parsed by Vim, so you get a "function not
|
|
||||||
# found" error if you try to call them the short way.
|
|
||||||
call LspAddServer(lspServers->deepcopy()->filter((_, server) => executable(server.path)))
|
|
||||||
call LspOptionsSet(lspOptions)
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue