21 #include <wx/fs_zip.h> 65 #define CC_CODECOMPLETION_DEBUG_OUTPUT 0 68 #if defined(CC_GLOBAL_DEBUG_OUTPUT) 69 #undef CC_CODECOMPLETION_DEBUG_OUTPUT 70 #define CC_CODECOMPLETION_DEBUG_OUTPUT CC_GLOBAL_DEBUG_OUTPUT 73 #if CC_CODECOMPLETION_DEBUG_OUTPUT == 1 74 #define TRACE(format, args...) \ 75 CCLogger::Get()->DebugLog(F(format, ##args)) 76 #define TRACE2(format, args...) 77 #elif CC_CODECOMPLETION_DEBUG_OUTPUT == 2 78 #define TRACE(format, args...) \ 81 if (g_EnableDebugTrace) \ 82 CCLogger::Get()->DebugLog(F(format, ##args)); \ 85 #define TRACE2(format, args...) \ 86 CCLogger::Get()->DebugLog(F(format, ##args)) 88 #define TRACE(format, args...) 89 #define TRACE2(format, args...) 109 result = wxStricmp(fs1.
Name, fs2.
Name);
121 result = wxStricmp(fs1.
Name, fs2.
Name);
147 while (--position > 0)
149 const int style = control->
GetStyleAt(position);
172 const int totalLength = control->
GetLength();
174 while (++position < totalLength)
176 const int style = control->
GetStyleAt(position);
193 return second.
Len() - first.
Len();
204 size_t index = line.
find(_T(
'#'));
209 for (; index < line.
length(); ++index)
211 if (line[index] != _T(
' ') && line[index] != _T(
'\t'))
213 if (line.
Mid(index, 7) == _T(
"include"))
228 bool ReturnValue =
false;
234 const wxRegEx reg(_T(
"^[ \t]*#[ \t]*include[ \t]+[\"<]([^\">]+)[\">]"));
241 NameUnderCursor = inc;
252 NameUnderCursor.
Clear();
253 NameUnderCursor << word;
277 return selected.
substr(0,nameEnd);
284 static const char * cpp_keyword_xpm[] = {
307 static const char *d_keyword_xpm[] = {
338 static const char * unknown_keyword_xpm[] = {
366 static const char* header_file_xpm[] = {
428 #define REALTIME_PARSING_DELAY 500 434 #define TOOLBAR_REFRESH_DELAY 150 439 #define EDITOR_ACTIVATED_DELAY 300 470 m_CodeRefactoring(m_NativeParser),
472 m_TimerRealtimeParsing(this, idRealtimeParsingTimer),
473 m_TimerToolbar(this, idToolbarTimer),
474 m_TimerProjectSaved(this, idProjectSavedTimer),
475 m_TimerReparsing(this, idReparsingTimer),
476 m_TimerEditorActivated(this, idEditorActivatedTimer),
481 m_ToolbarNeedRefresh(true),
482 m_ToolbarNeedReparse(false),
484 m_NeedReparse(false),
486 m_NeedsBatchColour(true),
487 m_CCMaxMatches(16384),
488 m_CCAutoAddParentheses(true),
489 m_CCDetectImplementation(false),
490 m_CCEnableHeaders(false),
491 m_CCEnablePlatformCheck(true),
492 m_SystemHeadersThreadCS(),
542 while (!m_SystemHeadersThreads.empty())
548 m_SystemHeadersThreads.pop_front();
562 m_FunctionsScope.clear();
563 m_NameSpaces.clear();
564 m_AllFunctionsScopes.clear();
565 m_ToolbarNeedRefresh =
true;
574 m_NativeParser.SetNextHandler(
this);
576 m_NativeParser.CreateClassBrowser();
606 m_DocHelper.OnAttach();
611 m_NativeParser.RemoveClassBrowser(appShutDown);
612 m_NativeParser.ClearParsers();
615 m_NativeParser.SetNextHandler(
nullptr);
624 m_FunctionsScope.clear();
625 m_NameSpaces.clear();
626 m_AllFunctionsScopes.clear();
627 m_ToolbarNeedRefresh =
false;
631 m_EditMenu->Delete(idMenuRenameSymbols);
635 m_SearchMenu->Delete(idMenuGotoFunction);
636 m_SearchMenu->Delete(idMenuGotoPrevFunction);
637 m_SearchMenu->Delete(idMenuGotoNextFunction);
638 m_SearchMenu->Delete(idMenuGotoDeclaration);
639 m_SearchMenu->Delete(idMenuGotoImplementation);
640 m_SearchMenu->Delete(idMenuFindReferences);
641 m_SearchMenu->Delete(idMenuOpenIncludeFile);
644 m_DocHelper.OnRelease();
649 return new CCOptionsDlg(parent, &m_NativeParser,
this, &m_DocHelper);
666 m_EditMenu = menuBar->
GetMenu(pos);
668 m_EditMenu->Append(idMenuRenameSymbols,
_(
"Rename symbols\tAlt-N"));
676 m_SearchMenu = menuBar->
GetMenu(pos);
677 m_SearchMenu->
Append(idMenuGotoFunction,
_(
"Goto function...\tCtrl-Shift-G"));
678 m_SearchMenu->Append(idMenuGotoPrevFunction,
_(
"Goto previous function\tCtrl-PgUp"));
679 m_SearchMenu->Append(idMenuGotoNextFunction,
_(
"Goto next function\tCtrl-PgDn"));
680 m_SearchMenu->Append(idMenuGotoDeclaration,
_(
"Goto declaration\tCtrl-Shift-."));
681 m_SearchMenu->Append(idMenuGotoImplementation,
_(
"Goto implementation\tCtrl-."));
682 m_SearchMenu->Append(idMenuFindReferences,
_(
"Find references\tAlt-."));
683 m_SearchMenu->Append(idMenuOpenIncludeFile,
_(
"Open include file\tCtrl-Shift-."));
692 m_ViewMenu = menuBar->
GetMenu(idx);
694 bool inserted =
false;
697 for (
size_t i = 0; i < items.GetCount(); ++i)
699 if (items[i]->IsSeparator())
701 m_ViewMenu->InsertCheckItem(i, idViewClassBrowser,
_(
"Symbols browser"),
_(
"Toggle displaying the symbols browser"));
709 m_ViewMenu->AppendCheckItem(idViewClassBrowser,
_(
"Symbols browser"),
_(
"Toggle displaying the symbols browser"));
718 m_ProjectMenu = menuBar->
GetMenu(idx);
720 bool inserted =
false;
723 for (
size_t i = items.GetCount() - 1; i > 0; --i)
725 if (items[i]->IsSeparator())
727 m_ProjectMenu->InsertSeparator(i);
728 m_ProjectMenu->Insert(i + 1, idCurrentProjectReparse,
_(
"Reparse current project"),
_(
"Reparse of the final switched project"));
737 m_ProjectMenu->AppendSeparator();
738 m_ProjectMenu->Append(idCurrentProjectReparse,
_(
"Reparse current project"),
_(
"Reparse of the final switched project"));
748 if (!menu || !IsAttached() || !m_InitDone)
755 if ( !IsProviderFor(ed) )
760 bool IsInclude =
false;
769 msg.
Printf(
_(
"Open #include file: '%s'"), NameUnderCursor.
wx_str());
770 menu->
Insert(0, idOpenIncludeFile, msg);
777 int pos = initialPos;
779 msg.
Printf(
_(
"Find declaration of: '%s'"), NameUnderCursor.
wx_str());
780 menu->
Insert(pos++, idGotoDeclaration, msg);
782 msg.
Printf(
_(
"Find implementation of: '%s'"), NameUnderCursor.
wx_str());
783 menu->
Insert(pos++, idGotoImplementation, msg);
785 if (m_NativeParser.GetParser().Done())
787 msg.
Printf(
_(
"Find references of: '%s'"), NameUnderCursor.
wx_str());
788 menu->
Insert(pos++, idMenuFindReferences, msg);
794 const int insertId = menu->
FindItem(
_(
"Insert/Refactor"));
799 if (
wxMenu* subMenu = insertMenu->GetSubMenu())
801 subMenu->Append(idClassMethod,
_(
"Class method declaration/implementation..."));
802 subMenu->Append(idUnimplementedClassMethods,
_(
"All class methods without implementation..."));
804 subMenu->AppendSeparator();
806 const bool enableRename = (m_NativeParser.GetParser().Done() && nameUnderCursor && !IsInclude);
807 subMenu->Append(idMenuRenameSymbols,
_(
"Rename symbols"),
_(
"Rename symbols under cursor"));
808 subMenu->Enable(idMenuRenameSymbols, enableRename);
829 menu->
Insert(position, idSelectedProjectReparse,
_(
"Reparse this project"),
830 _(
"Reparse current actived project"));
833 menu->
Append(idSelectedFileReparse,
_(
"Reparse this file"),
_(
"Reparse current selected file"));
843 m_Function = XRCCTRL(*toolBar,
"chcCodeCompletionFunction",
wxChoice);
844 m_Scope = XRCCTRL(*toolBar,
"chcCodeCompletionScope",
wxChoice);
852 EnableToolbarTools(
false);
873 return ccpsUniversal;
878 std::vector<CCToken> tokens;
880 if (!IsAttached() || !m_InitDone)
891 if ( ( curChar ==
wxT(
':')
893 || ( curChar ==
wxT(
'>')
905 if (lineFirstChar ==
wxT(
'#'))
911 if (str ==
wxT(
"include") && tknEnd > endPos)
913 DoCodeCompleteIncludes(ed, tknStart, tknEnd, tokens);
915 else if (endPos >= tknEnd && tknEnd > lineIndentPos)
916 DoCodeCompletePreprocessor(tknStart, tknEnd, ed, tokens);
917 else if ( ( str ==
wxT(
"define")
919 || str ==
wxT(
"ifdef")
920 || str ==
wxT(
"ifndef")
921 || str ==
wxT(
"elif")
922 || str ==
wxT(
"elifdef")
923 || str ==
wxT(
"elifndef")
924 || str ==
wxT(
"undef") )
927 DoCodeComplete(tknEnd, ed, tokens,
true);
931 else if (curChar ==
wxT(
'#'))
933 else if (lineFirstChar ==
wxT(
':') && curChar == _T(
':'))
944 DoCodeComplete(tknEnd, ed, tokens);
950 const bool caseSens = m_NativeParser.GetParser().Options().caseSensitive;
954 if ( m_NativeParser.MarkItemsByAI(result, m_NativeParser.GetParser().Options().useSmartSense,
true, caseSens, caretPos)
955 || m_NativeParser.LastAISearchWasGlobal() )
959 TRACE(
F(
wxT(
"%lu results"), static_cast<unsigned long>(result.size())));
961 if (result.size() <= m_CCMaxMatches)
966 wxImageList* ilist = m_NativeParser.GetImageList();
969 tokens.reserve(result.size());
970 std::set<int> alreadyRegistered;
973 TokenTree* tree = m_NativeParser.GetParser().GetTokenTree();
977 for (TokenIdxSet::const_iterator it = result.begin(); it != result.end(); ++it)
979 const Token* token = tree->
at(*it);
986 int iidx = m_NativeParser.GetTokenKindImage(token);
987 if (alreadyRegistered.find(iidx) == alreadyRegistered.end())
990 alreadyRegistered.insert(iidx);
996 if (m_DocHelper.IsEnabled())
1004 uniqueStrings.insert(token->
m_Name);
1008 for (
size_t i = 0; i < token->
m_Aliases.size(); ++i)
1012 uniqueStrings.insert(token->
m_Aliases[i]);
1019 if (m_NativeParser.LastAISearchWasGlobal() && !preprocessorOnly)
1028 wxString lastSearch = m_NativeParser.LastAIGlobalSearch().
Lower();
1038 if (isC && strLang ==
wxT(
"C/C++"))
1040 else if (isC && strLang ==
wxT(
"D"))
1048 if (!m_LexerKeywordsToInclude[i])
1057 && uniqueStrings.find(kw) == uniqueStrings.end() )
1069 "Please edit results' limit in code-completion options,\n" 1070 "or type at least one more character to narrow the scope down.");
1079 if (!m_NativeParser.GetParser().Done())
1081 wxString msg =
_(
"The Parser is still parsing files.");
1083 msg += m_NativeParser.GetParser().NotDoneReason();
1106 macros.push_back(
wxT(
"define"));
1107 macros.push_back(
wxT(
"elif"));
1108 macros.push_back(
wxT(
"elifdef"));
1109 macros.push_back(
wxT(
"elifndef"));
1110 macros.push_back(
wxT(
"else"));
1111 macros.push_back(
wxT(
"endif"));
1112 macros.push_back(
wxT(
"error"));
1113 macros.push_back(
wxT(
"if"));
1114 macros.push_back(
wxT(
"ifdef"));
1115 macros.push_back(
wxT(
"ifndef"));
1116 macros.push_back(
wxT(
"include"));
1117 macros.push_back(
wxT(
"line"));
1118 macros.push_back(
wxT(
"pragma"));
1119 macros.push_back(
wxT(
"undef"));
1121 for (
size_t i = 0; i < macros.size(); ++i)
1123 if (text.
IsEmpty() || macros[i][0] == text[0])
1133 if (!m_CCEnableHeaders)
1150 int keyPos = line.
Find(
wxT(
'"'));
1151 if (keyPos ==
wxNOT_FOUND || keyPos >= tknEnd - lineStartPos)
1153 if (keyPos ==
wxNOT_FOUND || keyPos >= tknEnd - lineStartPos)
1165 size_t maxFiles = m_CCMaxMatches;
1166 if (filename.
IsEmpty() && maxFiles > 3000)
1172 cbProject* project = m_NativeParser.GetProjectByEditor(ed);
1176 #if wxCHECK_VERSION(3, 0, 0) 1177 if (m_SystemHeadersThreadCS.TryEnter())
1181 m_SystemHeadersThreadCS.Enter();
1182 #endif // wxCHECK_VERSION(3, 0, 0) 1185 for (
size_t i = 0; i < incDirs.
GetCount(); ++i)
1188 SystemHeadersMap::const_iterator shm_it = m_SystemHeadersMap.find(incDirs[i]);
1189 if (shm_it != m_SystemHeadersMap.end())
1191 const StringSet& headers = shm_it->second;
1192 for (StringSet::const_iterator ss_it = headers.begin(); ss_it != headers.end(); ++ss_it)
1199 if (files.size() > maxFiles)
1203 if (files.size() > maxFiles)
1207 m_SystemHeadersThreadCS.Leave();
1213 #if wxCHECK_VERSION(3, 0, 0) 1214 if (m_SystemHeadersThreadCS.TryEnter())
1218 m_SystemHeadersThreadCS.Enter();
1219 #endif // wxCHECK_VERSION(3, 0, 0) 1225 const wxArrayString localIncludeDirs = GetLocalIncludeDirs(project, buildTargets);
1226 for (FilesList::const_iterator it = project->
GetFilesList().begin();
1234 for (
size_t j = 0; j < localIncludeDirs.
GetCount(); ++j)
1236 const wxString& dir = localIncludeDirs[j];
1239 header = file.
Mid(dir.
Len());
1258 if (files.size() > maxFiles)
1263 m_SystemHeadersThreadCS.Leave();
1269 tknStart = lineStartPos + keyPos;
1270 tokens.reserve(files.size());
1271 for (StringSet::const_iterator ssIt = files.begin(); ssIt != files.end(); ++ssIt)
1280 std::vector<CCCallTip> tips;
1281 if (!IsAttached() || !m_InitDone || style ==
wxSCI_C_WXSMITH || !m_NativeParser.GetParser().Done())
1284 int typedCommas = 0;
1286 argsPos = m_NativeParser.GetCallTips(items, typedCommas, ed, pos);
1288 for (
size_t i = 0; i < items.
GetCount(); ++i)
1291 if ( uniqueTips.find(items[i]) == uniqueTips.end()
1293 && typedCommas <= m_NativeParser.CountCommas(items[i], 0) )
1295 uniqueTips.insert(items[i]);
1298 m_NativeParser.GetCallTipHighlight(items[i], &hlStart, &hlEnd, typedCommas);
1299 tips.push_back(
CCCallTip(items[i], hlStart, hlEnd));
1307 return m_DocHelper.GenerateHTML(token.
id, m_NativeParser.GetParser().GetTokenTree());
1312 std::vector<CCToken> tokens;
1313 if (!IsAttached() || !m_InitDone)
1329 if (m_NativeParser.MarkItemsByAI(result,
true,
false,
true, endOfWord))
1331 TokenTree* tree = m_NativeParser.GetParser().GetTokenTree();
1335 for (TokenIdxSet::const_iterator it = result.begin(); it != result.end(); ++it)
1337 const Token* token = tree->
at(*it);
1341 if (tokens.size() > 32)
1354 return m_DocHelper.OnDocumentationLink(event, dismissPopup);
1364 if ( itemText.
GetChar(0) == _T(
'~')
1366 && stc->
GetCharAt(startPos - 1) == _T(
'~'))
1370 bool needReparse =
false;
1375 bool addComment = (itemText ==
wxT(
"endif"));
1392 for (
int ppLine = stc->
GetCurrentLine() - 1; ppLine >= 0; --ppLine)
1403 wxRegEx pp(
wxT(
"^[ \t]*#[ \t]*[a-z]*([ \t]+([a-zA-Z0-9_]+)|())"));
1413 int pos = startPos - 1;
1415 while (ch != _T(
'<') && ch != _T(
'"') && ch != _T(
'#') && (pos>0))
1417 if (ch == _T(
'<') || ch == _T(
'"'))
1421 itemText << _T(
'"');
1422 else if (ch == _T(
'<'))
1423 itemText << _T('>
'); 1427 const int endPos = stc->WordEndPosition(curPos, true); 1428 const wxString& alreadyText = stc->GetTextRange(curPos, endPos); 1429 if (!alreadyText.IsEmpty() && itemText.EndsWith(alreadyText)) 1433 int positionModificator = 0; 1434 bool insideParentheses = false; 1435 if (token.id != -1 && m_CCAutoAddParentheses) 1437 CC_LOCKER_TRACK_TT_MTX_LOCK(s_TokenTreeMutex) 1439 TokenTree* tree = m_NativeParser.GetParser().GetTokenTree(); 1440 const Token* tkn = tree->at(token.id); 1443 { CC_LOCKER_TRACK_TT_MTX_UNLOCK(s_TokenTreeMutex) } 1446 bool addParentheses = tkn->m_TokenKind & tkAnyFunction; 1447 if (!addParentheses && (tkn->m_TokenKind & tkMacroDef)) 1449 if (tkn->m_Args.size() > 0) 1450 addParentheses = true; 1452 // cache args to avoid locking 1453 wxString tokenArgs = tkn->GetStrippedArgs(); 1455 CC_LOCKER_TRACK_TT_MTX_UNLOCK(s_TokenTreeMutex) 1459 bool insideFunction = true; 1460 if (m_CCDetectImplementation) 1462 ccSearchData searchData = { stc, ed->GetFilename() }; 1464 if (m_NativeParser.FindCurrentFunctionStart(&searchData, 0, 0, &funcToken) == -1) 1467 itemText += tokenArgs; 1468 insideFunction = false; 1470 else // Found something, but result may be false positive. 1472 CC_LOCKER_TRACK_TT_MTX_LOCK(s_TokenTreeMutex) 1474 const Token* parent = tree->at(funcToken); 1475 // Make sure that parent is not container (class, etc) 1476 if (parent && (parent->m_TokenKind & tkAnyFunction) == 0) 1479 itemText += tokenArgs; 1480 insideFunction = false; 1483 CC_LOCKER_TRACK_TT_MTX_UNLOCK(s_TokenTreeMutex) 1490 // Check if there are brace behind the target 1491 if (stc->GetCharAt(curPos) != _T('(
')) 1493 itemText += _T("()"); 1494 if (tokenArgs.size() > 2) // more than '()
' 1496 positionModificator = -1; 1497 insideParentheses = true; 1501 positionModificator = 1; // Set caret after '(
' 1507 stc->SetTargetStart(startPos); 1508 stc->SetTargetEnd(curPos); 1510 stc->AutoCompCancel(); 1511 if (stc->GetTextRange(startPos, curPos) != itemText) 1512 stc->ReplaceTarget(itemText); 1513 stc->GotoPos(startPos + itemText.Length() + positionModificator); 1515 if (insideParentheses) 1517 stc->EnableTabSmartJump(); 1518 int tooltipMode = Manager::Get()->GetConfigManager(wxT("ccmanager"))->ReadInt(wxT("/tooltip_mode"), 1); 1519 if (tooltipMode != 3) // keybound only 1521 CodeBlocksEvent evt(cbEVT_SHOW_CALL_TIP); 1522 Manager::Get()->ProcessEvent(evt); 1528 TRACE(_T("CodeCompletion::EditorEventHook: Starting m_TimerRealtimeParsing.")); 1529 m_TimerRealtimeParsing.Start(1, wxTIMER_ONE_SHOT); 1531 stc->ChooseCaretX(); 1534 wxArrayString CodeCompletion::GetLocalIncludeDirs(cbProject* project, const wxArrayString& buildTargets) 1537 // Do not try to operate include directories if the project is not for this platform 1538 if (m_CCEnablePlatformCheck && !project->SupportsCurrentPlatform()) 1540 // add project level compiler include search paths 1541 const wxString prjPath = project->GetCommonTopLevelPath(); 1542 GetAbsolutePath(prjPath, project->GetIncludeDirs(), dirs); 1543 // add target level compiler include search paths 1544 for (size_t i = 0; i < buildTargets.GetCount(); ++i) 1546 ProjectBuildTarget* tgt = project->GetBuildTarget(buildTargets[i]); 1547 // Do not try to operate include directories if the target is not for this platform 1548 if ( !m_CCEnablePlatformCheck || tgt->SupportsCurrentPlatform() ) 1550 GetAbsolutePath(prjPath, tgt->GetIncludeDirs(), dirs); 1554 // if a path has prefix with the project's path, it is a local include search dir
1557 for (
size_t i = 0; i < dirs.GetCount();)
1560 if (dirs[i].StartsWith(prjPath))
1564 if (m_SystemHeadersMap.find(dirs[i]) == m_SystemHeadersMap.end())
1565 sysDirs.
Add(dirs[i]);
1571 if (!sysDirs.IsEmpty())
1575 m_SystemHeadersMap, sysDirs);
1576 m_SystemHeadersThreads.push_back(thread);
1579 if (!m_SystemHeadersThreads.front()->IsRunning() && m_NativeParser.Done())
1589 static cbProject* lastProject =
nullptr;
1592 if (!force && project == lastProject)
1597 lastProject = project;
1604 ParserBase* parser = m_NativeParser.GetParserByProject(project);
1610 for (
size_t i = 0; i < incDirs.
GetCount();)
1612 if (incDirs[i].
Last() != wxFILE_SEP_PATH)
1613 incDirs[i].Append(wxFILE_SEP_PATH);
1615 if (project && incDirs[i].StartsWith(prjPath))
1626 for (
size_t i = 0; i < targets.
GetCount(); ++i)
1635 for (
size_t j = 0; j < oldDirs.
GetCount(); ++j)
1652 if (!IsAttached() || !m_InitDone)
1658 if ( !IsProviderFor(editor) )
1666 if (event.GetEventType() == wxEVT_SCI_CHARADDED)
1667 {
TRACE(_T(
"wxEVT_SCI_CHARADDED")); }
1668 else if (event.GetEventType() == wxEVT_SCI_CHANGE)
1669 {
TRACE(_T(
"wxEVT_SCI_CHANGE")); }
1670 else if (event.GetEventType() == wxEVT_SCI_MODIFIED)
1671 {
TRACE(_T(
"wxEVT_SCI_MODIFIED")); }
1672 else if (event.GetEventType() == wxEVT_SCI_AUTOCOMP_SELECTION)
1673 {
TRACE(_T(
"wxEVT_SCI_AUTOCOMP_SELECTION")); }
1674 else if (event.GetEventType() == wxEVT_SCI_AUTOCOMP_CANCELLED)
1675 {
TRACE(_T(
"wxEVT_SCI_AUTOCOMP_CANCELLED")); }
1679 if ( m_NativeParser.GetParser().Options().whileTyping
1683 m_NeedReparse =
true;
1692 TRACE(_T(
"CodeCompletion::EditorEventHook: Starting m_TimerRealtimeParsing."));
1695 m_NeedReparse =
false;
1699 if (event.GetEventType() == wxEVT_SCI_UPDATEUI)
1701 m_ToolbarNeedRefresh =
true;
1702 TRACE(_T(
"CodeCompletion::EditorEventHook: Starting m_TimerToolbar."));
1703 if (m_TimerEditorActivated.IsRunning())
1720 m_LexerKeywordsToInclude[0] = cfg->
ReadBool(_T(
"/lexer_keywords_set1"),
true);
1721 m_LexerKeywordsToInclude[1] = cfg->
ReadBool(_T(
"/lexer_keywords_set2"),
true);
1722 m_LexerKeywordsToInclude[2] = cfg->
ReadBool(_T(
"/lexer_keywords_set3"),
false);
1723 m_LexerKeywordsToInclude[3] = cfg->
ReadBool(_T(
"/lexer_keywords_set4"),
false);
1724 m_LexerKeywordsToInclude[4] = cfg->
ReadBool(_T(
"/lexer_keywords_set5"),
false);
1725 m_LexerKeywordsToInclude[5] = cfg->
ReadBool(_T(
"/lexer_keywords_set6"),
false);
1726 m_LexerKeywordsToInclude[6] = cfg->
ReadBool(_T(
"/lexer_keywords_set7"),
false);
1727 m_LexerKeywordsToInclude[7] = cfg->
ReadBool(_T(
"/lexer_keywords_set8"),
false);
1728 m_LexerKeywordsToInclude[8] = cfg->
ReadBool(_T(
"/lexer_keywords_set9"),
false);
1731 m_CCMaxMatches = cfg->
ReadInt(_T(
"/max_matches"), 16384);
1732 m_CCAutoAddParentheses = cfg->
ReadBool(_T(
"/auto_add_parentheses"),
true);
1733 m_CCDetectImplementation = cfg->
ReadBool(_T(
"/detect_implementation"),
false);
1735 m_CCEnableHeaders = cfg->
ReadBool(_T(
"/enable_headers"),
true);
1736 m_CCEnablePlatformCheck = cfg->
ReadBool(_T(
"/platform_check"),
true);
1745 m_ToolbarNeedReparse =
true;
1746 TRACE(_T(
"CodeCompletion::RereadOptions: Starting m_TimerToolbar."));
1750 m_DocHelper.RereadOptions(cfg);
1756 const bool showScope = cfg->
ReadBool(_T(
"/scope_filter"),
true);
1757 const int scopeLength = cfg->
ReadInt(_T(
"/toolbar_scope_length"), 280);
1758 const int functionLength = cfg->
ReadInt(_T(
"/toolbar_function_length"), 660);
1760 if (showScope && !m_Scope)
1763 m_Scope =
new wxChoice(m_ToolBar, XRCID(
"chcCodeCompletionScope"),
wxPoint(0, 0),
wxSize(scopeLength, -1), 0, 0);
1764 m_ToolBar->InsertControl(0, m_Scope);
1766 else if (!showScope && m_Scope)
1769 m_ToolBar->DeleteTool(m_Scope->GetId());
1775 m_Scope->SetSize(
wxSize(scopeLength, -1));
1778 m_Function->SetSize(
wxSize(functionLength, -1));
1780 m_ToolBar->Realize();
1781 m_ToolBar->SetInitialSize();
1787 bool IsInclude =
false;
1793 const bool RenameEnable = HasNameUnderCursor && !IsInclude && m_NativeParser.GetParser().Done();
1794 m_EditMenu->Enable(idMenuRenameSymbols, RenameEnable);
1799 m_SearchMenu->Enable(idMenuGotoFunction, HasEd);
1800 m_SearchMenu->Enable(idMenuGotoPrevFunction, HasEd);
1801 m_SearchMenu->Enable(idMenuGotoNextFunction, HasEd);
1803 const bool GotoEnable = HasNameUnderCursor && !IsInclude;
1804 m_SearchMenu->Enable(idMenuGotoDeclaration, GotoEnable);
1805 m_SearchMenu->Enable(idMenuGotoImplementation, GotoEnable);
1806 const bool FindEnable = HasNameUnderCursor && !IsInclude && m_NativeParser.GetParser().Done();
1807 m_SearchMenu->Enable(idMenuFindReferences, FindEnable);
1808 const bool IncludeEnable = HasNameUnderCursor && IsInclude;
1809 m_SearchMenu->Enable(idMenuOpenIncludeFile, IncludeEnable);
1815 m_ViewMenu->Check(idViewClassBrowser, isVis);
1820 cbProject* project = m_NativeParser.GetCurrentProject();
1821 m_ProjectMenu->Enable(idCurrentProjectReparse, project);
1830 #if wxCHECK_VERSION(3, 0, 0) 1831 cbMessageBox(
_(
"The symbols browser is disabled in wx3.x builds.\n" 1835 if (!
Manager::Get()->GetConfigManager(_T(
"code_completion"))->ReadBool(_T(
"/use_symbols_browser"),
true))
1837 cbMessageBox(
_(
"The symbols browser is disabled in code-completion options.\n" 1844 #endif // wxCHECK_VERSION 1854 TRACE(_T(
"OnGotoFunction"));
1856 m_NativeParser.GetParser().ParseBufferForFunctions(ed->
GetControl()->
GetText());
1859 TokenTree* tree = m_NativeParser.GetParser().GetTempTokenTree();
1872 for (
size_t i = 0; i < tree->
size(); i++)
1917 GotoFunctionPrevNext();
1922 GotoFunctionPrevNext(
true);
1927 DoClassMethodDeclImpl();
1942 TRACE(_T(
"OnGotoDeclaration"));
1950 bool isDestructor =
false;
1952 isDestructor =
true;
1963 m_NativeParser.MarkItemsByAI(result,
true,
false,
true, endPos);
1965 TokenTree* tree = m_NativeParser.GetParser().GetTokenTree();
1976 for (TokenIdxSet::const_iterator it = tmp.begin(); it != tmp.end(); ++it)
1978 const Token* token = tree->
at(*it);
1983 result.insert(token->
m_Index);
2001 for (TokenIdxSet::const_iterator it = result.begin(); it != result.end();)
2003 const Token* token = tree->
at(*it);
2015 result = savedResult;
2019 if (result.size() > 1)
2022 for (TokenIdxSet::const_iterator it = result.begin(); it != result.end(); ++it)
2024 const Token* token = tree->
at(*it);
2027 const int theOnlyOne = *it;
2029 result.insert(theOnlyOne);
2036 std::deque<CodeCompletionHelper::GotoDeclarationItem> foundItems;
2040 unsigned editorLine = -1;
2041 bool tokenFound =
false;
2044 if (result.size() == 1)
2047 Token* sel = tree->
at(*(result.begin()));
2058 && (
event.GetId() == idGotoDeclaration
2062 CCDebugInfo info(
nullptr, &m_NativeParser.GetParser(), token);
2073 editorLine = token->
m_Line - 1;
2080 else if (result.size() > 1)
2084 for (TokenIdxSet::const_iterator it = result.begin(); it != result.end(); ++it)
2086 const Token* token = tree->
at(*it);
2106 foundItems.push_back(item);
2123 editorLine = item.
line;
2126 else if (selections.
GetCount() == 1)
2132 editorLine = item.
line;
2158 m_CodeRefactoring.FindReferences();
2163 m_CodeRefactoring.RenameSymbols();
2175 bool MoveOn =
false;
2177 bool IsInclude =
false;
2187 TRACE(_T(
"OnOpenIncludeFile"));
2189 wxArrayString foundSet = m_NativeParser.GetParser().FindFileInIncludeDirs(NameUnderCursor);
2199 cbProject* project = m_NativeParser.GetProjectByEditor(editor);
2202 for (FilesList::const_iterator it = project->
GetFilesList().begin();
2215 for (
int i = 0; i < (int)foundSet.Count() - 1; i++)
2217 for (
int j = i + 1; j < (int)foundSet.Count(); )
2219 if (foundSet.
Item(i) == foundSet.
Item(j))
2238 selectedFile = foundSet[0];
2243 edMan->
Open(selectedFile);
2252 m_NativeParser.ReparseCurrentProject();
2258 m_NativeParser.ReparseSelectedProject();
2269 if (!treeItem.
IsOk())
2280 if (pf && m_NativeParser.ReparseFile(project, pf->
file.
GetFullPath()))
2293 DoParseOpenedProjectAndActiveEditor();
2304 if (IsAttached() && m_InitDone)
2313 if (!m_NativeParser.GetParserByProject(project))
2314 m_NativeParser.CreateParser(project);
2317 TRACE(_T(
"CodeCompletion::OnWorkspaceChanged: Starting m_TimerToolbar."));
2321 if (m_NativeParser.GetParser().ClassBrowserOptions().displayFilter ==
bdfProject)
2322 m_NativeParser.UpdateClassBrowser();
2336 cbProject* project =
event.GetProject();
2337 if (project && !m_NativeParser.GetParserByProject(project) && project->
GetFilesCount() > 0)
2338 m_NativeParser.CreateParser(project);
2340 if (m_NativeParser.GetParser().ClassBrowserOptions().displayFilter ==
bdfProject)
2341 m_NativeParser.UpdateClassBrowser();
2344 m_NeedsBatchColour =
true;
2353 if (IsAttached() && m_InitDone)
2355 cbProject* project =
event.GetProject();
2356 if (project && m_NativeParser.GetParserByProject(project))
2360 ReparsingMap::iterator it = m_ReparsingMap.find(project);
2361 if (it != m_ReparsingMap.end())
2362 m_ReparsingMap.erase(it);
2365 m_NativeParser.DeleteParser(project);
2374 m_TimerProjectSaved.SetClientData(event.
GetProject());
2376 TRACE(_T(
"CodeCompletion::OnProjectSaved: Starting m_TimerProjectSaved."));
2384 if (IsAttached() && m_InitDone)
2385 m_NativeParser.AddFileToParser(event.
GetProject(),
event.GetString());
2391 if (IsAttached() && m_InitDone)
2392 m_NativeParser.RemoveFileFromParser(event.
GetProject(),
event.GetString());
2398 if (IsAttached() && m_InitDone)
2401 cbProject* project =
event.GetProject();
2402 wxString filename =
event.GetString();
2404 project = m_NativeParser.GetProjectByFilename(filename);
2405 if (project && m_NativeParser.ReparseFile(project, filename))
2415 cbProject* project =
event.GetProject();
2419 ReparsingMap::iterator it = m_ReparsingMap.find(project);
2420 if (it == m_ReparsingMap.end())
2421 it = m_ReparsingMap.insert(std::make_pair(project,
wxArrayString())).first;
2423 const wxString& filename =
event.GetEditor()->GetFilename();
2425 it->second.Add(filename);
2428 TRACE(_T(
"CodeCompletion::OnEditorSave: Starting m_TimerReparsing."));
2443 funcdata->
parsed =
false;
2452 TRACE(_T(
"CodeCompletion::OnEditorActivated(): Enter"));
2458 TRACE(_T(
"CodeCompletion::OnEditorActivated(): Starting m_TimerEditorActivated."));
2461 if (m_TimerToolbar.IsRunning())
2462 m_TimerToolbar.Stop();
2466 TRACE(_T(
"CodeCompletion::OnEditorActivated(): Leave"));
2483 TRACE(_T(
"CodeCompletion::OnEditorClosed(): Closed editor's file is %s"), activeFile.
wx_str());
2487 m_LastEditor =
nullptr;
2488 if (m_TimerEditorActivated.IsRunning())
2489 m_TimerEditorActivated.Stop();
2494 m_NativeParser.OnEditorClosed(event.
GetEditor());
2503 EnableToolbarTools(
false);
2509 m_Function->Clear();
2517 m_AllFunctionsScopes[
filename].m_NameSpaces.clear();
2518 m_AllFunctionsScopes[
filename].parsed =
false;
2519 if (m_NativeParser.GetParser().ClassBrowserOptions().displayFilter ==
bdfFile)
2520 m_NativeParser.UpdateClassBrowser();
2547 if (m_CCEnableHeaders)
2551 m_SystemHeadersThreads.push_back(thread);
2555 if (m_NativeParser.GetProjectByEditor(editor) == project)
2556 EnableToolbarTools(
false);
2568 if ( m_CCEnableHeaders
2569 && !m_SystemHeadersThreads.empty()
2570 && !m_SystemHeadersThreads.front()->IsRunning()
2571 && m_NativeParser.Done() )
2573 m_SystemHeadersThreads.front()->Run();
2581 m_ToolbarNeedReparse =
true;
2582 TRACE(_T(
"CodeCompletion::OnParserEnd: Starting m_TimerToolbar."));
2586 if (m_NeedsBatchColour)
2592 UpdateEditorSyntax(editor);
2594 m_NeedsBatchColour =
false;
2607 if (m_SystemHeadersThreads.empty())
2614 if (thread == m_SystemHeadersThreads.front())
2616 if (!event.GetString().IsEmpty())
2624 m_SystemHeadersThreads.pop_front();
2628 if ( m_CCEnableHeaders
2629 && !m_SystemHeadersThreads.empty()
2630 && !m_SystemHeadersThreads.front()->IsRunning()
2631 && m_NativeParser.Done() )
2633 m_SystemHeadersThreads.front()->
Run();
2639 if (!IsAttached() || !m_InitDone)
2651 if (!m_NativeParser.GetParser().Done())
2653 wxString msg =
_(
"The Parser is still parsing files.");
2654 msg += m_NativeParser.GetParser().NotDoneReason();
2669 if (dlg.ShowModal() ==
wxID_OK)
2677 for (
unsigned int i = 0; i < result.
GetCount(); ++i)
2699 if (!IsAttached() || !m_InitDone)
2712 TokenTree* tree = m_NativeParser.GetParser().GetTokenTree();
2718 for (
size_t i = 0; i < paths.
GetCount(); ++i)
2720 CCLogger::Get()->
DebugLog(_T(
"CodeCompletion::DoAllMethodsImpl(): Trying to find matches for: ") + paths[i]);
2723 for (TokenFileSet::const_iterator it = result_file.begin(); it != result_file.end(); ++it)
2738 typedef std::map<int, std::pair<int, wxString> > ImplMap;
2740 for (TokenFileSet::const_iterator itf = result.begin(); itf != result.end(); ++itf)
2743 if (!tokens)
continue;
2746 for (TokenIdxSet::const_iterator its = tokens->begin(); its != tokens->end(); ++its)
2748 const Token* token = tree->
at(*its);
2758 for (ImplMap::const_iterator it = im.begin(); it != im.end(); ++it)
2760 arrint.Add(it->second.first);
2761 arr.
Add(it->second.second);
2786 for (
size_t i = 0; i < indices.GetCount(); ++i)
2788 const Token* token = tree->
at(arrint[indices[i]]);
2801 if (addDoxgenComment)
2802 str << _T(
"/** @brief ") << token->
m_Name << _T(
"\n *\n * @todo: document this function\n */\n");
2807 if ( (type.
Last() == _T(
'&') || type.
Last() == _T(
'*'))
2808 && type[type.
Len() - 2] == _T(
' '))
2810 type[type.
Len() - 2] = type.
Last();
2813 str << type << _T(
" ");
2819 str << parent->
m_Name << _T(
"::");
2823 str << _T(
" const");
2825 str << _T(
" noexcept");
2826 str << _T(
"\n{\n\t\n}\n");
2836 if (!indices.IsEmpty())
2865 for (
unsigned int idxSc = 0; idxSc < m_ScopeMarks.size(); ++idxSc)
2868 unsigned int start = m_ScopeMarks[idxSc];
2869 unsigned int end = (idxSc + 1 < m_ScopeMarks.size()) ? m_ScopeMarks[idxSc + 1] : m_FunctionsScope.size();
2872 for (
int idxFn = 0; start + idxFn < end; ++idxFn)
2878 functionItem = idxFn;
2893 if (!m_FunctionsScope.size())
2898 unsigned int best_func = 0;
2899 bool found_best_func =
false;
2900 for (
unsigned int idx_func=0; idx_func<m_FunctionsScope.size(); ++idx_func)
2902 int best_func_line = m_FunctionsScope[best_func].StartLine;
2903 int func_start_line = m_FunctionsScope[idx_func].StartLine;
2906 if (best_func_line > current_line)
2908 if ( (func_start_line > current_line )
2909 && (func_start_line < best_func_line) )
2910 { best_func = idx_func; found_best_func =
true; }
2912 else if (func_start_line > current_line)
2913 { best_func = idx_func; found_best_func =
true; }
2917 if (best_func_line < current_line)
2919 if ( (func_start_line < current_line )
2920 && (func_start_line > best_func_line) )
2921 { best_func = idx_func; found_best_func =
true; }
2923 else if (func_start_line < current_line)
2924 { best_func = idx_func; found_best_func =
true; }
2928 if (found_best_func)
2929 { line = m_FunctionsScope[best_func].StartLine; }
2930 else if ( next && m_FunctionsScope[best_func].StartLine>current_line)
2931 { line = m_FunctionsScope[best_func].StartLine; }
2932 else if (!next && m_FunctionsScope[best_func].StartLine<current_line)
2933 { line = m_FunctionsScope[best_func].StartLine; }
2947 for (
unsigned int idxNs = 0; idxNs < m_NameSpaces.size(); ++idxNs)
2949 const NameSpace& ns = m_NameSpaces[idxNs];
2950 if (m_CurrentLine >= ns.
StartLine && m_CurrentLine <= ns.EndLine && ns.StartLine > startLine)
2954 pos =
static_cast<int>(idxNs);
2964 int sel = m_Scope->GetSelection();
2965 if (sel != -1 && sel < static_cast<int>(m_ScopeMarks.size()))
2966 UpdateFunctions(sel);
2971 int selSc = (m_Scope) ? m_Scope->GetSelection() : 0;
2972 if (selSc != -1 && selSc < static_cast<int>(m_ScopeMarks.size()))
2974 int idxFn = m_ScopeMarks[selSc] + m_Function->GetSelection();
2975 if (idxFn != -1 && idxFn < static_cast<int>(m_FunctionsScope.size()))
2980 m_FunctionsScope[idxFn].ShortName);
3052 TRACE(_T(
"ParseFunctionsAndFillToolbar() : m_ToolbarNeedReparse=%d, m_ToolbarNeedRefresh=%d, "),
3053 m_ToolbarNeedReparse?1:0, m_ToolbarNeedRefresh?1:0);
3062 m_Function->Clear();
3066 EnableToolbarTools(
false);
3075 bool fileParseFinished = m_NativeParser.GetParser().IsFileParsed(filename);
3083 if (m_ToolbarNeedReparse || !funcdata->
parsed)
3085 if (m_ToolbarNeedReparse)
3086 m_ToolbarNeedReparse =
false;
3093 m_NativeParser.GetParser().FindTokensInFile(filename, result,
3095 if (!result.empty())
3098 fileParseFinished =
false;
3100 TokenTree* tree = m_NativeParser.GetParser().GetTokenTree();
3104 for (TokenIdxSet::const_iterator it = result.begin(); it != result.end(); ++it)
3106 const Token* token = tree->at(*it);
3112 const size_t fileIdx = tree->InsertFileOrGetIndex(filename);
3122 result_str << _T(
" : ") << token->
m_BaseType;
3123 fs.
Name = result_str;
3141 m_NativeParser.GetParser().ParseBufferForNamespaces(ed->
GetControl()->
GetText(), nameSpaces);
3147 std::copy(nameSpaces.begin(), nameSpaces.end(), back_inserter(functionsScopes));
3151 FunctionsScopeVec::const_iterator it;
3153 functionsScopes.resize(it - functionsScopes.begin());
3155 TRACE(
F(_T(
"Found %lu namespace locations"), static_cast<unsigned long>(nameSpaces.size())));
3156 #if CC_CODECOMPLETION_DEBUG_OUTPUT == 1 3157 for (
unsigned int i = 0; i < nameSpaces.size(); ++i)
3159 nameSpaces[i].Name.wx_str(), nameSpaces[i].StartLine, nameSpaces[i].EndLine));
3162 if (!m_ToolbarNeedRefresh)
3163 m_ToolbarNeedRefresh =
true;
3170 m_ScopeMarks.clear();
3171 unsigned int fsSize = m_FunctionsScope.size();
3172 if (!m_FunctionsScope.empty())
3174 m_ScopeMarks.push_back(0);
3178 wxString lastScope = m_FunctionsScope[0].Scope;
3179 for (
unsigned int idx = 1; idx < fsSize; ++idx)
3181 const wxString& currentScope = m_FunctionsScope[idx].Scope;
3184 if (lastScope != currentScope)
3186 m_ScopeMarks.push_back(idx);
3187 lastScope = currentScope;
3193 TRACE(
F(_T(
"Parsed %lu functionscope items"), static_cast<unsigned long>(m_FunctionsScope.size())));
3194 #if CC_CODECOMPLETION_DEBUG_OUTPUT == 1 3195 for (
unsigned int i = 0; i < m_FunctionsScope.size(); ++i)
3197 m_FunctionsScope[i].Scope.wx_str(), m_FunctionsScope[i].Name.wx_str(),
3198 m_FunctionsScope[i].StartLine, m_FunctionsScope[i].EndLine));
3202 if (m_ToolbarNeedRefresh || m_LastFile != filename)
3205 if (m_ToolbarNeedRefresh)
3206 m_ToolbarNeedRefresh =
false;
3207 if (m_LastFile != filename)
3209 TRACE(_T(
"ParseFunctionsAndFillToolbar() : Update last file is %s"), filename.
wx_str());
3214 m_Function->
Clear();
3222 for (
unsigned int idxSc = 0; idxSc < m_ScopeMarks.size(); ++idxSc)
3224 int idxFn = m_ScopeMarks[idxSc];
3226 m_Scope->Append(fs.
Scope);
3233 m_Function->Freeze();
3235 for (
unsigned int idxFn = 0; idxFn < m_FunctionsScope.size(); ++idxFn)
3243 m_Function->Append(fs.
Scope);
3254 EnableToolbarTools(fileParseFinished);
3259 if (currentLine == -1)
3262 m_CurrentLine = currentLine;
3265 FunctionPosition(selSc, selFn);
3269 if (selSc != -1 && selSc != m_Scope->GetSelection())
3271 m_Scope->SetSelection(selSc);
3272 UpdateFunctions(selSc);
3274 else if (selSc == -1)
3275 m_Scope->SetSelection(-1);
3278 if (selFn != -1 && selFn != m_Function->GetSelection())
3279 m_Function->SetSelection(selFn);
3280 else if (selFn == -1)
3282 m_Function->SetSelection(-1);
3284 wxChoice* choice = (m_Scope) ? m_Scope : m_Function;
3286 int NsSel = NameSpacePosition();
3288 choice->SetStringSelection(m_NameSpaces[NsSel].Name);
3294 wxCommandEvent evt(wxEVT_COMMAND_CHOICE_SELECTED, XRCID(
"chcCodeCompletionScope"));
3302 m_Function->Freeze();
3303 m_Function->Clear();
3305 unsigned int idxEnd = (scopeItem + 1 < m_ScopeMarks.size()) ? m_ScopeMarks[scopeItem + 1] : m_FunctionsScope.size();
3306 for (
unsigned int idxFn = m_ScopeMarks[scopeItem]; idxFn < idxEnd; ++idxFn)
3308 const wxString &name = m_FunctionsScope[idxFn].Name;
3309 m_Function->
Append(name);
3318 m_Scope->Enable(enable);
3320 m_Function->Enable(enable);
3335 if (curProject && !m_NativeParser.GetParserByProject(curProject))
3336 m_NativeParser.CreateParser(curProject);
3341 m_NativeParser.OnEditorActivated(editor);
3346 if (!
Manager::Get()->GetConfigManager(
wxT(
"code_completion"))->ReadBool(
wxT(
"/semantic_keywords"),
false))
3357 m_NativeParser.GetParser().FindTokensInFile(ed->
GetFilename(), result, flags);
3358 TokenTree* tree = m_NativeParser.GetParser().GetTokenTree();
3360 std::set<wxString> varList;
3364 for (TokenIdxSet::const_iterator it = result.begin(); it != result.end(); ++it)
3371 varList.insert(token->
m_Name);
3381 if (!token || parsedTokens.find(token->
m_Index) != parsedTokens.
end())
3383 parsedTokens.insert(token->
m_Index);
3384 for (TokenIdxSet::const_iterator chIt = token->
m_Children.begin();
3387 const Token* chToken = tree->
at(*chIt);
3390 varList.insert(chToken->
m_Name);
3396 for (TokenIdxSet::const_iterator ancIt = token->
m_Ancestors.begin();
3399 const Token* ancToken = tree->
at(*ancIt);
3400 if (!ancToken || parsedTokens.find(ancToken->
m_Index) != parsedTokens.
end())
3402 for (TokenIdxSet::const_iterator chIt = ancToken->
m_Children.begin();
3405 const Token* chToken = tree->
at(*chIt);
3409 varList.insert(chToken->
m_Name);
3421 for (std::set<wxString>::const_iterator keyIt = varList.begin();
3422 keyIt != varList.end(); ++keyIt)
3424 keywords +=
wxT(
" ") + *keyIt;
3432 TRACE(_T(
"CodeCompletion::OnToolbarTimer(): Enter"));
3435 ParseFunctionsAndFillToolbar();
3438 TRACE(_T(
"CodeCompletion::OnToolbarTimer(): Starting m_TimerToolbar."));
3442 TRACE(_T(
"CodeCompletion::OnToolbarTimer(): Leave"));
3451 TRACE(_T(
"OnRealtimeParsingTimer"));
3456 if (curLen != m_CurrentLength)
3458 m_CurrentLength = curLen;
3459 TRACE(_T(
"CodeCompletion::OnRealtimeParsingTimer: Starting m_TimerRealtimeParsing."));
3464 cbProject* project = m_NativeParser.GetProjectByEditor(editor);
3467 if (m_NativeParser.ReparseFile(project, m_LastFile))
3474 m_TimerProjectSaved.SetClientData(
NULL);
3480 if (IsAttached() && m_InitDone && project)
3482 TRACE(_T(
"OnProjectSavedTimer"));
3483 if (project && m_NativeParser.GetParserByProject(project))
3485 ReparsingMap::iterator it = m_ReparsingMap.find(project);
3486 if (it != m_ReparsingMap.end())
3487 m_ReparsingMap.erase(it);
3488 if (m_NativeParser.DeleteParser(project))
3491 m_NativeParser.CreateParser(project);
3501 m_ReparsingMap.clear();
3506 TRACE(_T(
"OnReparsingTimer"));
3508 ReparsingMap::iterator it = m_ReparsingMap.begin();
3509 if (it != m_ReparsingMap.end() && m_NativeParser.Done())
3514 project = m_NativeParser.GetProjectByFilename(files[0]);
3516 if (project &&
Manager::Get()->GetProjectManager()->IsProjectStillOpen(project))
3523 size_t reparseCount = 0;
3526 if (m_NativeParser.ReparseFile(project, files.
Last()))
3529 TRACE(_T(
"OnReparsingTimer: Reparsing file : ") + files.
Last());
3530 if (files.
Last() == curFile)
3532 m_ToolbarNeedReparse =
true;
3533 TRACE(_T(
"CodeCompletion::OnReparsingTimer: Starting m_TimerToolbar."));
3546 m_ReparsingMap.erase(it);
3549 if (!m_ReparsingMap.empty())
3551 TRACE(_T(
"CodeCompletion::OnReparsingTimer: Starting m_TimerReparsing."));
3564 if (!editor || editor != m_LastEditor)
3566 TRACE(_T(
"CodeCompletion::OnEditorActivatedTimer(): Not a builtin editor."));
3568 EnableToolbarTools(
false);
3574 if ( !m_LastFile.IsEmpty() && m_LastFile == curFile )
3576 TRACE(_T(
"CodeCompletion::OnEditorActivatedTimer(): Same as the last activated file(%s)."), curFile.
wx_str());
3580 TRACE(_T(
"CodeCompletion::OnEditorActivatedTimer(): Need to notify NativeParser and Refresh toolbar."));
3582 m_NativeParser.OnEditorActivated(editor);
3583 TRACE(_T(
"CodeCompletion::OnEditorActivatedTimer: Starting m_TimerToolbar."));
3585 TRACE(_T(
"CodeCompletion::OnEditorActivatedTimer(): Current activated file is %s"), curFile.
wx_str());
3586 UpdateEditorSyntax();
const TokenIdxSet * GetTokensBelongToFile(size_t fileIdx) const
ProjectFile * GetFileByFilename(const wxString &filename, bool isRelative=true, bool isUnixFilename=false)
Access a file of the project.
virtual cbConfigurationPanel * GetConfigurationPanel(wxWindow *parent)
CC's config dialog.
wxString F(const wxChar *msg,...)
sprintf-like function
bool GetUseTabs() const
Retrieve whether tabs will be used in indentation.
destructor class member function
virtual const wxString & GetShortName() const
Returns the editor's short name.
int TokenExists(const wxString &name, int parent, short int kindMask)
query tokens by names
bool CallTipActive()
Is there an active call tip?
void OnEditorActivated(CodeBlocksEvent &event)
wxString GetLanguageName(HighlightLanguage lang)
EVTIMPORT const wxEventType cbEVT_PROJECT_FILE_ADDED
int EndLine
function body (implementation) end line
int m_ParentIndex
Parent Token index.
int WordEndPosition(int pos, bool onlyWordCharacters)
Get position of end of word.
Base class for code-completion plugins.
PluginManager * GetPluginManager() const
bool EqualFunctionScope(const CodeCompletion::FunctionScope &fs1, const CodeCompletion::FunctionScope &fs2)
constructor class member function
void OnFunction(wxCommandEvent &event)
Toolbar select event.
EVTIMPORT const wxEventType cbEVT_HIDE_DOCK_WINDOW
void OnReparsingTimer(wxTimerEvent &event)
delayed for re-parsing
wxString relativeFilename
The relative (to the project) filename of this file.
virtual void OnAttach()
Any descendent plugin should override this virtual method and perform any necessary initialization...
bool wxIsspace(const wxUniChar &c)
static bool LoadResource(const wxString &file)
virtual cbConfigurationPanel * GetProjectConfigurationPanel(wxWindow *parent, cbProject *project)
CC's config dialog which show in the project options panel.
wxString m_BaseType
this is what the parser believes is the actual return value: e.g.
ConfigManager * GetConfigManager(const wxString &name_space) const
CCProviderStatus
Level of functionality a CC plugin is able to provide.
int ReadInt(const wxString &name, int defaultVal=0)
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
wxString m_Name
Token's name, it can be searched in the TokenTree.
#define EDITOR_ACTIVATED_DELAY
std::vector< FunctionScope > FunctionsScopeVec
vector containing all the function information of a single source file
wxString substr(size_t nStart=0, size_t nLen=npos) const
std::set< size_t, std::less< size_t > > TokenFileSet
void GetAbsolutePath(const wxString &basePath, const wxArrayString &targets, wxArrayString &dirs)
search target file names (mostly relative names) under basePath, then return the absolute dirs the re...
#define PARSER_IMG_MACRO_DEF
void OnOpenIncludeFile(wxCommandEvent &event)
open the include file under the caret position
unsigned int m_ImplLine
function implementation line index
virtual void DoAutocomplete(const CCToken &token, cbEditor *ed)
Callback for inserting the selected autocomplete entry into the editor.
bool LessFunctionScope(const CodeCompletion::FunctionScope &fs1, const CodeCompletion::FunctionScope &fs2)
static bool IsAppShuttingDown()
wxArrayString & GetSystemIncludeDirs(cbProject *project, bool force)
get the whole search dirs except the ones locally belong to the c::b project, note this function is u...
int StartLine
function body (implementation) start line
container like tokens, those tokens can have children tokens
virtual FilesList & GetFilesList()
Provides an easy way to iterate all the files belonging in this target.
bool wxFileExists(const wxString &filename)
void GotoLine(int line, bool centerOnScreen=true) override
Move the caret at the specified line.
wxWindow * pWindow
The window to dock.
wxFileName file
The full filename of this file.
Structure representing an individual calltip with an optional highlighted range.
void EditorEventHook(cbEditor *editor, wxScintillaEvent &event)
handle all the editor event
void DoCodeComplete(int caretPos, cbEditor *ed, std::vector< CCToken > &tokens, bool preprocessorOnly=false)
fill the tokens with correct code complete words
void OnEditorActivatedTimer(wxTimerEvent &event)
delayed running of editor activated event, only the last activated editor should be considered ...
wxString GetFilename() const
get a full path of the file which contains the current Token
bool GotoTokenPosition(int line, const wxString &tokenName)
Move the caret at the specified line.
wxBitmap GetBitmap(int index) const
int GetLineIndentPosition(int line) const
Retrieve the position before the first non indentation character on a line.
HighlightLanguage GetLanguageForFilename(const wxString &filename)
bool ReadBool(const wxString &name, bool defaultVal=false)
int Index(const wxString &sz, bool bCase=true, bool bFromEnd=false) const
DLLIMPORT bool NormalizePath(wxFileName &f, const wxString &base)
void OnProjectSavedTimer(wxTimerEvent &event)
delayed running after saving project, while many projects' saving
EVTIMPORT const wxEventType cbEVT_PROJECT_ACTIVATE
int ReplaceTarget(const wxString &text)
Replace the target text with the argument text.
a container class to hold all the Tokens getting from parsing stage
TokenIdxSet m_Children
if it is a class kind token, then it contains all the member tokens
Event used to request from the main app to add a window to the docking system.
wxString GetLine(int line) const
Retrieve the contents of a line.
TokenIdxSet m_Ancestors
all the ancestors in the inheritance hierarchy
EVTIMPORT const wxEventType cbEVT_UPDATE_VIEW_LAYOUT
bool Matches(const wxString &text, int flags=0) const
DLLIMPORT int cbGetSingleChoiceIndex(const wxString &message, const wxString &caption, const wxArrayString &choices, wxWindow *parent=NULL, const wxSize &size=wxSize(300, 300), int initialSelection=0)
int NameSpacePosition() const
find the namespace whose scope covers the current line the m_CurrentLine is used
unsigned int m_Line
Line index where the token was met, which is 1 based.
FileType
Known file types.
cbProject * GetProject() const
size_t size()
total size of std::vector<Token*>
int m_Index
current Token index in the tree, it is index of the std::vector<Token*>, so use the index...
void UpdateFunctions(unsigned int scopeItem)
the scope item has changed or becomes invalid, so the associated function wxChoice should be updated...
wxString & GetKeywords(HighlightLanguage lang, int idx)
cbProjectManagerUI & GetUI()
Identify a function body's position, the underline data structure of the second wxChoice of CC's tool...
unsigned int m_ImplLineEnd
if token is impl, closing brace line
void OnCurrentProjectReparse(wxCommandEvent &event)
event handler when user select context menu->reparse file/projects
bool IsAbsolute(wxPathFormat format=wxPATH_NATIVE) const
DLLIMPORT FileType FileTypeOf(const wxString &filename)
#define wxICON_INFORMATION
EVTIMPORT const wxEventType cbEVT_PROJECT_SAVE
void CallTipShow(int pos, const wxString &definition)
Show a call tip containing a definition near position pos.
virtual wxTreeItemData * GetItemData(const wxTreeItemId &item) const
wxString GetNamespace() const
get a literal string presentation of the namespace.
ProjectFile * GetProjectFile() const
wxString Name
function's long name (including arguments and return type)
std::vector< wxString > wxStringVec
virtual ~CodeCompletion()
Destructor.
bool m_IsNoExcept
the member method is noexcept (yes/no)
void AddToken(const FunctionToken &token)
void RegisterImage(int type, const wxBitmap &bmp)
Register an image for use in autocompletion lists.
wxArrayString m_Aliases
used for namespace aliases
void NotifyMissingFile(const wxString &name)
EditorBase * GetEditor() const
bool m_IsTemp
local (automatic) variable
TokenScope m_Scope
public? private? protected?
int GetModificationType() const
void SetPath(const wxString &path, wxPathFormat format=wxPATH_NATIVE)
wxString DisplayName() const
a short simple string to show the token information, this usually generate for show the tip message w...
EVTIMPORT const wxEventType cbEVT_PROJECT_FILE_CHANGED
virtual std::vector< CCCallTip > GetCallTips(int pos, int style, cbEditor *ed, int &argsPos)
Supply content for the calltip at the specified location.
Represents a file in a Code::Blocks project.
int GetLexer() const
Retrieve the lexing language of the document.
void OnAppDoneStartup(CodeBlocksEvent &event)
SDK event when application has started up.
size_t find(const wxString &str, size_t nStart=0) const
A generic Code::Blocks event.
void OnRenameSymbols(wxCommandEvent &event)
CC's re-factoring function, rename a symbol.
EFileType FileType(const wxString &filename, bool force_refresh=false)
return a file type, which can be either header files or implementation files or other files ...
void DebugLog(const wxString &msg)
#define wxSCI_C_WXSMITH
WXSMITH begin # Keep in sync with wxscinilla.h -> wxSCI_C_WXSMITH Keep in sync with SciLexer...
int GetLineEndPosition(int line) const
Get the position after the last visible characters on a line.
Code completion plugin has those features: show tool-tip when the mouse hover over the variables/func...
int WordStartPosition(int pos, bool onlyWordCharacters)
Get position of start of word.
EditorManager * GetEditorManager() const
void OnProjectClosed(CodeBlocksEvent &event)
void RecalcInheritanceChain(Token *token)
convert the Token's ancestor string to it's IDs this contains recursive calls, for example in such co...
bool empty()
check to see whether the TokenTree is empty
wxUSE_UNICODE_dependent wxChar
xxxxx **begin result *wxChar GetNextNonWhitespaceChar(cbStyledTextCtrl *control, int position)
for OnGotoFunction(), search forward /* yyy
const wxArrayString & GetIncludeDirs() const
void OnEditorSave(CodeBlocksEvent &event)
SDK editor related events.
const wxArrayString & GetDirs() const
wxString paramsAndreturnType
ProjectManager * GetProjectManager() const
Functions returning pointers to the respective sub-manager instances.
bool EqualNameSpace(const NameSpace &ns1, const NameSpace &ns2)
wxString GetStrippedArgs() const
remove all default value of the function argument string, e.g.
PluginManager manages plugins.
std::vector< NameSpace > NameSpaceVec
bool MakeRelativeTo(const wxString &pathBase=wxEmptyString, wxPathFormat format=wxPATH_NATIVE)
virtual int GetImageCount() const
virtual const wxString & GetFilename() const
Get the editor's filename (if applicable).
void wxPostEvent(wxEvtHandler *dest, const wxEvent &event)
EVTIMPORT const wxEventType cbEVT_EDITOR_CLOSE
bool AppendDir(const wxString &dir)
Represents a Code::Blocks project.
wxString GetIncludeFile() const
int GetEOLMode() const
Retrieve the current end of line mode - one of wxSCI_EOL_CRLF, wxSCI_EOL_CR, or wxSCI_EOL_LF.
virtual CCProviderStatus GetProviderStatusFor(cbEditor *ed)
Does this plugin handle code completion for the editor ed?
int GetCurrentLine()
Manually declared methods.
EditorBase * GetActiveEditor()
size_t find_first_of(const char *sz, size_t nStart=0) const
a symbol found in the parsed files, it can be many kinds, such as a variable, a class and so on...
#define TRACE(format, args...)
wxString & RemoveLast(size_t n=1)
wxArrayInt GetSelectedIndices() const
cbStyledTextCtrl * GetControl() const
Returns a pointer to the underlying cbStyledTextCtrl object (which itself is the wxWindows implementa...
std::set< int, std::less< int > > TokenIdxSet
virtual std::vector< CCToken > GetTokenAt(int pos, cbEditor *ed, bool &allowCallTip)
Supply the definition of the token at the specified location.
display symbols of current file
ModuleType
The type of module offering a context menu.
void OnViewClassBrowser(wxCommandEvent &event)
event handler when user click Menu->View->Symbols browser
void DoCodeCompleteIncludes(cbEditor *ed, int &tknStart, int tknEnd, std::vector< CCToken > &tokens)
fill the tokens with correct include file names
int GetTabWidth() const
Retrieve the visible size of a tab.
size_t Replace(const wxString &strOld, const wxString &strNew, bool replaceAll=true)
int DoAllMethodsImpl()
ContextMenu->Insert-> All class methods.
wxChar GetLastNonWhitespaceChar(cbStyledTextCtrl *control, int position)
for OnGotoFunction(), search backward
ExitCode Wait(wxThreadWait flags=wxTHREAD_WAIT_BLOCK)
DLLIMPORT bool IsSuffixOfPath(wxFileName const &suffix, wxFileName const &path)
bool LessNameSpace(const NameSpace &ns1, const NameSpace &ns2)
cbEditor * GetBuiltinActiveEditor()
NameSpaceVec m_NameSpaces
EditorColourSet * GetColourSet() const
Get the colour set in use.
void RemoveAllEventSinksFor(void *owner)
bool IsCharacter(int style)
Is style classified as character for current language?
wxString ShortName
function's base name (without scope prefix)
wxString Scope
class or namespace
bool GetMatch(size_t *start, size_t *len, size_t index=0) const
virtual cbTreeCtrl * GetTree()=0
Retrieve a pointer to the project manager's tree (GUI).
Base class that all "editors" should inherit from.
LogManager * GetLogManager() const
DLLIMPORT bool IsWindowReallyShown(wxWindow *win)
Finds out if a window is really shown.
FunctionsScopeVec m_FunctionsScope
int GetCurrentPos() const
Returns the position of the caret.
virtual void OnRelease(bool appShutDown)
void OnGotoPrevFunction(wxCommandEvent &event)
navigate to the previous function body
void OnProjectSaved(CodeBlocksEvent &event)
wxString & Item(size_t nIndex)
cbProject * GetActiveProject()
Retrieve the active project.
Structure representing a generic token, passed between CC plugins and CCManager.
wxString Read(const wxString &key, const wxString &defaultVal=wxEmptyString)
bool IsString(int style)
Is style classified as string for current language?
static wxString AutocompGetName(const wxString &selected)
when user select one item in the suggestion list, the selected contains the full display name...
int GetLength() const
Returns the number of bytes in the document.
bool m_IsConst
the member method is const (yes/no)
void OnGotoDeclaration(wxCommandEvent &event)
handle both goto declaration and implementation event
wxString displayName
Verbose string representing the token.
virtual wxString OnDocumentationLink(wxHtmlLinkEvent &event, bool &dismissPopup)
Callback to handle a click on a link in the documentation popup.
#define CC_LOCKER_TRACK_TT_MTX_UNLOCK(M)
const wxStringCharType * wx_str() const
virtual bool IsBuiltinEditor() const
Is this a built-in editor?
void OnProjectFileChanged(CodeBlocksEvent &event)
void OnUnimplementedClassMethods(wxCommandEvent &event)
handle CC's context menu->insert "All class methods without implementation..."
void OnFindReferences(wxCommandEvent &event)
CC's re-factoring function, find all the reference place.
wxString GetCurLine(int *linePos=NULL)
Retrieve the text of the line containing the caret.
bool s_DebugSmartSense
if this option is enabled, there will be many log messages when doing semantic match ...
void OnUpdateUI(wxUpdateUIEvent &event)
event handler for updating UI e.g.
MacrosManager * GetMacrosManager() const
The goto function dialog allow user to type a function name, and filter out the functions.
cbEditor * Open(const wxString &filename, int pos=0, ProjectFile *data=nullptr)
const wxString & _(const wxString &string)
wxString & Trim(bool fromRight=true)
void OnProjectFileAdded(CodeBlocksEvent &event)
void ReplaceMacros(wxString &buffer, ProjectBuildTarget *target=nullptr, bool subrequest=false)
Base class for plugin configuration panels.
cbEditor * GetBuiltinEditor(EditorBase *eb)
wxString m_Args
If it is a function Token, then this value is function arguments, e.g.
void OnSelectedFileReparse(wxCommandEvent &event)
void GotoFunctionPrevNext(bool next=false)
navigate between function bodies
#define wxSCI_MOD_INSERTTEXT
Notifications Type of modification and the action which caused the modification.
Plugin registration object.
Functor class for use as a editor modification operations hook.
void OnWorkspaceChanged(CodeBlocksEvent &event)
SDK workspace related events.
void OnRealtimeParsingTimer(wxTimerEvent &event)
event fired from the edit event hook function to indicate parsing while editing
#define wxSCI_KEYWORDSET_MAX
Maximum value of keywordSet parameter of SetKeyWords.
unsigned int m_ImplFileIdx
function implementation file index
#define CC_LOCKER_TRACK_TT_MTX_LOCK(M)
wxArray< int > wxArrayInt
EVTIMPORT const wxEventType cbEVT_APP_STARTUP_DONE
int DoClassMethodDeclImpl()
ContextMenu->Insert-> declaration/implementation.
int PositionFromLine(int line) const
Retrieve the position at the start of a line.
static bool IsBusy()
For use with plugins.
bool TestIncludeLine(wxString const &line)
for CodeCompleteIncludes() a line has some pattern like below
void Colourise(int start, int end)
Colourise a segment of the document using the current lexing language.
Abstract base hook functor interface.
bool HasMoreTokens() const
#define REALTIME_PARSING_DELAY
void UpdateEditorSyntax(cbEditor *ed=NULL)
highlight member variables
void OnProjectActivated(CodeBlocksEvent &event)
SDK project related events.
void SetKeyWords(int keyWordSet, const wxString &keyWords)
Set up the key words used by the lexer.
EditorColourSet * GetColourSet()
wxString & Append(const char *psz)
EVTIMPORT const wxEventType cbEVT_EDITOR_ACTIVATED
int GetCharAt(int pos) const
Returns the character byte at the position.
DLLIMPORT void PlaceWindow(wxTopLevelWindow *w, cbPlaceDialogMode mode=pdlBest, bool enforce=false)
cbProject * GetProject() const
wxString GetPath(int flags=wxPATH_GET_VOLUME, wxPathFormat format=wxPATH_NATIVE) const
size_t GetFileMatches(const wxString &filename, std::set< size_t > &result, bool caseSensitive, bool is_prefix)
void OnEditorClosed(CodeBlocksEvent &event)
DLLIMPORT wxString GetEOLStr(int eolMode=-1)
Reads settings if eolMode is -1 Expected input (defined in sdk/wxscintilla/include/wx/wxscintilla.h) is: wxSCI_EOL_CRLF=0, wxSCI_EOL_CR=1, or wxSCI_EOL_LF=2.
bool IsRelative(wxPathFormat format=wxPATH_NATIVE) const
EVTIMPORT const wxEventType cbEVT_SHOW_DOCK_WINDOW
void Log(const wxString &msg, int i=app_log, Logger::level lv=Logger::info)
void GotoPos(int caret)
Set caret to a position and ensure it is visible.
wxString GetLineIndentString(int line=-1) const
Returns the specified line's (0-based) indentation (whitespace) string.
FileTreeDataKind GetKind() const
#define wxSCI_INVALID_POSITION
TokenKind m_TokenKind
See TokenKind class.
wxString & insert(size_t nPos, const wxString &str)
void DebugLog(const wxString &msg, Logger::level lv=Logger::info)
bool ProcessEvent(CodeBlocksEvent &event)
bool EndsWith(const wxString &suffix, wxString *rest=NULL) const
wxString GetCommonTopLevelPath() const
bool GetModified() const override
void OnProjectFileRemoved(CodeBlocksEvent &event)
EVTIMPORT const wxEventType cbEVT_WORKSPACE_CHANGED
void RegisterEventSink(wxEventType eventType, IEventFunctorBase< CodeBlocksEvent > *functor)
general function, not constructor nor destructor
DLLIMPORT HookFunctorBase * UnregisterHook(int id, bool deleteHook=true)
Unregister a previously registered project loading/saving hook.
int GetStyleAt(int pos) const
Returns the style byte at the position.
void Init(wxEvtHandler *parent, int logId, int debugLogId, int addTokenId=-1)
void OnCCDebugLogger(CodeBlocksThreadEvent &event)
CC's own debug logger, to handle log event sent from other worker threads or itself(the main GUI thre...
size_t Add(const wxString &str, size_t copies=1)
void OnGotoFunction(wxCommandEvent &event)
event handler when user click Menu->Search->Goto function
void FindFunctionAndUpdate(int currentLine)
the caret has changed, so the wxChoice need to be updated to indicates which scope and function in wh...
void SetTargetStart(int start)
Sets the position that starts the target which is used for updating the document without affecting th...
bool StartsWith(const wxString &prefix, wxString *rest=NULL) const
void AddListEntries(const wxArrayString &IncludeFile)
void OnGotoNextFunction(wxCommandEvent &event)
navigate to the next function body
int LineFromPosition(int pos) const
Retrieve the line containing a position.
void OnCCLogger(CodeBlocksThreadEvent &event)
CC's own logger, to handle log events sent from other worker threads or itself(the main GUI thread)...
void OnSelectedProjectReparse(wxCommandEvent &event)
#define wxSCI_MOD_DELETETEXT
EVTIMPORT const wxEventType cbEVT_PROJECT_CLOSE
wxString GetText() const
Retrieve all the text in the document.
int Find(wxUniChar ch, bool fromEnd=false) const
EVTIMPORT const wxEventType cbEVT_EDITOR_OPEN
wxUniChar GetChar(size_t n) const
void SetTargetEnd(int end)
Sets the position that ends the target which is used for updating the document without affecting the ...
void OnParserStart(wxCommandEvent &event)
batch parsing start event this event usually be fired when an Parser object try to start parsing task...
ProjectsArray * GetProjects()
Retrieve an array of all the opened projects.
void DoParseOpenedProjectAndActiveEditor()
if C::B starts up with some projects opened, this function will be called to parse the already opened...
void OnParserEnd(wxCommandEvent &event)
batch parsing end event this event usually be fired when the task pool becomes empty ...
the Parser object is newly created, and we are parsing the predefined macro buffer, the source files, and finally mark the project's tokens as local
virtual wxString GetDocumentation(const CCToken &token)
Supply html formatted documentation for the passed token.
static wxString g_GlobalScope(_T("<global>"))
Scopes choice name for global functions in CC's toolbar.
void OnScope(wxCommandEvent &event)
Toolbar select event.
EVTIMPORT const wxEventType cbEVT_PROJECT_FILE_REMOVED
void RereadOptions()
read CC's options, mostly happens the user change some setting and press APPLY
bool EditorHasNameUnderCursor(wxString &NameUnderCursor, bool &IsInclude)
return identifier like token string under the current cursor pointer
macro definition, such as: #define AAA(x,y) f(x,y), where AAA is a token of tkMacroDef ...
wxString GetImplFilename() const
get a full path of the file which contains the function implementation.
virtual std::vector< CCToken > GetAutocompList(bool isAuto, cbEditor *ed, int &tknStart, int &tknEnd)
Supply content for the autocompletion list.
void RemoveAt(size_t nIndex, size_t count=1)
wxString SubString(size_t from, size_t to) const
HighlightLanguage GetLanguage() const
void MatchCodeStyle(wxString &str, int eolStyle=wxSCI_EOL_LF, const wxString &indent=wxEmptyString, bool useTabs=false, int tabSize=4)
modify the string content to follow the current editor's code style The code style includes the EOL...
void OnEditorOpen(CodeBlocksEvent &event)
int Printf(const wxString &pszFormat,...)
const FunctionToken * GetToken(int index) const
EVTIMPORT const wxEventType cbEVT_EDITOR_SAVE
wxString m_FullType
this is the full return value (if any): e.g.
#define CodeBlocksThreadEventHandler(func)
virtual void SetSelection(int n)
wxString GetFullPath(wxPathFormat format=wxPATH_NATIVE) const
void OnClassMethod(wxCommandEvent &event)
handle CC's context menu->insert "Class method declaration/implementation..."
void FunctionPosition(int &scopeItem, int &functionItem) const
helper method in finding the function position in the vector for the function containing the current ...
void ClearRegisteredImages()
Clear all the registered images.
void DoCodeCompletePreprocessor(int tknStart, int tknEnd, cbEditor *ed, std::vector< CCToken > &tokens)
fill the tokens with correct preprocessor directives, such as #i will prompt "if", "include"
bool wxGetKeyState(wxKeyCode key)
static wxString Format(const wxString &format,...)
wxString Mid(size_t first, size_t nCount=wxString::npos) const
int id
CCManager will pass this back unmodified. Use it as an internal identifier for the token...
DLLIMPORT int cbMessageBox(const wxString &message, const wxString &caption=wxEmptyString, int style=wxOK, wxWindow *parent=NULL, int x=-1, int y=-1)
wxMessageBox wrapper.
HighlightLanguage GetHighlightLanguage(int lexer)
bool IsPreprocessor(int style)
Is style classified as preprocessor for current language?
virtual wxTreeItemId GetTreeSelection()=0
Get the selection of the project manager's tree (GUI).
int CompareStringLen(const wxString &first, const wxString &second)
Sorting in GetLocalIncludeDirs()
wxArrayString buildTargets
An array of strings, containing the names of all the build targets this file belongs to...
size_t GetDirCount() const
std::set< wxString > StringSet
Event used to request from the main app to manage the view layouts.
used to record the position of a token when user click find declaration or implementation ...
DLLIMPORT int RegisterHook(HookFunctorBase *functor)
Register a project loading/saving hook.