Libo Song wrote:
On Mon, Jul 26, 2010 at 4:35 AM, Liu Lei <[email protected]> wrote:
Hi, All:
I'm using VIM+Cscope+Ctags+OmniCppComplete for coding.
But, I found that the OmniCppComplete can NOT complete the anonymous members in
struct/union.
Example.
===================================
struct abc {
int a;
struct {
int b;
};
union {
int c;
};
};
int main()
{
struct abc *xyz;
xyz->+------------+
| abc::a m + |
+------------+
}
===================================
There is only 'a' in the popup menu, but no 'b' or 'c'.
Does anyone solved it?
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Your "struct abc" has only one member vaiable "int a". It has two other
unnamed types.
Actually, b and c are members of an anonymous struct and union,
respectively, with scope identical to that of member a; thus, it is
reasonable to expect that OmniCppComplete would perform the same
completion for b and c as it does for a. I looked at the tags file and
confirmed that ctags does indeed recognize anonymous structs and unions.
The problem may lie in the different way ctags lists the normal members
and the anonymous members: e.g.,
a is listed as a member of `struct:abc'
b, on the other hand, is listed as a member of `struct:abc::__anon1
On a hunch, I re-declared the struct provided by the OP as follows...
struct abc {
int a;
struct {
struct b {
int i, j, k;
}
};
union {
int c;
};
};
Then, within main, I typed...
abc::__anon1::b *p;
p->
...and OmniCppComplete listed i, j and k as possible completions. It is
clear, I think, that the OmniCppComplete plugin simply does not
understand the format used by ctags for anonymous structs/unions.
Sincerely,
Brett Stahlman
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php