-
-
Notifications
You must be signed in to change notification settings - Fork 88
Vim9 LSP setup
Enno edited this page Dec 22, 2024
·
1 revision
Here's a suggestion (see also https://github.com/yegappan/lsp/pull/562) how to set up Vista to use this LSP when available and otherwise fall back to ctags
:
vim9script
augroup LspSetup
autocmd!
augroup END
g:lspFiletypes = []
for i in range(len(g:lspServers))
for ft in g:lspServers[i].filetype
add(g:lspFiletypes, ft)
# Only set workspace root once the first file of that file type is openend
# otherwise the workspace root often is $HOME and the LS scans too many files
exe 'autocmd LspSetup FileType' ft '++once'
\ 'autocmd LspSetup BufWinEnter <buffer> ++once call LspAddServer([g:lspServers[' .. i .. ']])'
endfor
endfor
nnoremap <expr> dp &l:diff ? 'dp' : ':<c-u>Vista show<cr>'
let g:vista_executive_for = {}
for i in range(len(g:lspServers))
for ft in g:lspServers[i].filetype
call extend(g:vista_executive_for, { ft : 'yegappan_lsp' })
exe 'autocmd vimrc FileType' ft 'nnoremap <buffer><expr> dp &l:diff ? "dp" : ":<c-u>Vista!!<cr>"'
endfor
endfor