ternjs / tern_for_vim

Tern plugin for Vim
MIT License
1.83k stars 100 forks source link

Omnicomplete uses stale completion list #66

Closed ackalker closed 10 years ago

ackalker commented 10 years ago

Problem: Omnicomplete after <identifier>. sometimes shows stale completions (from a previous omnicomplete). Seen with:

$ vim --version | head -n 3
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jun  1 2014 10:47:35)
Included patches: 1-307
Compiled by Arch Linux

tern_for_vim@master

Steps to reproduce:

$ npm install cheerio

.tern-project:

{
  "plugins": {
    "node": { }
  }
}

example.js:

cheerio = require('cheerio');

Now, edit the example.js file with Vim:

ackalker commented 10 years ago

Workaround: always accept a completion, even if it's just temporary:

To make sure that omni completion doesn't get 'stuck' on a particular identifier, always accept something from the omnicomplete window. If it's a function, add an empty pair of parentheses (important!), then add a semicolon (perhaps not required, but it works) and press Enter.

This appears to 'reset' the omni completion so that next time it will complete on the right identifier. The temporary completion can now be deleted.

ackalker commented 10 years ago

Wow, that was fast! Thanks :-)