vim_config/config/before/language-client.vim

54 lines
2.1 KiB
VimL
Raw Normal View History

""" LanguageClient
" Required for operations modifying multiple buffers like rename.
set hidden
" let g:LanguageClient_serverCommands = {
" \ 'javascript': ['/usr/local/bin/javascript-typescript-stdio'],
" \ 'javascript.jsx': ['tcp://127.0.0.1:2089'],
" \ 'python': ['/usr/local/bin/pyls'],
" \ 'ruby': ['~/.rbenv/shims/solargraph', 'stdio'],
" \ }
let g:LanguageClient_serverCommands = {
\ 'rust': ['/usr/bin/rustup', 'run', 'stable', 'rls'],
\ 'elixir': ['/usr/lib/elixir-ls/language_server.sh'],
\ 'elm': ['/usr/bin/elm-language-server'],
\ 'python': ['/usr/bin/pyls'],
\ 'go': ['/usr/bin/gopls'],
\ 'promql': ['/usr/local/bin/promql-langserver'],
\ 'java': ['/usr/bin/java-language-server'],
\ 'typescript': ['/usr/bin/typescript-language-server', '--stdio'],
\ 'typescriptreact': ['/usr/bin/typescript-language-server', '--stdio'],
\ }
let g:LanguageClient_rootMarkers = {
\ 'elm': ['elm.json'],
\ 'typescript': ['package.json'],
\ 'typescriptreact': ['package.json'],
\ }
let g:LanguageClient_hoverPreview = 'always'
let g:LanguageClient_loggingFile = expand('~/.vim/LanguageClient.log')
function LC_maps()
if has_key(g:LanguageClient_serverCommands, &filetype)
2022-01-28 15:57:47 +01:00
nnoremap <F5> :call LanguageClient_contextMenu()<CR>
nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> gdd :call LanguageClient#textDocument_definition()<CR>
nnoremap <silent> gdi :call LanguageClient#textDocument_implementation()<CR>
nnoremap <silent> gdt :call LanguageClient#textDocument_typeDefinition()<CR>
nnoremap <silent> gds :call LanguageClient#textDocument_documentSymbol()<CR>
nnoremap <silent> gdr :call LanguageClient#textDocument_references()<CR>
nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
" noremap <F5> <Plug>(lcn-menu)
" noremap <buffer> <silent> K <Plug>(lcn-hover)
" noremap <buffer> <silent> gd <Plug>(lcn-definition)
" noremap <buffer> <silent> <F2> <Plug>(lcn-rename)
set formatexpr=LanguageClient#textDocument_rangeFormatting_sync()
endif
endfunction
autocmd FileType * call LC_maps()