Add vim-lsp for Haskell goodness

This commit is contained in:
Martin Potier 2021-04-14 12:17:54 +03:00
parent 360d1d4055
commit e80e268527
No known key found for this signature in database
GPG key ID: D4DD957DBA4AD89E

View file

@ -107,6 +107,7 @@ let
vim-hcl vim-hcl
vim-ledger vim-ledger
vim-lilypond vim-lilypond
vim-lsp
vim-nix vim-nix
vim-orgmode vim-orgmode
vim-selinux vim-selinux
@ -255,6 +256,46 @@ let
au BufRead,BufNewFile Vagrantfile set filetype=ruby au BufRead,BufNewFile Vagrantfile set filetype=ruby
augroup END augroup END
" Haskell Language Server
if executable('dhall-lsp-server')
au User lsp_setup call lsp#register_server({
\ 'name': 'dhall-lsp',
\ 'cmd': {server_info->['dhall-lsp-server']},
\ 'allowlist': ['dhall'],
\ })
endif
if executable('haskell-language-server-wrapper')
au User lsp_setup call lsp#register_server({
\ 'name': 'haskell-lsp',
\ 'cmd': {server_info->['haskell-language-server-wrapper', '--lsp']},
\ 'allowlist': ['haskell'],
\ })
endif
function! s:on_lsp_buffer_enabled() abort
setlocal omnifunc=lsp#complete
setlocal signcolumn=yes
if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
nmap <buffer> gd <plug>(lsp-definition)
nmap <buffer> gr <plug>(lsp-references)
nmap <buffer> gi <plug>(lsp-implementation)
nmap <buffer> gt <plug>(lsp-type-definition)
nmap <buffer> <leader>rn <plug>(lsp-rename)
nmap <buffer> [g <Plug>(lsp-previous-diagnostic)
nmap <buffer> ]g <Plug>(lsp-next-diagnostic)
nmap <buffer> K <plug>(lsp-hover)
nmap <buffer> <leader>a <plug>(lsp-code-action)
nmap <buffer> <leader>dd <plug>(lsp-document-diagnostics)
" refer to doc to add more commands
endfunction
augroup lsp_install
au!
" call s:on_lsp_buffer_enabled only for languages that has the server registered.
autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
augroup END
" Extra options " Extra options
${extraOptions} ${extraOptions}
''; '';