abo-abo / function-args

C++ completion for GNU Emacs
120 stars 10 forks source link

moo-complete provides candidates not in scope #8

Closed tuhdo closed 10 years ago

tuhdo commented 10 years ago

You can get the same files in this issue: https://github.com/abo-abo/function-args/issues/7

I tried to complete viable_colors in solve() function (the first function in the cpp file). But moo-complete gave me viable_color, while in the current function (that the cursor is in) or the included files has no such variable. viable_color is the variable used in other functions.

How to reproduce:

abo-abo commented 10 years ago

This is the intended behavior. viable_color appears because it's in the function find_redundant_color. While it could be possible to remove it, I chose not to so far. The reason is that C++ is a complex language and current CEDET parser becomes helpless with intricate C++ code (such as heavy templates, or indirection). That's why i choose to provide as many completion candidates as possible, even if some of them are wrong. Otherwise in some situations you would get zero candidates.

The behavior of moo-complete is to complete up to longest common prefix, if it's one of the candidates, which is the case here with viable_color and viable_colors. Invoking moo-complete the second time after the longest common prefix has been filled in is also the intended behavior.

abo-abo commented 10 years ago

You can use CEDET's standard semantic-ia-complete-symbol in place of moo-complete. It has the behavior that you want.

tuhdo commented 10 years ago

Ok got it. You should update the documentation on moo-complete to avoid future confusions. Thanks.