I have had some success with this plugin: https://github.com/ternjs/tern_for_vim
But it does require some setting up:
After installing the plugin, you need to
cd into the plugin folder and run
For each project you work on, you need to create a
.tern-project file. (See below)
I also tweak some of the plugin's config in Vim:
" Don't keep locking up Vim (an issue if the codebase is large)
let g:tern_show_argument_hints = 'never'
let g:tern_show_signature_in_pum = 1
I make the
K key use Tern to look up documentation:
autocmd BufReadPost *.js nnoremap <buffer> K :TernDoc<CR>
Here is an example
.tern-project file you can start from:
The dependencyBudget will stop waiting for a response if Tern cannot provide one quickly. But I have found that the server will continue loading scripts and inferring in the background, so you can wait a while and then try the completion again.
(I have completion on Tab but I can't see where that was configured!)
There are some more examples of
.tern-project files here.