sourcegraph/javascript-typescript-langserver

What to expect for code completion using Neovim

ipatch opened this issue ยท 12 comments

Hi ๐Ÿ‘‹, I've been venturing into the world of language servers recently, and so far I have been enjoying my experience with a variety of languages I work with. That said, I setup this language server to work with LanguageClient-neovim and deoplete and to the best of my knowledge everything appears to be working, ie. LanguageClient-neovim works quite well with clangd for C, C++, and Objective-C. I have the below settings setup for javascript, javascript.jsx, and typescript in a file I use to configure my LanguageClient-neovim for neovim.

let g:LanguageClient_serverCommands = {
      \ 'rust': ['rustup', 'run', 'nightly', 'rls'],
      \ 'javascript': ['javascript-typescript-stdio'],
      \ 'javascript.jsx': ['javascript-typescript-stdio'],
      \ 'typescript': ['javascript-typescript-stdio'],
      \ 'cpp': ['clangd'],
      \ 'objc': ['clangd'],
      \ 'c': ['clangd'],
      \ 'objcpp': ['clangd']
      \ }

noremap <silent> H :call LanguageClient_textDocument_hover()<CR>
noremap <silent> Z :call LanguageClient_textDocument_definition()<CR>
noremap <silent> R :call LanguageClient_textDocument_rename()<CR>
noremap <silent> S :call LanguageClient_textDocument_documentSymbol()<CR>

set omnifunc=LanguageClient#complete
set completefunc=LanguageClient#complete

Thus bringing me to my question, I am not seeing the variety of completions I see when using VS Code. Is this to be expected, or am I missing a piece of the puzzle here?

Ex VS Code completions
vs-code-js-completions

Ex Neovim, LanguageClient-neovim, deoplete completions
neovim-js-completions

Looks like a duplicate of #432
TL;DR neovim doesn't update the document content properly.

If you believe this is a bug in the language server, I would need to see full logs

ehhh, ๐Ÿ˜ฌ I was hoping this wouldn't turn into a finger pointing contest. That said, I'll try and mess around with a different language client for Neovim, and see if is in fact an issue with the above mentioned LanguageClient-neovim.

And I read the whole thread you mention, ie. #432 and it seemed you closed the issue, and pointed to another open issue, that was later closed. scratches head. From what I gathered from reading #432 @kyrisu has since switched to nvim-typescript I'll try and mess around with it, ie. experiment with different solutions, and post updates in this thread.

cheers ๐Ÿป

I also encountered the same troublesome problem.

@hackingcat haven't really devoted anytime to explore other solutions, nor have I troubleshooted this in depth. If you would like to do a "pair programming" session and attempt to explore possible solutions, and possibly even propose a work around I could spend an hour or two to work on this. Presently I'm in CST, and you can reach me at chris[dot]r[dot]jones[dot]1983[at]gmail[dot]com

I figure just reporting bad behavior of this language server, then start "finger pointing", and following up with "me too" isn't doing anybody any favors. ๐Ÿคทโ€โ™‚๏ธ So I'll the leave line ๐Ÿ“ž open.

A logfile would already be helpful to identify the problem (and determine whether this issue should be kept open at this repo)

@ipatch I'm using deoplete-ternjs to substitute for the language server's autocompletion.

call deoplete#custom#option('ignore_sources', {'python': ['LanguageClient'],
      \'javascript':['LanguageClient'],'javascript.jsx':['LanguageClient'],'typescript':['LanguageClient'],
      \'cpp':['LanguageClient'],'c':['LanguageClient']
      \ })    " disable LC

It works well.But I also use the other functions of javascript-typescript-langserver , and it's awesome.

i experience the same kinda thing, for me the intelligent renaming capability of the langserver was not working too. i had raised an issue at Language-client neovim thinking it was a problem from their part. i have attached the necessary log files and all details , along with a video in the issue. do check out this issue and see if could salvage something out of it,
autozimu/LanguageClient-neovim#538

@hackingcat im particularly new to js programming. how good are the completions using deoplete-ternjs?

@yedhink would you mind taking that discussion to Gitter to not take this issue off topic?

@felixfbecker sure. i dont mind!

Looks like javascript-typescript-langserver requires jsconfig.json to work with javascript files.
It doesn't have well support of inferred project like tsserver does.

@ipatch The combination of autozimu/LanguageClient-neovim and ncm2/ncm2 is awesome ,and you can have a try.