I debugged this issue for a while, in the latest svn code.
In the function, in my condition m_CCAutoAddParentheses is true.
void CodeCompletion::DoAutocomplete(const CCToken& token, cbEditor* ed)
{
wxString itemText = CodeCompletionHelper::AutocompGetName(token.displayName);
cbStyledTextCtrl* stc = ed->GetControl();
...
...
if (token.id != -1 && m_CCAutoAddParentheses)
{
CC_LOCKER_TRACK_TT_MTX_LOCK(s_TokenTreeMutex)
TokenTree* tree = m_NativeParser.GetParser().GetTokenTree();
const Token* tkn = tree->at(token.id);
...
I see that the token.id is always -1, this is the call stack:
#0 CodeCompletion::DoAutocomplete (this=0x5c38db8, token=..., ed=0xd09d5a8) at D:\code\cb\cb_sf_git\cccrash2019\src\plugins\codecompletion\codecompletion.cpp:1335
#1 0x694a5ac9 in cbCodeCompletionPlugin::DoAutocomplete (this=0x5c38db8, token=L"gggggccccc(): int", ed=0xd09d5a8) at D:\code\cb\cb_sf_git\cccrash2019\src\sdk\cbplugin.cpp:1028
#2 0x694bbedd in CCManager::OnEditorHook (this=0xd069478, ed=0xd09d5a8, event=...) at D:\code\cb\cb_sf_git\cccrash2019\src\sdk\ccmanager.cpp:885
#3 0x69797921 in EditorHooks::HookFunctor<CCManager>::Call (this=0xcd3ebd0, editor=0xd09d5a8, event=...) at D:\code\cb\cb_sf_git\cccrash2019\src\include\editor_hooks.h:61
#4 0x694f3b73 in EditorHooks::CallHooks (editor=0xd09d5a8, event=...) at D:\code\cb\cb_sf_git\cccrash2019\src\sdk\editor_hooks.cpp:122
...
I see that in the
void cbCodeCompletionPlugin::DoAutocomplete(const wxString& token, cbEditor* ed)
{
DoAutocomplete(CCToken(-1, token), ed);
}
You see, the first argument of the CCToken constructor is -1, and this is actually the token.id.
I'm not sure why.