Friday, February 25, 2011

Question about omnicppcomplete

I use Vim and omnicppcomplete script for C programming for a long time.
There are powerful.
These day I got some code from product vender.
There are some struct defines with the same name.
I found omnicppcomplete complete wrong members in some case.
Here is a example.
In the code frome MosaicDisplay_test.c:
[CODE]
974 static Void App_dispUpdateFrameList(App_DisplayObj *appObj,
975 FVID2_FrameList *fList)
976 {
977 UInt32 index;
978 UInt32 frmCnt;
979 FVID2_Frame *frame;
980 Vps_DispRtParams *rtPrms = NULL;
981
982 /* Change the application layout every LAYOUT_SWITCH_RATE frames */
983 if ((0u != appObj->submittedFrames) &&
984 (0u == (appObj->submittedFrames % LAYOUT_SWITCH_RATE)))
985 {
986 /* Move to the next layout */
987 appObj->curLayoutIdx++;
988 System_printf("%s: curLayoutIdx:%u!\n", APP_NAME,vappObj->curLayoutIdx);
...
[/CODE]
There are more than one defines of App_DisplayObj.
Here are the output of ":ta App_DisplayObj" in vim with
MosaicDisplay_test.c is opened in the active buffer:
[CODE]
# pri kind tag file
1 FSC t App_DisplayObj ./hdvpss_01_00_01_25/packages/ti/psp/examples/common/vps/display/mosaicDisplay/src/MosaicDisplay_test.c
line:214 typeref:struct:__anon4817
} App_DisplayObj;
2 F t App_DisplayObj ./hdvpss_01_00_01_25/packages/ti/psp/examples/common/vps/chains/links/grpx/grpxLink_priv.h
line:109 typeref:struct:__anon4842
} App_DisplayObj;
3 F t App_DisplayObj ./hdvpss_01_00_01_25/packages/ti/psp/examples/common/vps/display/triDisplay/src/TriDisplay.h
line:166 typeref:struct:__anon4819
} App_DisplayObj;
Type number and (empty cancels):
[/CODE]
From the output, ctags had find the correct define of App_DisplayObj in current file(MosaicDisplay_test.c) and put it in first.
If I input "appObj->" in the scope of App_dispUpdateFrameList, the omnicppcomplete with popup the members of
App_DisplayObj which are defined in grpxLink_priv.h,
but not the local defined ones in MosaicDisplay_test.c.
I think the Omnicppcomplete picks the define in the first header file,
in the output(in this case is grpxLink_priv.h).
How should I change the behavior of omnicppcomplete to pick the correct defined members in this case?
Thanks.

--
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

No comments:

Post a Comment