I wrote this pseudo-code ONLY for C++/./ If we're not dealing with C++
then the code simply doesn't execute, and you get the old behavior, so
the completion WILL FAIL in C.
Defining variables only with type name (and without 'struct' keyword
before this type name) is a well-established language feature that is
used by almost all C++ programmers. Why do you call this a bug?
Bram Moolenaar wrote:
Kyku wrote:
Ok, using the old saying "Use the force, read the source" I browsed
ccomplete.vim a little. If I knew Vim scripting a little, I'd do the
following:
After line 406:
if we're dealing with C++ file:
if item['kind'] is 'c', 'u' or 's':
kind2name = {'c': 'class', 'u': 'union', 's': 'struct'}
call StructMembers for kind2name[item['kind']] . ':' . tokens[tidx]
That should do the trick. What do you think?
I don't think this gives good results. A name can be defined in several
ways with different types. If you omit the "struct" like you did in
your first example it is not valid C and completion _should_ fail. I
don't know why C++ would allow this, looks like a bug to me (so do many
others things in C++ :-).