javascript-typescript-langserver icon indicating copy to clipboard operation
javascript-typescript-langserver copied to clipboard

What to expect for code completion using Neovim

Open ipatch opened this issue 7 years ago • 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

ipatch avatar Jul 25 '18 17:07 ipatch

Looks like a duplicate of https://github.com/sourcegraph/javascript-typescript-langserver/issues/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

felixfbecker avatar Jul 25 '18 17:07 felixfbecker

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 🍻

ipatch avatar Jul 25 '18 18:07 ipatch

I also encountered the same troublesome problem.

hackingcat avatar Jul 28 '18 17:07 hackingcat

@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.

ipatch avatar Jul 28 '18 18:07 ipatch

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

felixfbecker avatar Jul 29 '18 00:07 felixfbecker

@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.

hackingcat avatar Jul 29 '18 09:07 hackingcat

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,
https://github.com/autozimu/LanguageClient-neovim/issues/538

yedhink avatar Jul 30 '18 02:07 yedhink

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

yedhink avatar Jul 30 '18 02:07 yedhink

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

felixfbecker avatar Jul 30 '18 02:07 felixfbecker

@felixfbecker sure. i dont mind!

yedhink avatar Jul 30 '18 02:07 yedhink

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.

chemzqm avatar Aug 03 '18 09:08 chemzqm

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

pittcat avatar Aug 13 '18 02:08 pittcat