lifepillar / vim-mucomplete

Chained completion that works the way you want!
MIT License
913 stars 18 forks source link

Completion methods are skipped even if they return results #14

Closed lifepillar closed 8 years ago

lifepillar commented 8 years ago

Some completion methods may be skipped in some circumstances, even when they have high priority and they return (possibly, not very quickly) some results. The problem can be reproduced with line completion. Set:

let g:mucomplete#chains.default = ['line', 'keyn']
set showmode shortmess-=c

then insert this text:

So long as men can breathe, or eyes can see,
So long lives this, and this gives life to thee.

Enable automatic completion and type iSo. Line completion is triggered, as expected, but µcomplete goes on trying (not local, btw!) keyword completion.

This issue affects 'tags', 'line', 'dict' (see https://github.com/lifepillar/vim-mucomplete/issues/7 and https://github.com/lifepillar/vim-mucomplete/issues/9) and omni/user completion from some plugins (notably, clang_complete).

The reason is that pumvisible() returns 0 when it is expected to return 1 in mucomplete#complete_chain(). Interestingly, if I “slow down” mucomplete#complete_chain() by putting sleep commands, I can see that pumvisible() returns 0 when the popup menu is actually visible.

Not sure if I have hit a bug in Vim or it is just a problem of buffering/typeahead or another timing issue.

lifepillar commented 8 years ago

Interestingly, this seems a regression (that's why I hadn't noticed before…) introduced by c173570ac8dd4a4046885408f5269c32e95d11fe.

lifepillar commented 8 years ago

@Konfekt @tjharman I have addressed this problem. Could you please try the current master and see how it works for you now?

Konfekt commented 8 years ago

Thanks. Works perfectly.