autozimu / LanguageClient-neovim

Language Server Protocol (LSP) support for vim and neovim.
MIT License
3.55k stars 273 forks source link

can't get arguments info of a function from language-client while nvim-typescript do #621

Open maple-leaf opened 6 years ago

maple-leaf commented 6 years ago

Describe the bug

can't get arguments info of a function from language-client while nvim-typescript do, which will make echodoc can't dispaly correct info

Environment

minimal vimrc

if empty($XDG_DATA_HOME)
    let $XDG_DATA_HOME = $HOME . '/.config'
endif

let mapleader = "\<Space>"

" curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
call plug#begin('~/.config/nvim/plugged')

Plug 'autozimu/LanguageClient-neovim', {
    \ 'branch': 'next',
    \ 'do': 'bash install.sh',
    \ }
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'Shougo/echodoc.vim'
Plug 'HerringtonDarkholme/yats.vim'
Plug 'mhartington/nvim-typescript', { 'do': './install.sh' }

" Add plugins to &runtimepath
call plug#end()

"turn on that syntax highlighting
syntax on

function! s:deopleteConfig()
    let g:deoplete#enable_at_startup=1
endfunction
call s:deopleteConfig()

function! s:echoDocConfig()
    let g:echodoc#enable_at_startup = 1
endfunction
call s:echoDocConfig()

function! s:lspConfig()
    let g:LanguageClient_serverCommands = {
                \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
                \ 'javascript': ['/usr/local/bin/javascript-typescript-stdio'],
                \ 'javascript.jsx': ['tcp://127.0.0.1:2089'],
                \ 'python': ['/usr/local/bin/pyls'],
                \ 'vue': ['vls'],
                \ }

    nnoremap <F5> :call LanguageClient_contextMenu()<CR>
    " Or map each action separately
    nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
    nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
    nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
endfunction
call s:lspConfig()

function! VimTSCConfig()
    let g:nvim_typescript#javascript_support=1
    let g:nvim_typescript#vue_support=1
    let g:nvim_typescript#type_info_on_hold=1
    let g:nvim_typescript#diagnosticsEnable=0
    autocmd BufNewFile,BufRead *.tsx set filetype=typescript

    no <Leader>tD   :TSDoc<cr>
    no <Leader>tt   :TSType<cr>
    no <Leader>ttd   :TSTypeDef<cr>
    no <Leader>td   :mark 1<cr>:TSDef<cr>
    no <Leader>tpd  :TSDefPreview<cr>
    no <Leader>tr   :TSRefs<cr>
    no <Leader>tR   :TSRename<cr>
endfunction
call VimTSCConfig()

To Reproduce

Steps to reproduce the behavior:

  1. Start vim, nvim -u min-vimrc.vim ...
  2. insert content
    function abc(b) {
    }
  3. type abc, check candidates list, two options provided by LC and nvim-typescript is different (check screenshot)

Current behavior

function missing arguments and return info provided by language-client

Expected behavior

function should have arguments and return info provided by language-client

Screenshots

image

dustinblackman commented 5 years ago

Is this configuration related or does javascript-typescript-langserver not support it?

derekstavis commented 5 years ago

I also never could make this work -- I switched many different typescript language servers and none of them worked. It seems that all of the them provides these typings, but for some unknown reason LanguageClient-neovim isn't working with them. I can get typings on Elixir language server, though.

georgewitteman commented 5 years ago

I'm also having this issue. Only happens with the typescript language server

derekstavis commented 5 years ago

I've migrated to https://github.com/neoclide/coc.nvim and now I have the most awesome setup I ever had.