Code::Blocks
SVN r11506
|
Code completion plugin has those features: show tool-tip when the mouse hover over the variables/functions. More...
#include <codecompletion.h>
Classes | |
struct | FunctionScope |
Identify a function body's position, the underline data structure of the second wxChoice of CC's toolbar. More... | |
struct | FunctionsScopePerFile |
Public Types | |
typedef std::vector< FunctionScope > | FunctionsScopeVec |
vector containing all the function information of a single source file More... | |
typedef std::vector< int > | ScopeMarksVec |
helper class to support FunctionsScopeVec More... | |
typedef std::map< wxString, FunctionsScopePerFile > | FunctionsScopeMap |
filename -> FunctionsScopePerFile map, contains all the opened files scope info More... | |
Public Types inherited from cbCodeCompletionPlugin | |
enum | CCProviderStatus { ccpsInactive, ccpsActive, ccpsUniversal } |
Level of functionality a CC plugin is able to provide. More... | |
Public Member Functions | |
CodeCompletion () | |
Constructor. More... | |
virtual | ~CodeCompletion () |
Destructor. More... | |
virtual void | OnAttach () |
Any descendent plugin should override this virtual method and perform any necessary initialization. More... | |
virtual void | OnRelease (bool appShutDown) |
virtual int | GetConfigurationGroup () const |
Return the configuration group for this plugin. More... | |
virtual cbConfigurationPanel * | GetConfigurationPanel (wxWindow *parent) |
CC's config dialog. More... | |
virtual cbConfigurationPanel * | GetProjectConfigurationPanel (wxWindow *parent, cbProject *project) |
CC's config dialog which show in the project options panel. More... | |
virtual void | BuildMenu (wxMenuBar *menuBar) |
build menus in the main frame More... | |
virtual void | BuildModuleMenu (const ModuleType type, wxMenu *menu, const FileTreeData *data=0) |
build context popup menu More... | |
virtual bool | BuildToolBar (wxToolBar *toolBar) |
build CC Toolbar More... | |
virtual int | GetToolBarPriority () |
toolbar priority value More... | |
virtual CCProviderStatus | GetProviderStatusFor (cbEditor *ed) |
Does this plugin handle code completion for the editor ed ? More... | |
virtual std::vector< CCToken > | GetAutocompList (bool isAuto, cbEditor *ed, int &tknStart, int &tknEnd) |
Supply content for the autocompletion list. More... | |
virtual std::vector< CCCallTip > | GetCallTips (int pos, int style, cbEditor *ed, int &argsPos) |
Supply content for the calltip at the specified location. More... | |
virtual wxString | GetDocumentation (const CCToken &token) |
Supply html formatted documentation for the passed token. More... | |
virtual std::vector< CCToken > | GetTokenAt (int pos, cbEditor *ed, bool &allowCallTip) |
Supply the definition of the token at the specified location. More... | |
virtual wxString | OnDocumentationLink (wxHtmlLinkEvent &event, bool &dismissPopup) |
Callback to handle a click on a link in the documentation popup. More... | |
virtual void | DoAutocomplete (const CCToken &token, cbEditor *ed) |
Callback for inserting the selected autocomplete entry into the editor. More... | |
wxArrayString | GetLocalIncludeDirs (cbProject *project, const wxArrayString &buildTargets) |
Get the include paths setting (usually set by user for each C::B project). More... | |
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 used for auto suggestion for #include directives. More... | |
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 result is "added" to parameter dirs (not replacement of any existing dirs) It just did the calculation below: "c:/ccc/ddd.cpp"(basePath) + "aaa/bbb.h"(target) => "c:/ccc/aaa/bbb.h"(dirs) More... | |
void | EditorEventHook (cbEditor *editor, wxScintillaEvent &event) |
handle all the editor event More... | |
void | RereadOptions () |
read CC's options, mostly happens the user change some setting and press APPLY More... | |
Public Member Functions inherited from cbCodeCompletionPlugin | |
cbCodeCompletionPlugin () | |
virtual void | DoAutocomplete (const wxString &token, cbEditor *ed) |
Callback for inserting the selected autocomplete entry into the editor. More... | |
Public Member Functions inherited from cbPlugin | |
cbPlugin () | |
In default cbPlugin's constructor the associated PluginInfo structure is filled with default values. More... | |
~cbPlugin () override | |
cbPlugin destructor. More... | |
virtual PluginType | GetType () const |
The plugin must return its type on request. More... | |
virtual int | GetConfigurationPriority () const |
Return the plugin's configuration priority. More... | |
virtual cbConfigurationPanel * | GetConfigurationPanel (cb_optional wxWindow *parent) |
Return plugin's configuration panel. More... | |
virtual cbConfigurationPanel * | GetProjectConfigurationPanel (cb_optional wxWindow *parent, cb_optional cbProject *project) |
Return plugin's configuration panel for projects. More... | |
virtual void | BuildMenu (cb_optional wxMenuBar *menuBar) |
This method is called by Code::Blocks and is used by the plugin to add any menu items it needs on Code::Blocks's menu bar. More... | |
virtual void | BuildModuleMenu (cb_optional const ModuleType type, cb_optional wxMenu *menu, cb_optional const FileTreeData *data=nullptr) |
This method is called by Code::Blocks core modules (EditorManager, ProjectManager etc) and is used by the plugin to add any menu items it needs in the module's popup menu. More... | |
virtual bool | BuildToolBar (cb_optional wxToolBar *toolBar) |
This method is called by Code::Blocks and is used by the plugin to add any toolbar items it needs on Code::Blocks's toolbar. More... | |
virtual void | CreateStatusField (cbStatusBar *statusBar) |
This method is called by Code::Blocks and is used by the plugin to add a field on Code::Blocks's statusbar. More... | |
bool | IsAttached () const |
See whether this plugin is attached or not. More... | |
virtual bool | CanDetach () const |
See whether this plugin can be detached (unloaded) or not. More... | |
Private Types | |
typedef std::map< cbProject *, wxArrayString > | ReparsingMap |
map to record all re-parsing files More... | |
Private Member Functions | |
void | UpdateToolBar () |
update CC's ToolBar, the user may disable the first wxChoice, so we need to recreate the wxChoice and measure the best fit size More... | |
void | OnUpdateUI (wxUpdateUIEvent &event) |
event handler for updating UI e.g. More... | |
void | OnViewClassBrowser (wxCommandEvent &event) |
event handler when user click Menu->View->Symbols browser More... | |
void | OnGotoFunction (wxCommandEvent &event) |
event handler when user click Menu->Search->Goto function More... | |
void | OnGotoPrevFunction (wxCommandEvent &event) |
navigate to the previous function body More... | |
void | OnGotoNextFunction (wxCommandEvent &event) |
navigate to the next function body More... | |
void | OnClassMethod (wxCommandEvent &event) |
handle CC's context menu->insert "Class method declaration/implementation..." More... | |
void | OnUnimplementedClassMethods (wxCommandEvent &event) |
handle CC's context menu->insert "All class methods without implementation..." More... | |
void | OnGotoDeclaration (wxCommandEvent &event) |
handle both goto declaration and implementation event More... | |
void | OnFindReferences (wxCommandEvent &event) |
CC's re-factoring function, find all the reference place. More... | |
void | OnRenameSymbols (wxCommandEvent &event) |
CC's re-factoring function, rename a symbol. More... | |
void | OnOpenIncludeFile (wxCommandEvent &event) |
open the include file under the caret position More... | |
void | OnCurrentProjectReparse (wxCommandEvent &event) |
event handler when user select context menu->reparse file/projects More... | |
void | OnSelectedProjectReparse (wxCommandEvent &event) |
void | OnSelectedFileReparse (wxCommandEvent &event) |
void | OnAppDoneStartup (CodeBlocksEvent &event) |
SDK event when application has started up. More... | |
void | OnWorkspaceChanged (CodeBlocksEvent &event) |
SDK workspace related events. More... | |
void | OnProjectActivated (CodeBlocksEvent &event) |
SDK project related events. More... | |
void | OnProjectClosed (CodeBlocksEvent &event) |
void | OnProjectSaved (CodeBlocksEvent &event) |
void | OnProjectFileAdded (CodeBlocksEvent &event) |
void | OnProjectFileRemoved (CodeBlocksEvent &event) |
void | OnProjectFileChanged (CodeBlocksEvent &event) |
void | OnEditorSave (CodeBlocksEvent &event) |
SDK editor related events. More... | |
void | OnEditorOpen (CodeBlocksEvent &event) |
void | OnEditorActivated (CodeBlocksEvent &event) |
void | OnEditorClosed (CodeBlocksEvent &event) |
void | OnCCLogger (CodeBlocksThreadEvent &event) |
CC's own logger, to handle log events sent from other worker threads or itself(the main GUI thread), the log messages will be printed in the "Code::Blocks" log panel. More... | |
void | OnCCDebugLogger (CodeBlocksThreadEvent &event) |
CC's own debug logger, to handle log event sent from other worker threads or itself(the main GUI thread), the log messages will be printed in the "Code::Blocks Debug" log panel. More... | |
void | OnParserStart (wxCommandEvent &event) |
batch parsing start event this event usually be fired when an Parser object try to start parsing tasks in the thread pool More... | |
void | OnParserEnd (wxCommandEvent &event) |
batch parsing end event this event usually be fired when the task pool becomes empty More... | |
void | OnSystemHeadersThreadMessage (CodeBlocksThreadEvent &event) |
receive event from SystemHeadersThread More... | |
void | OnSystemHeadersThreadFinish (CodeBlocksThreadEvent &event) |
void | DoCodeComplete (int caretPos, cbEditor *ed, std::vector< CCToken > &tokens, bool preprocessorOnly=false) |
fill the tokens with correct code complete words More... | |
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" More... | |
void | DoCodeCompleteIncludes (cbEditor *ed, int &tknStart, int tknEnd, std::vector< CCToken > &tokens) |
fill the tokens with correct include file names More... | |
int | DoClassMethodDeclImpl () |
ContextMenu->Insert-> declaration/implementation. More... | |
int | DoAllMethodsImpl () |
ContextMenu->Insert-> All class methods. More... | |
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, TAB and indent More... | |
void | FunctionPosition (int &scopeItem, int &functionItem) const |
helper method in finding the function position in the vector for the function containing the current line More... | |
void | GotoFunctionPrevNext (bool next=false) |
navigate between function bodies More... | |
int | NameSpacePosition () const |
find the namespace whose scope covers the current line the m_CurrentLine is used More... | |
void | OnScope (wxCommandEvent &event) |
Toolbar select event. More... | |
void | OnFunction (wxCommandEvent &event) |
Toolbar select event. More... | |
void | ParseFunctionsAndFillToolbar () |
normally the editor has changed, then CC need to parse the document again, and (re)construct the internal database, and refresh the toolbar(wxChoice's content) More... | |
void | FindFunctionAndUpdate (int currentLine) |
the caret has changed, so the wxChoice need to be updated to indicates which scope and function in which the caret locates. More... | |
void | UpdateFunctions (unsigned int scopeItem) |
the scope item has changed or becomes invalid, so the associated function wxChoice should be updated. More... | |
void | EnableToolbarTools (bool enable=true) |
enable the two wxChoices More... | |
void | DoParseOpenedProjectAndActiveEditor () |
if C::B starts up with some projects opened, this function will be called to parse the already opened projects More... | |
void | UpdateEditorSyntax (cbEditor *ed=NULL) |
highlight member variables More... | |
void | OnToolbarTimer (wxTimerEvent &event) |
delayed for toolbar update More... | |
void | OnRealtimeParsingTimer (wxTimerEvent &event) |
event fired from the edit event hook function to indicate parsing while editing More... | |
void | OnProjectSavedTimer (wxTimerEvent &event) |
delayed running after saving project, while many projects' saving More... | |
void | OnReparsingTimer (wxTimerEvent &event) |
delayed for re-parsing More... | |
void | OnEditorActivatedTimer (wxTimerEvent &event) |
delayed running of editor activated event, only the last activated editor should be considered More... | |
Private Attributes | |
bool | m_InitDone |
Indicates CC's initialization is done. More... | |
wxMenu * | m_EditMenu |
menu pointers to the frame's main menu More... | |
wxMenu * | m_SearchMenu |
wxMenu * | m_ViewMenu |
wxMenu * | m_ProjectMenu |
NativeParser | m_NativeParser |
this member will actually manage all the Parser instances More... | |
CodeRefactoring | m_CodeRefactoring |
code re-factoring tool More... | |
int | m_EditorHookId |
wxTimer | m_TimerRealtimeParsing |
timer triggered by editor hook function to delay the real-time parse More... | |
wxTimer | m_TimerToolbar |
timer for toolbar we only show an updated item in CC's toolbar's item list when caret position is stable for a period of time. More... | |
wxTimer | m_TimerProjectSaved |
delay after project saved event More... | |
wxTimer | m_TimerReparsing |
delay after receive a project save/modified event More... | |
wxTimer | m_TimerEditorActivated |
delay after receive editor activated event the reason we need a timer is that we want to get a stable editor activate information thus we will only handle the last editor activated editor The timer will be restart when an editor activated event happens. More... | |
cbEditor * | m_LastEditor |
the last valid editor it is saved in editor activated event handler, and will be verified in editor activated timer event handler More... | |
wxToolBar * | m_ToolBar |
the CC's toolbar More... | |
wxChoice * | m_Function |
function choice control of CC's toolbar, it is the second choice More... | |
wxChoice * | m_Scope |
namespace/scope choice control, it is the first choice control More... | |
FunctionsScopeVec | m_FunctionsScope |
current active file's function body info More... | |
NameSpaceVec | m_NameSpaces |
current active file's namespace/scope info More... | |
ScopeMarksVec | m_ScopeMarks |
current active file's line info, helper member to access function scopes More... | |
FunctionsScopeMap | m_AllFunctionsScopes |
this is a "filename->info" map containing all the opening files choice info More... | |
bool | m_ToolbarNeedRefresh |
indicate whether the CC's toolbar need a refresh, this means the toolbar list will be reconstructed More... | |
bool | m_ToolbarNeedReparse |
force to re-collect the CC toolbar's item information this means we will parse the buffer to collect the scope information and then rebuild the toolbar items More... | |
int | m_CurrentLine |
current caret line, this is actually the saved caret line More... | |
wxString | m_LastFile |
the file updating the toolbar info More... | |
bool | m_LexerKeywordsToInclude [9] |
indicate whether the predefined keywords set should be added in the suggestion list More... | |
bool | m_NeedReparse |
indicate the editor has modified by the user and a real-time parse should be start More... | |
int | m_CurrentLength |
remember the number of bytes in the current editor/document this is actually the saved editor or file's size More... | |
bool | m_NeedsBatchColour |
batch run UpdateEditorSyntax() after first parsing More... | |
size_t | m_CCMaxMatches |
maximum allowed code-completion list entries More... | |
bool | m_CCAutoAddParentheses |
whether add parentheses after user selects a function name in the code-completion suggestion list More... | |
bool | m_CCDetectImplementation |
add function arguments' types and names when autocompleted outside function. More... | |
wxString | m_CCFillupChars |
user defined characters that work like Tab (empty by Default). More... | |
bool | m_CCEnableHeaders |
give code completion list for header files, it happens after the #include directive More... | |
bool | m_CCEnablePlatformCheck |
do not allow code completion to add include files of projects/targets to the parser that are not supported by the current platform More... | |
SystemHeadersMap | m_SystemHeadersMap |
std::list< SystemHeadersThread * > | m_SystemHeadersThreads |
thread to collect header file names, these header file names can be prompt for auto suggestion after #include < or #include " directives. More... | |
wxCriticalSection | m_SystemHeadersThreadCS |
critical section to protect accessing m_SystemHeadersMap More... | |
ReparsingMap | m_ReparsingMap |
all the files need to be parsed and their associated projects More... | |
DocumentationHelper | m_DocHelper |
Provider of documentation for the popup window. More... | |
Friends | |
wxString | DocumentationHelper::OnDocumentationLink (wxHtmlLinkEvent &, bool &) |
Additional Inherited Members | |
Protected Member Functions inherited from cbCodeCompletionPlugin | |
bool | IsProviderFor (cbEditor *ed) |
Has this plugin been selected to provide content for the editor. More... | |
Protected Member Functions inherited from cbPlugin | |
virtual void | OnRelease (cb_optional bool appShutDown) |
Any descendent plugin should override this virtual method and perform any necessary de-initialization. More... | |
virtual void | NotImplemented (const wxString &log) const |
This method logs a "Not implemented" message and is provided for convenience only. More... | |
Protected Attributes inherited from cbPlugin | |
PluginType | m_Type |
Holds the plugin's type. More... | |
bool | m_IsAttached |
Holds the "attached" state. More... | |
Code completion plugin has those features: show tool-tip when the mouse hover over the variables/functions.
show call-tip when you hit the ( after the function name automatically auto-completion lists prompted while entering code. navigate the source files, jump between declarations and implementations. find symbol usage, or even rename a symbol(code re-factoring).
We later use "CC" as an abbreviation of Code Completion plugin. See the general architecture of code completion plugin on wiki page http://wiki.codeblocks.org/index.php?title=Code_Completion_Design
Definition at line 44 of file codecompletion.h.
struct CodeCompletion::FunctionsScopePerFile |
Definition at line 72 of file codecompletion.h.
Class Members | ||
---|---|---|
FunctionsScopeVec | m_FunctionsScope | |
NameSpaceVec | m_NameSpaces | |
bool | parsed |
typedef std::map<wxString, FunctionsScopePerFile> CodeCompletion::FunctionsScopeMap |
filename -> FunctionsScopePerFile map, contains all the opened files scope info
Definition at line 79 of file codecompletion.h.
typedef std::vector<FunctionScope> CodeCompletion::FunctionsScopeVec |
vector containing all the function information of a single source file
Definition at line 66 of file codecompletion.h.
|
private |
map to record all re-parsing files
Here is an example how the ReparsingMap is used. Suppose you have two cbp opened: a.cbp, which contains a1.cpp, a2.cpp and a3.cpp b.cbp, which contains b1,cpp, b2,cpp and b3.cpp now, if a1,cpp and b2.cpp b3.cpp are modified, and the user press the Save all button Then CC receives event about project saved, then we store such information. ReparsingMap contains such two elements (a.cbp, (a1,cpp)) (b.cbp, (b2.cpp, b3.cpp)) there two elements will be passed to m_NativeParser, and m_NativeParser will distribute to each Parser objects
Definition at line 500 of file codecompletion.h.
typedef std::vector<int> CodeCompletion::ScopeMarksVec |
helper class to support FunctionsScopeVec
Definition at line 69 of file codecompletion.h.
CodeCompletion::CodeCompletion | ( | ) |
Constructor.
Definition at line 468 of file codecompletion.cpp.
References _T, CodeBlocksThreadEventHandler, g_idCCDebugLogger, g_idCCLogger, CCLogger::Get(), ParserCommon::idParserEnd, ParserCommon::idParserStart, idSystemHeadersThreadFinish, idSystemHeadersThreadMessage, CCLogger::Init(), Manager::LoadResource(), NotifyMissingFile(), OnCCDebugLogger(), OnCCLogger(), OnEditorActivatedTimer(), OnParserEnd(), OnParserStart(), OnProjectSavedTimer(), OnRealtimeParsingTimer(), OnReparsingTimer(), OnSystemHeadersThreadFinish(), OnSystemHeadersThreadMessage(), OnToolbarTimer(), and wxEVT_TIMER.
|
virtual |
Destructor.
Definition at line 523 of file codecompletion.cpp.
References CodeBlocksThreadEventHandler, g_idCCDebugLogger, g_idCCLogger, ParserCommon::idParserEnd, ParserCommon::idParserStart, idSystemHeadersThreadFinish, idSystemHeadersThreadMessage, wxThread::IsAlive(), wxThread::IsRunning(), OnCCDebugLogger(), OnCCLogger(), OnEditorActivatedTimer(), OnParserEnd(), OnParserStart(), OnProjectSavedTimer(), OnRealtimeParsingTimer(), OnReparsingTimer(), OnSystemHeadersThreadFinish(), OnSystemHeadersThreadMessage(), OnToolbarTimer(), wxThread::Wait(), and wxEVT_TIMER.
|
virtual |
build menus in the main frame
Definition at line 657 of file codecompletion.cpp.
References _(), _T, wxMenu::Append(), wxMenu::AppendSeparator(), CCLogger::DebugLog(), wxMenuBar::FindMenu(), CCLogger::Get(), wxMenuBar::GetMenu(), wxMenu::GetMenuItems(), and wxNOT_FOUND.
Referenced by GetConfigurationGroup().
|
virtual |
build context popup menu
Definition at line 745 of file codecompletion.cpp.
References _(), _T, wxMenu::Append(), CCLogger::DebugLog(), CodeCompletionHelper::EditorHasNameUnderCursor(), wxMenu::FindChildItem(), wxMenu::FindItem(), FileTreeData::ftdkFile, FileTreeData::ftdkProject, CCLogger::Get(), Manager::Get(), PluginManager::GetFindMenuItemFirst(), FileTreeData::GetKind(), wxMenu::GetMenuItemCount(), Manager::GetPluginManager(), wxMenu::Insert(), mtEditorManager, mtProjectManager, wxString::Printf(), PluginManager::RegisterFindMenuItems(), wxString::wx_str(), wxEmptyString, wxID_SEPARATOR, and wxNOT_FOUND.
Referenced by GetConfigurationGroup().
|
virtual |
build CC Toolbar
Definition at line 838 of file codecompletion.cpp.
References _T, Manager::AddonToolBar(), and Manager::Get().
Referenced by GetConfigurationGroup().
|
private |
ContextMenu->Insert-> All class methods.
Definition at line 2697 of file codecompletion.cpp.
References _(), wxArrayString::Add(), TokenTree::at(), cbMessageBox(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, CCLogger::DebugLog(), Token::DisplayName(), FileTypeOf(), ftHeader, ftSource, ftTemplateSource, CCLogger::Get(), Manager::Get(), EditorManager::GetBuiltinActiveEditor(), Manager::GetConfigManager(), cbEditor::GetControl(), wxArrayString::GetCount(), wxScintilla::GetCurrentPos(), Manager::GetEditorManager(), wxScintilla::GetEOLMode(), TokenTree::GetFileMatches(), EditorBase::GetFilename(), wxScintilla::GetLineEndPosition(), cbEditor::GetLineIndentString(), MultiSelectDlg::GetSelectedIndices(), EditorBase::GetShortName(), Token::GetStrippedArgs(), wxScintilla::GetTabWidth(), TokenTree::GetTokensBelongToFile(), wxScintilla::GetUseTabs(), wxScintilla::GotoPos(), wxString::IsEmpty(), wxString::Last(), wxString::Len(), wxString::Length(), wxScintilla::LineFromPosition(), Token::m_FullType, Token::m_ImplLine, Token::m_IsConst, Token::m_IsNoExcept, Token::m_Line, Token::m_Name, Token::m_ParentIndex, Token::m_TokenKind, wxScintilla::PositionFromLine(), ConfigManager::ReadBool(), wxString::RemoveLast(), wxScintilla::ReplaceTarget(), s_TokenTreeMutex, wxScintilla::SetTargetEnd(), wxScintilla::SetTargetStart(), wxDialog::ShowModal(), tkConstructor, tkDestructor, tkFunction, wxICON_WARNING, and wxID_OK.
Referenced by GetToolBarPriority().
Callback for inserting the selected autocomplete entry into the editor.
The default implementation executes (wx)Scintilla's insert. Override and call ed->GetControl()->AutoCompCancel()
for different wxEVT_SCI_AUTOCOMP_SELECTION
behaviour.
token | The CCToken corresponding to the selected entry. |
ed | The editor to operate in. |
Reimplemented from cbCodeCompletionPlugin.
Definition at line 1357 of file codecompletion.cpp.
References _T, wxString::Append(), CodeCompletionHelper::AutocompGetName(), cbCodeCompletionPlugin::CCToken::displayName, wxString::Find(), wxString::GetChar(), wxScintilla::GetCharAt(), cbEditor::GetControl(), wxScintilla::GetCurrentLine(), wxScintilla::GetCurrentPos(), wxScintilla::GetLine(), wxScintilla::GetLineEndPosition(), wxRegEx::GetMatch(), wxScintilla::GetStyleAt(), cbStyledTextCtrl::IsComment(), cbStyledTextCtrl::IsPreprocessor(), wxRegEx::Matches(), wxScintilla::WordStartPosition(), wxIsspace(), wxNOT_FOUND, and wxT.
Referenced by GetToolBarPriority().
|
private |
ContextMenu->Insert-> declaration/implementation.
Definition at line 2637 of file codecompletion.cpp.
References _(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, CCLogger::DebugLog(), CodeCompletionHelper::GotoDeclarationItem::filename, FileTypeOf(), ftHeader, ftSource, ftTemplateSource, CCLogger::Get(), Manager::Get(), EditorManager::GetBuiltinActiveEditor(), cbEditor::GetControl(), wxArrayString::GetCount(), wxScintilla::GetCurrentPos(), Manager::GetEditorManager(), wxScintilla::GetEOLMode(), EditorBase::GetFilename(), cbEditor::GetLineIndentString(), EditorBase::GetShortName(), wxScintilla::GetTabWidth(), wxScintilla::GetUseTabs(), wxScintilla::GotoPos(), wxString::Length(), wxScintilla::LineFromPosition(), PlaceWindow(), wxScintilla::PositionFromLine(), wxScintilla::ReplaceTarget(), s_TokenTreeMutex, wxScintilla::SetTargetEnd(), wxScintilla::SetTargetStart(), and wxID_OK.
Referenced by GetToolBarPriority().
|
private |
fill the tokens with correct code complete words
caretPos | the location of caret |
ed | the context editor where we locates |
tokens | the stored token results |
preprocessorOnly | if true, we only collect macro definition tokens |
Definition at line 948 of file codecompletion.cpp.
References _(), _T, TokenTree::at(), wxScintilla::CallTipActive(), wxScintilla::CallTipShow(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, wxScintilla::ClearRegisteredImages(), CCLogger::DebugLog(), F(), FileTypeOf(), ftHeader, ftSource, ftTemplateSource, CCLogger::Get(), wxImageList::GetBitmap(), cbEditor::GetColourSet(), cbEditor::GetControl(), wxScintilla::GetCurrentPos(), EditorBase::GetFilename(), Token::GetFormattedArgs(), wxImageList::GetImageCount(), EditorColourSet::GetKeywords(), cbEditor::GetLanguage(), EditorColourSet::GetLanguageForFilename(), EditorColourSet::GetLanguageName(), wxStringTokenizer::GetNextToken(), EditorBase::GetShortName(), wxStringTokenizer::HasMoreTokens(), HL_NONE, wxString::IsEmpty(), wxString::Lower(), Token::m_Aliases, Token::m_FullType, Token::m_Index, Token::m_IsTemp, Token::m_Name, Token::m_TokenKind, wxScintilla::RegisterImage(), s_DebugSmartSense, s_TokenTreeMutex, wxString::StartsWith(), tkAnyFunction, tkMacroDef, tkNamespace, tkVariable, TRACE, wxNOT_FOUND, wxSCI_KEYWORDSET_MAX, wxT, and wxTOKEN_STRTOK.
Referenced by GetToolBarPriority().
|
private |
fill the tokens with correct include file names
tknStart | the start of the completed word |
tknEnd | current caret location |
ed | current active editor |
tokens | results storing all the suggested include files |
Definition at line 1131 of file codecompletion.cpp.
References ProjectFile::buildTargets, wxScintilla::ClearRegisteredImages(), wxString::empty(), ProjectFile::file, CodeCompletionHelper::GotoDeclarationItem::filename, FileTypeOf(), wxString::Find(), ftHeader, ftSource, ftTemplateSource, cbEditor::GetControl(), wxArrayString::GetCount(), wxScintilla::GetCurLine(), wxScintilla::GetCurrentLine(), cbProject::GetFileByFilename(), EditorBase::GetFilename(), cbProject::GetFilesList(), wxFileName::GetFullPath(), cbProject::GetModified(), EditorBase::GetShortName(), wxString::insert(), wxString::IsEmpty(), wxString::Last(), wxString::Len(), CodeCompletionHelper::GotoDeclarationItem::line, wxFileName::MakeRelativeTo(), wxString::Mid(), wxScintilla::PositionFromLine(), wxScintilla::RegisterImage(), ProjectFile::relativeFilename, wxString::RemoveLast(), wxString::Replace(), wxString::StartsWith(), wxString::SubString(), CodeCompletionHelper::TestIncludeLine(), wxString::Trim(), wxNOT_FOUND, wxPATH_UNIX, and wxT.
Referenced by GetToolBarPriority().
|
private |
fill the tokens with correct preprocessor directives, such as #i will prompt "if", "include"
tknStart | the start of the completed word |
tknEnd | current caret location |
ed | current active editor |
tokens | results storing all the suggesting texts |
Definition at line 1089 of file codecompletion.cpp.
References wxScintilla::ClearRegisteredImages(), F(), FileTypeOf(), ftHeader, ftResource, ftSource, ftTemplateSource, cbEditor::GetControl(), wxScintilla::GetLexer(), EditorBase::GetShortName(), wxScintilla::GetTextRange(), wxString::IsEmpty(), PARSER_IMG_MACRO_DEF, wxScintilla::RegisterImage(), wxNOT_FOUND, wxSCI_LEX_CPP, and wxT.
Referenced by GetToolBarPriority().
|
private |
if C::B starts up with some projects opened, this function will be called to parse the already opened projects
Definition at line 3323 of file codecompletion.cpp.
References Manager::Get(), ProjectManager::GetActiveProject(), EditorManager::GetBuiltinActiveEditor(), Manager::GetEditorManager(), and Manager::GetProjectManager().
Referenced by GetToolBarPriority().
void CodeCompletion::EditorEventHook | ( | cbEditor * | editor, |
wxScintillaEvent & | event | ||
) |
handle all the editor event
Definition at line 1650 of file codecompletion.cpp.
References EDITOR_ACTIVATED_DELAY, cbEditor::GetControl(), wxScintilla::GetCurrentLine(), wxScintilla::GetLength(), wxScintillaEvent::GetModificationType(), REALTIME_PARSING_DELAY, TOOLBAR_REFRESH_DELAY, TRACE, wxSCI_MOD_DELETETEXT, wxSCI_MOD_INSERTTEXT, and wxTIMER_ONE_SHOT.
Referenced by GetToolBarPriority(), and OnAttach().
|
private |
enable the two wxChoices
Definition at line 3315 of file codecompletion.cpp.
Referenced by GetToolBarPriority().
|
private |
the caret has changed, so the wxChoice need to be updated to indicates which scope and function in which the caret locates.
Definition at line 3257 of file codecompletion.cpp.
References g_GlobalScope, wxChoice::SetSelection(), and wxPostEvent().
Referenced by GetToolBarPriority().
|
private |
helper method in finding the function position in the vector for the function containing the current line
Definition at line 2860 of file codecompletion.cpp.
References CodeCompletion::FunctionScope::EndLine, and CodeCompletion::FunctionScope::StartLine.
Referenced by GetToolBarPriority().
void CodeCompletion::GetAbsolutePath | ( | const wxString & | basePath, |
const wxArrayString & | targets, | ||
wxArrayString & | dirs | ||
) |
search target file names (mostly relative names) under basePath, then return the absolute dirs the result is "added" to parameter dirs (not replacement of any existing dirs) It just did the calculation below: "c:/ccc/ddd.cpp"(basePath) + "aaa/bbb.h"(target) => "c:/ccc/aaa/bbb.h"(dirs)
[in] | basePath | already located file path, this is usually the currently parsing file's location |
[in] | targets | the relative filename, e.g. When you have #include "aaa/bbb.h", "aaa/bbb.h" is the target location |
[out] | dirs | result location of the targets in absolute file path format |
Definition at line 1624 of file codecompletion.cpp.
References wxArrayString::Add(), wxFileName::AppendDir(), Manager::Get(), wxArrayString::GetCount(), wxFileName::GetDirCount(), wxFileName::GetDirs(), wxFileName::GetFullPath(), Manager::GetMacrosManager(), wxArrayString::Index(), wxFileName::IsAbsolute(), wxFileName::IsRelative(), MacrosManager::ReplaceMacros(), wxFileName::SetPath(), wxEmptyString, and wxNOT_FOUND.
Referenced by GetToolBarPriority().
|
virtual |
Supply content for the autocompletion list.
CCManager takes care of calling this during most relevant situations. If the autocompletion mechanism is required at a time that CCManager does not initiate, call
In this case, the parameter isAuto is passed as false value.
Here is an example
This is the case the user has just enter the chars "cos", now to get a suggestion list. The first '^' is the position of tknStart, and the second '^' is the position of tknEnd In this case, the cc plugin would supply a CCToken vectors, which could contains "cos", "cosh" and "cosh"... In some special cases, the tknStart tknEnd may point to the same position, such as
Here, '^' are the positions of both tknStart and tknEnd.
isAuto | Passed as true if autocompletion was launched by typing an 'interesting' character such as '> ' (for '-> '). It is the plugin's job to filter out incorrect calls of this. | |
ed | The context of this codecompletion call. | |
[in,out] | tknStart | The assumed beginning of the token to be autocompleted. Change this variable if the plugin calculates a different starting location. |
[in,out] | tknEnd | The current position/end of the known part of the token to be completed. The plugin is allowed to change this (but it is not recommended). |
Implements cbCodeCompletionPlugin.
Definition at line 876 of file codecompletion.cpp.
References _T, wxString::Find(), wxScintilla::GetCharAt(), cbEditor::GetControl(), wxScintilla::GetCurrentLine(), wxScintilla::GetLineIndentPosition(), wxScintilla::GetStyleAt(), wxScintilla::GetTextRange(), cbStyledTextCtrl::IsCharacter(), cbStyledTextCtrl::IsComment(), cbStyledTextCtrl::IsPreprocessor(), cbStyledTextCtrl::IsString(), wxScintilla::WordEndPosition(), wxScintilla::WordStartPosition(), wxNOT_FOUND, and wxT.
Referenced by GetToolBarPriority().
|
virtual |
Supply content for the calltip at the specified location.
The output parameter argsPos
is required to be set to the same (but unique) position for each unique calltip. This position is the location corresponding to the beginning of the argument list:
Each returned CCCallTip is allowed to have embedded '\n' line breaks.
pos | The location in the editor that the calltip is requested for. | |
style | The scintilla style of the cbStyledTextCtrl at the given location. (TODO: This is unusual, remove it?) | |
ed | The context of this calltip request. | |
[out] | argsPos | The location in the editor of the beginning of the argument list. Required. |
Implements cbCodeCompletionPlugin.
Definition at line 1278 of file codecompletion.cpp.
References wxArrayString::GetCount(), wxArrayString::IsEmpty(), wxSCI_C_WXSMITH, and wxSCI_INVALID_POSITION.
Referenced by GetToolBarPriority().
|
inlinevirtual |
Return the configuration group for this plugin.
Default is cgUnknown. Notice that you can logically AND more than one configuration groups, so you could set it, for example, as "cgCompiler | cgContribPlugin".
Reimplemented from cbPlugin.
Definition at line 89 of file codecompletion.h.
References BuildMenu(), BuildModuleMenu(), BuildToolBar(), cgEditor, GetConfigurationPanel(), and GetProjectConfigurationPanel().
|
virtual |
CC's config dialog.
Definition at line 647 of file codecompletion.cpp.
Referenced by GetConfigurationGroup().
Supply html formatted documentation for the passed token.
Refer to http://docs.wxwidgets.org/stable/overview_html.html#overview_html_supptags for the available formatting. When selecting colours, prefer use of the ones CCManager has registered with ColourManager, which are (TODO: register colours). Returning an empty string will cancel the documentation popup.
token | The token to document. |
Implements cbCodeCompletionPlugin.
Definition at line 1305 of file codecompletion.cpp.
References cbCodeCompletionPlugin::CCToken::id.
Referenced by GetToolBarPriority().
wxArrayString CodeCompletion::GetLocalIncludeDirs | ( | cbProject * | project, |
const wxArrayString & | buildTargets | ||
) |
Get the include paths setting (usually set by user for each C::B project).
If it finds some system level include search dirs which haven't been scanned, it will start a a new thread(SystemHeadersThread). this function internally adds all the system level dirs to scanning thread
project | project info |
buildTargets | target info |
Definition at line 1534 of file codecompletion.cpp.
References wxArrayString::Add(), CodeCompletionHelper::CompareStringLen(), and wxThread::Run().
Referenced by GetToolBarPriority().
|
virtual |
CC's config dialog which show in the project options panel.
Definition at line 652 of file codecompletion.cpp.
Referenced by GetConfigurationGroup().
|
virtual |
Does this plugin handle code completion for the editor ed
?
The plugin should check the lexer, the HighlightLanguage
, the file extension, or some combination of these. Do not call CCManager::GetProviderFor()
from this function.
ed | The editor being checked. |
Implements cbCodeCompletionPlugin.
Definition at line 857 of file codecompletion.cpp.
References ParserCommon::FileType(), ParserCommon::ftHeader, ParserCommon::ftOther, ParserCommon::ftSource, cbEditor::GetColourSet(), EditorBase::GetFilename(), EditorColourSet::GetHighlightLanguage(), cbEditor::GetLanguage(), and wxT.
Referenced by GetToolBarPriority().
wxArrayString & CodeCompletion::GetSystemIncludeDirs | ( | cbProject * | project, |
bool | force | ||
) |
get the whole search dirs except the ones locally belong to the c::b project, note this function is used for auto suggestion for #include directives.
force | if the value is false, just return a static (cached) wxArrayString to optimize the performance, if it is true, we try to update the cache by calculating the dirs and storing the value in the static wxArrayString variable. |
Definition at line 1587 of file codecompletion.cpp.
References wxArrayString::Clear(), cbProject::GetCommonTopLevelPath(), wxArrayString::GetCount(), ParserBase::GetIncludeDirs(), Last, and wxArrayString::RemoveAt().
Referenced by GetToolBarPriority().
|
virtual |
Supply the definition of the token at the specified location.
The token(s) returned by this function are used to display tooltips.
pos | The location being queried. | |
ed | The context of the request. | |
[out] | allowCallTip | Allow CCManager to consider displaying a calltip if the results from this function are unsuitable/empty. True by default. |
Implements cbCodeCompletionPlugin.
Definition at line 1310 of file codecompletion.cpp.
References TokenTree::at(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, Token::DisplayName(), cbEditor::GetControl(), wxScintilla::GetStyleAt(), cbStyledTextCtrl::IsCharacter(), cbStyledTextCtrl::IsComment(), cbStyledTextCtrl::IsPreprocessor(), cbStyledTextCtrl::IsString(), s_TokenTreeMutex, and wxScintilla::WordEndPosition().
Referenced by GetToolBarPriority().
|
inlinevirtual |
toolbar priority value
Reimplemented from cbPlugin.
Definition at line 102 of file codecompletion.h.
References DoAllMethodsImpl(), DoAutocomplete(), DoClassMethodDeclImpl(), DoCodeComplete(), DoCodeCompleteIncludes(), DoCodeCompletePreprocessor(), DoParseOpenedProjectAndActiveEditor(), EditorEventHook(), EnableToolbarTools(), FindFunctionAndUpdate(), FunctionPosition(), GetAbsolutePath(), GetAutocompList(), GetCallTips(), GetDocumentation(), GetLocalIncludeDirs(), GetProviderStatusFor(), GetSystemIncludeDirs(), GetTokenAt(), GotoFunctionPrevNext(), MatchCodeStyle(), NameSpacePosition(), NULL, OnAppDoneStartup(), OnCCDebugLogger(), OnCCLogger(), OnClassMethod(), OnCurrentProjectReparse(), OnDocumentationLink(), OnEditorActivated(), OnEditorActivatedTimer(), OnEditorClosed(), OnEditorOpen(), OnEditorSave(), OnFindReferences(), OnFunction(), OnGotoDeclaration(), OnGotoFunction(), OnGotoNextFunction(), OnGotoPrevFunction(), OnOpenIncludeFile(), OnParserEnd(), OnParserStart(), OnProjectActivated(), OnProjectClosed(), OnProjectFileAdded(), OnProjectFileChanged(), OnProjectFileRemoved(), OnProjectSaved(), OnProjectSavedTimer(), OnRealtimeParsingTimer(), OnRenameSymbols(), OnReparsingTimer(), OnScope(), OnSelectedFileReparse(), OnSelectedProjectReparse(), OnSystemHeadersThreadFinish(), OnSystemHeadersThreadMessage(), OnToolbarTimer(), OnUnimplementedClassMethods(), OnUpdateUI(), OnViewClassBrowser(), OnWorkspaceChanged(), ParseFunctionsAndFillToolbar(), RereadOptions(), UpdateEditorSyntax(), UpdateFunctions(), UpdateToolBar(), wxEmptyString, and wxSCI_EOL_LF.
|
private |
navigate between function bodies
Definition at line 2884 of file codecompletion.cpp.
References Manager::Get(), EditorManager::GetBuiltinActiveEditor(), cbEditor::GetControl(), wxScintilla::GetCurrentLine(), Manager::GetEditorManager(), and cbEditor::GotoLine().
Referenced by GetToolBarPriority().
|
private |
modify the string content to follow the current editor's code style The code style includes the EOL, TAB and indent
[in,out] | str | the input string, but also the modified string |
eolStyle | an int value to indicate the EOL style | |
indent | a wxString containing the whole intent text | |
useTabs | whether TAB is used | |
tabSize | how long is the TAB |
Definition at line 2850 of file codecompletion.cpp.
References GetEOLStr(), wxString::IsEmpty(), wxString::Length(), wxString::RemoveLast(), wxString::Replace(), and wxT.
Referenced by GetToolBarPriority().
|
private |
find the namespace whose scope covers the current line the m_CurrentLine is used
Definition at line 2943 of file codecompletion.cpp.
References NameSpace::StartLine.
Referenced by GetToolBarPriority().
|
private |
SDK event when application has started up.
Definition at line 2290 of file codecompletion.cpp.
Referenced by GetToolBarPriority(), and OnAttach().
|
virtual |
Any descendent plugin should override this virtual method and perform any necessary initialization.
This method is called by Code::Blocks (PluginManager actually) when the plugin has been loaded and should attach in Code::Blocks. When Code::Blocks starts up, it finds and loads all plugins but does not activate (attaches) them. It then activates all plugins that the user has selected to be activated on start-up.
This means that a plugin might be loaded but not activated...
Think of this method as the actual constructor...
Reimplemented from cbPlugin.
Definition at line 552 of file codecompletion.cpp.
References cbEVT_APP_STARTUP_DONE, cbEVT_EDITOR_ACTIVATED, cbEVT_EDITOR_CLOSE, cbEVT_EDITOR_OPEN, cbEVT_EDITOR_SAVE, cbEVT_PROJECT_ACTIVATE, cbEVT_PROJECT_CLOSE, cbEVT_PROJECT_FILE_ADDED, cbEVT_PROJECT_FILE_CHANGED, cbEVT_PROJECT_FILE_REMOVED, cbEVT_PROJECT_SAVE, cbEVT_WORKSPACE_CHANGED, EditorEventHook(), Manager::Get(), OnAppDoneStartup(), OnEditorActivated(), OnEditorClosed(), OnEditorOpen(), OnEditorSave(), OnProjectActivated(), OnProjectClosed(), OnProjectFileAdded(), OnProjectFileChanged(), OnProjectFileRemoved(), OnProjectSaved(), OnWorkspaceChanged(), Manager::RegisterEventSink(), and EditorHooks::RegisterHook().
|
private |
CC's own debug logger, to handle log event sent from other worker threads or itself(the main GUI thread), the log messages will be printed in the "Code::Blocks Debug" log panel.
Definition at line 2532 of file codecompletion.cpp.
References LogManager::DebugLog(), Manager::Get(), Manager::GetLogManager(), and Manager::IsAppShuttingDown().
Referenced by CodeCompletion(), GetToolBarPriority(), and ~CodeCompletion().
|
private |
CC's own logger, to handle log events sent from other worker threads or itself(the main GUI thread), the log messages will be printed in the "Code::Blocks" log panel.
Definition at line 2526 of file codecompletion.cpp.
References Manager::Get(), Manager::GetLogManager(), Manager::IsAppShuttingDown(), and LogManager::Log().
Referenced by CodeCompletion(), GetToolBarPriority(), and ~CodeCompletion().
|
private |
handle CC's context menu->insert "Class method declaration/implementation..."
Definition at line 1925 of file codecompletion.cpp.
Referenced by GetToolBarPriority().
|
private |
event handler when user select context menu->reparse file/projects
Definition at line 2250 of file codecompletion.cpp.
Referenced by GetToolBarPriority().
|
virtual |
Callback to handle a click on a link in the documentation popup.
Handle a link command by, for example, showing the definition of a member function, or opening an editor to the location of the declaration.
event | The generated event (it is the plugin's responsibility to Skip(), if desired). | |
[out] | dismissPopup | If set to true, the popup will be hidden. |
Implements cbCodeCompletionPlugin.
Definition at line 1352 of file codecompletion.cpp.
Referenced by GetToolBarPriority().
|
private |
Definition at line 2450 of file codecompletion.cpp.
References EDITOR_ACTIVATED_DELAY, Manager::Get(), EditorManager::GetBuiltinEditor(), CodeBlocksEvent::GetEditor(), Manager::GetEditorManager(), ProjectManager::IsBusy(), TRACE, and wxTIMER_ONE_SHOT.
Referenced by GetToolBarPriority(), NativeParser::LastAIGlobalSearch(), and OnAttach().
|
private |
delayed running of editor activated event, only the last activated editor should be considered
Definition at line 3556 of file codecompletion.cpp.
References Manager::Get(), EditorManager::GetBuiltinActiveEditor(), Manager::GetEditorManager(), EditorBase::GetFilename(), TOOLBAR_REFRESH_DELAY, TRACE, wxString::wx_str(), and wxTIMER_ONE_SHOT.
Referenced by CodeCompletion(), GetToolBarPriority(), and ~CodeCompletion().
|
private |
Definition at line 2469 of file codecompletion.cpp.
References bdfFile, wxString::clear(), CodeCompletionHelper::GotoDeclarationItem::filename, Manager::Get(), EditorManager::GetActiveEditor(), EditorManager::GetBuiltinEditor(), CodeBlocksEvent::GetEditor(), Manager::GetEditorManager(), EditorManager::GetEditorsCount(), EditorBase::GetFilename(), EditorBase::IsBuiltinEditor(), TRACE, and wxString::wx_str().
Referenced by GetToolBarPriority(), NativeParser::LastAIGlobalSearch(), and OnAttach().
|
private |
Definition at line 2435 of file codecompletion.cpp.
References Manager::Get(), EditorManager::GetBuiltinEditor(), CodeBlocksEvent::GetEditor(), Manager::GetEditorManager(), EditorBase::GetFilename(), Manager::IsAppShuttingDown(), and CodeCompletion::FunctionsScopePerFile::parsed.
Referenced by GetToolBarPriority(), and OnAttach().
|
private |
SDK editor related events.
Definition at line 2411 of file codecompletion.cpp.
References EDITOR_ACTIVATED_DELAY, CodeBlocksEvent::GetEditor(), ProjectManager::IsBusy(), TRACE, wxNOT_FOUND, and wxTIMER_ONE_SHOT.
Referenced by GetToolBarPriority(), and OnAttach().
|
private |
CC's re-factoring function, find all the reference place.
Definition at line 2156 of file codecompletion.cpp.
Referenced by GetToolBarPriority().
|
private |
Toolbar select event.
Definition at line 2969 of file codecompletion.cpp.
References Manager::Get(), EditorManager::GetBuiltinActiveEditor(), Manager::GetEditorManager(), and cbEditor::GotoTokenPosition().
Referenced by GetToolBarPriority().
|
private |
handle both goto declaration and implementation event
Definition at line 1935 of file codecompletion.cpp.
References _(), wxArrayString::Add(), TokenTree::at(), cbGetSingleChoiceIndex(), cbMessageBox(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, Token::DisplayName(), wxString::empty(), CodeCompletionHelper::GotoDeclarationItem::filename, wxString::Format(), Manager::Get(), EditorManager::GetBuiltinActiveEditor(), cbEditor::GetControl(), wxArrayString::GetCount(), wxScintilla::GetCurrentLine(), wxScintilla::GetCurrentPos(), Manager::GetEditorManager(), Token::GetFilename(), Token::GetImplFilename(), CodeCompletionHelper::GetLastNonWhitespaceChar(), CodeCompletionHelper::GetNextNonWhitespaceChar(), wxScintilla::GetTextRange(), cbEditor::GotoTokenPosition(), idGotoImplementation, idMenuGotoDeclaration, idMenuGotoImplementation, wxString::IsEmpty(), CodeCompletionHelper::GotoDeclarationItem::line, Token::m_ImplLine, Token::m_Index, Token::m_Line, Token::m_TokenKind, NULL, EditorManager::Open(), s_TokenTreeMutex, wxDialog::ShowModal(), tkClass, tkConstructor, tkDestructor, TokenTree::TokenExists(), TRACE, wxScintilla::WordEndPosition(), wxScintilla::WordStartPosition(), wxString::wx_str(), wxGetKeyState(), wxICON_WARNING, WXK_CONTROL, and WXK_SHIFT.
Referenced by GetToolBarPriority().
|
private |
event handler when user click Menu->Search->Goto function
Definition at line 1847 of file codecompletion.cpp.
References _(), GotoFunctionDlg::Iterator::AddToken(), TokenTree::at(), wxString::c_str(), cbMessageBox(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, TokenTree::clear(), GotoFunctionDlg::FunctionToken::displayName, Token::DisplayName(), wxString::empty(), TokenTree::empty(), F(), GotoFunctionDlg::FunctionToken::funcName, Manager::Get(), EditorManager::GetBuiltinActiveEditor(), cbEditor::GetControl(), Manager::GetEditorManager(), Token::GetNamespace(), GotoFunctionDlg::GetSelection(), wxScintilla::GetText(), GotoFunctionDlg::Iterator::GetToken(), cbEditor::GotoTokenPosition(), GotoFunctionDlg::FunctionToken::implLine, GotoFunctionDlg::FunctionToken::line, Token::m_Args, Token::m_FullType, Token::m_ImplLine, Token::m_Line, Token::m_Name, Token::m_TokenKind, GotoFunctionDlg::FunctionToken::name, GotoFunctionDlg::FunctionToken::paramsAndreturnType, PlaceWindow(), s_TokenTreeMutex, wxDialog::ShowModal(), TokenTree::size(), GotoFunctionDlg::Iterator::Sort(), tkAnyFunction, TRACE, wxString::wx_str(), wxID_OK, wxNOT_FOUND, and wxT.
Referenced by GetToolBarPriority().
|
private |
navigate to the next function body
Definition at line 1920 of file codecompletion.cpp.
Referenced by GetToolBarPriority().
|
private |
navigate to the previous function body
Definition at line 1915 of file codecompletion.cpp.
Referenced by GetToolBarPriority().
|
private |
open the include file under the caret position
Definition at line 2166 of file codecompletion.cpp.
References _(), wxArrayString::Add(), SelectIncludeFile::AddListEntries(), wxString::c_str(), cbMessageBox(), CodeCompletionHelper::EditorHasNameUnderCursor(), ProjectFile::file, wxString::Format(), Manager::Get(), EditorManager::GetBuiltinActiveEditor(), wxArrayString::GetCount(), Manager::GetEditorManager(), EditorBase::GetFilename(), cbProject::GetFilesList(), wxFileName::GetFullPath(), SelectIncludeFile::GetIncludeFile(), wxFileName::GetPath(), wxString::IsEmpty(), IsSuffixOfPath(), wxArrayString::Item(), NormalizePath(), EditorManager::Open(), PlaceWindow(), wxArrayString::RemoveAt(), wxDialog::ShowModal(), TRACE, wxFileExists(), wxICON_WARNING, and wxID_OK.
Referenced by GetToolBarPriority().
|
private |
batch parsing end event this event usually be fired when the task pool becomes empty
Definition at line 2560 of file codecompletion.cpp.
References Manager::Get(), EditorManager::GetBuiltinActiveEditor(), EditorManager::GetBuiltinEditor(), Manager::GetEditorManager(), EditorManager::GetEditorsCount(), ParserCommon::ptCreateParser, TOOLBAR_REFRESH_DELAY, TRACE, and wxTIMER_ONE_SHOT.
Referenced by CodeCompletion(), GetToolBarPriority(), NativeParser::LastAIGlobalSearch(), and ~CodeCompletion().
|
private |
batch parsing start event this event usually be fired when an Parser object try to start parsing tasks in the thread pool
Definition at line 2538 of file codecompletion.cpp.
References Manager::Get(), EditorManager::GetBuiltinActiveEditor(), Manager::GetEditorManager(), and ParserCommon::ptCreateParser.
Referenced by CodeCompletion(), GetToolBarPriority(), NativeParser::LastAIGlobalSearch(), and ~CodeCompletion().
|
private |
SDK project related events.
Definition at line 2328 of file codecompletion.cpp.
References bdfProject, cbProject::GetFilesCount(), and ProjectManager::IsBusy().
Referenced by GetToolBarPriority(), and OnAttach().
|
private |
Definition at line 2349 of file codecompletion.cpp.
Referenced by GetToolBarPriority(), and OnAttach().
|
private |
Definition at line 2382 of file codecompletion.cpp.
References CodeBlocksEvent::GetProject().
Referenced by GetToolBarPriority(), and OnAttach().
|
private |
Definition at line 2396 of file codecompletion.cpp.
References CCLogger::DebugLog(), and CCLogger::Get().
Referenced by GetToolBarPriority(), and OnAttach().
|
private |
Definition at line 2389 of file codecompletion.cpp.
References CodeBlocksEvent::GetProject().
Referenced by GetToolBarPriority(), and OnAttach().
|
private |
Definition at line 2371 of file codecompletion.cpp.
References CodeBlocksEvent::GetProject(), TRACE, and wxTIMER_ONE_SHOT.
Referenced by GetToolBarPriority(), and OnAttach().
|
private |
delayed running after saving project, while many projects' saving
Definition at line 3471 of file codecompletion.cpp.
References CCLogger::DebugLog(), CCLogger::Get(), Manager::Get(), Manager::GetProjectManager(), ProjectManager::GetProjects(), NULL, TRACE, and wxNOT_FOUND.
Referenced by CodeCompletion(), GetToolBarPriority(), and ~CodeCompletion().
|
private |
event fired from the edit event hook function to indicate parsing while editing
Definition at line 3445 of file codecompletion.cpp.
References CCLogger::DebugLog(), CCLogger::Get(), Manager::Get(), EditorManager::GetBuiltinActiveEditor(), cbEditor::GetControl(), Manager::GetEditorManager(), cbProject::GetFileByFilename(), wxScintilla::GetLength(), REALTIME_PARSING_DELAY, TRACE, and wxTIMER_ONE_SHOT.
Referenced by CodeCompletion(), GetToolBarPriority(), and ~CodeCompletion().
|
virtual |
Definition at line 609 of file codecompletion.cpp.
References Manager::Get(), Manager::RemoveAllEventSinksFor(), and EditorHooks::UnregisterHook().
|
private |
CC's re-factoring function, rename a symbol.
Definition at line 2161 of file codecompletion.cpp.
Referenced by GetToolBarPriority().
|
private |
delayed for re-parsing
Definition at line 3497 of file codecompletion.cpp.
References CCLogger::DebugLog(), EDITOR_ACTIVATED_DELAY, F(), CCLogger::Get(), Manager::Get(), EditorManager::GetActiveEditor(), wxArrayString::GetCount(), Manager::GetEditorManager(), EditorBase::GetFilename(), ProjectManager::IsBusy(), wxArrayString::IsEmpty(), wxArrayString::Last(), wxArrayString::RemoveAt(), TOOLBAR_REFRESH_DELAY, TRACE, and wxTIMER_ONE_SHOT.
Referenced by CodeCompletion(), GetToolBarPriority(), and ~CodeCompletion().
|
private |
Toolbar select event.
Definition at line 2962 of file codecompletion.cpp.
Referenced by GetToolBarPriority().
|
private |
Definition at line 2262 of file codecompletion.cpp.
References CCLogger::DebugLog(), ProjectFile::file, FileTreeData::ftdkFile, CCLogger::Get(), Manager::Get(), wxFileName::GetFullPath(), wxTreeCtrl::GetItemData(), FileTreeData::GetKind(), FileTreeData::GetProject(), FileTreeData::GetProjectFile(), Manager::GetProjectManager(), cbProjectManagerUI::GetTree(), cbProjectManagerUI::GetTreeSelection(), ProjectManager::GetUI(), and wxTreeItemId::IsOk().
Referenced by GetToolBarPriority().
|
private |
Definition at line 2256 of file codecompletion.cpp.
Referenced by GetToolBarPriority().
|
private |
Definition at line 2605 of file codecompletion.cpp.
References CCLogger::DebugLog(), CCLogger::Get(), wxThread::IsAlive(), wxThread::IsRunning(), wxThread::Run(), and wxThread::Wait().
Referenced by CodeCompletion(), GetToolBarPriority(), and ~CodeCompletion().
|
private |
receive event from SystemHeadersThread
Definition at line 2600 of file codecompletion.cpp.
References CCLogger::DebugLog(), and CCLogger::Get().
Referenced by CodeCompletion(), GetToolBarPriority(), and ~CodeCompletion().
|
private |
delayed for toolbar update
Definition at line 3430 of file codecompletion.cpp.
References ProjectManager::IsBusy(), TOOLBAR_REFRESH_DELAY, TRACE, and wxTIMER_ONE_SHOT.
Referenced by CodeCompletion(), GetToolBarPriority(), and ~CodeCompletion().
|
private |
handle CC's context menu->insert "All class methods without implementation..."
Definition at line 1930 of file codecompletion.cpp.
Referenced by GetToolBarPriority().
|
private |
event handler for updating UI e.g.
menu statues
Definition at line 1784 of file codecompletion.cpp.
References CodeCompletionHelper::EditorHasNameUnderCursor(), Manager::Get(), EditorManager::GetBuiltinActiveEditor(), Manager::GetEditorManager(), and IsWindowReallyShown().
Referenced by GetToolBarPriority().
|
private |
event handler when user click Menu->View->Symbols browser
Definition at line 1828 of file codecompletion.cpp.
References _(), cbEVT_HIDE_DOCK_WINDOW, cbEVT_SHOW_DOCK_WINDOW, cbMessageBox(), Manager::Get(), Manager::ProcessEvent(), CodeBlocksDockEvent::pWindow, and wxICON_INFORMATION.
Referenced by GetToolBarPriority().
|
private |
SDK workspace related events.
Definition at line 2298 of file codecompletion.cpp.
References bdfProject, Manager::Get(), ProjectManager::GetActiveProject(), Manager::GetProjectManager(), TOOLBAR_REFRESH_DELAY, TRACE, and wxTIMER_ONE_SHOT.
Referenced by GetToolBarPriority(), and OnAttach().
|
private |
normally the editor has changed, then CC need to parse the document again, and (re)construct the internal database, and refresh the toolbar(wxChoice's content)
Here is the expansion of how the two wxChoices are constructed.
for a file have such contents below
The two key variable will be constructed like below
Then we have wxChoice Scopes and Functions like below
Definition at line 3050 of file codecompletion.cpp.
References CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, wxString::Clear(), CCLogger::DebugLog(), CodeCompletion::FunctionScope::EndLine, wxString::EndsWith(), CodeCompletionHelper::EqualFunctionScope(), F(), CodeCompletionHelper::GotoDeclarationItem::filename, g_GlobalScope, CCLogger::Get(), Manager::Get(), EditorManager::GetBuiltinActiveEditor(), cbEditor::GetControl(), wxScintilla::GetCurrentLine(), Manager::GetEditorManager(), EditorBase::GetFilename(), Token::GetFormattedArgs(), Token::GetNamespace(), wxScintilla::GetText(), wxString::IsEmpty(), wxString::length(), CodeCompletionHelper::LessFunctionScope(), CodeCompletionHelper::LessNameSpace(), Token::m_BaseType, CodeCompletion::FunctionsScopePerFile::m_FunctionsScope, Token::m_ImplFileIdx, Token::m_ImplLine, Token::m_ImplLineEnd, Token::m_Name, CodeCompletion::FunctionsScopePerFile::m_NameSpaces, Token::m_TokenKind, CodeCompletion::FunctionScope::Name, CodeCompletion::FunctionsScopePerFile::parsed, s_TokenTreeMutex, CodeCompletion::FunctionScope::Scope, CodeCompletion::FunctionScope::ShortName, CodeCompletion::FunctionScope::StartLine, wxString::substr(), tkAnyFunction, tkClass, tkEnum, tkNamespace, TRACE, wxString::wx_str(), wxEmptyString, and wxT.
Referenced by GetToolBarPriority().
void CodeCompletion::RereadOptions | ( | ) |
read CC's options, mostly happens the user change some setting and press APPLY
Definition at line 1714 of file codecompletion.cpp.
References cbEVT_UPDATE_VIEW_LAYOUT, Manager::Get(), Manager::GetConfigManager(), Manager::ProcessEvent(), ConfigManager::Read(), ConfigManager::ReadBool(), ConfigManager::ReadInt(), TOOLBAR_REFRESH_DELAY, TRACE, wxEmptyString, and wxTIMER_ONE_SHOT.
Referenced by GetToolBarPriority(), and CCOptionsDlg::OnApply().
highlight member variables
Definition at line 3344 of file codecompletion.cpp.
References TokenTree::at(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, wxScintilla::Colourise(), Token::end, wxString::EndsWith(), Manager::Get(), EditorManager::GetBuiltinActiveEditor(), EditorManager::GetColourSet(), cbEditor::GetControl(), Manager::GetEditorManager(), EditorBase::GetFilename(), EditorColourSet::GetKeywords(), cbEditor::GetLanguage(), wxScintilla::GetLexer(), Token::m_Ancestors, Token::m_Children, Token::m_Index, Token::m_Name, Token::m_ParentIndex, Token::m_Scope, Token::m_TokenKind, TokenTree::RecalcInheritanceChain(), s_TokenTreeMutex, wxScintilla::SetKeyWords(), tkAnyContainer, tkAnyFunction, tkVariable, tsPrivate, wxNOT_FOUND, wxSCI_LEX_CPP, and wxT.
Referenced by GetToolBarPriority().
|
private |
the scope item has changed or becomes invalid, so the associated function wxChoice should be updated.
scopeItem | the new item in scope wxChoice. |
Definition at line 3300 of file codecompletion.cpp.
References wxString::Append().
Referenced by GetToolBarPriority().
|
private |
update CC's ToolBar, the user may disable the first wxChoice, so we need to recreate the wxChoice and measure the best fit size
Definition at line 1753 of file codecompletion.cpp.
References Manager::Get(), Manager::GetConfigManager(), ConfigManager::ReadBool(), and ConfigManager::ReadInt().
Referenced by GetToolBarPriority().
|
friend |
|
private |
this is a "filename->info" map containing all the opening files choice info
Definition at line 413 of file codecompletion.h.
|
private |
whether add parentheses after user selects a function name in the code-completion suggestion list
Definition at line 452 of file codecompletion.h.
|
private |
add function arguments' types and names when autocompleted outside function.
The default value is false.
Definition at line 457 of file codecompletion.h.
|
private |
give code completion list for header files, it happens after the #include directive
Definition at line 465 of file codecompletion.h.
|
private |
do not allow code completion to add include files of projects/targets to the parser that are not supported by the current platform
Definition at line 470 of file codecompletion.h.
|
private |
user defined characters that work like Tab (empty by Default).
They will be inserted with the selected item.
Definition at line 462 of file codecompletion.h.
|
private |
maximum allowed code-completion list entries
Definition at line 449 of file codecompletion.h.
|
private |
code re-factoring tool
Definition at line 349 of file codecompletion.h.
|
private |
remember the number of bytes in the current editor/document this is actually the saved editor or file's size
Definition at line 441 of file codecompletion.h.
|
private |
current caret line, this is actually the saved caret line
Definition at line 427 of file codecompletion.h.
|
private |
Provider of documentation for the popup window.
Definition at line 506 of file codecompletion.h.
|
private |
menu pointers to the frame's main menu
Definition at line 340 of file codecompletion.h.
|
private |
Definition at line 351 of file codecompletion.h.
|
private |
function choice control of CC's toolbar, it is the second choice
Definition at line 393 of file codecompletion.h.
|
private |
current active file's function body info
Definition at line 401 of file codecompletion.h.
|
private |
Indicates CC's initialization is done.
Definition at line 337 of file codecompletion.h.
|
private |
the last valid editor it is saved in editor activated event handler, and will be verified in editor activated timer event handler
Definition at line 387 of file codecompletion.h.
|
private |
the file updating the toolbar info
Definition at line 430 of file codecompletion.h.
|
private |
indicate whether the predefined keywords set should be added in the suggestion list
Definition at line 433 of file codecompletion.h.
|
private |
current active file's namespace/scope info
Definition at line 404 of file codecompletion.h.
|
private |
this member will actually manage all the Parser instances
Definition at line 346 of file codecompletion.h.
Referenced by DocumentationHelper::OnDocumentationLink().
|
private |
indicate the editor has modified by the user and a real-time parse should be start
Definition at line 436 of file codecompletion.h.
|
private |
batch run UpdateEditorSyntax() after first parsing
Definition at line 444 of file codecompletion.h.
|
private |
Definition at line 343 of file codecompletion.h.
|
private |
all the files need to be parsed and their associated projects
Definition at line 503 of file codecompletion.h.
|
private |
namespace/scope choice control, it is the first choice control
Definition at line 395 of file codecompletion.h.
|
private |
current active file's line info, helper member to access function scopes
Definition at line 410 of file codecompletion.h.
|
private |
Definition at line 341 of file codecompletion.h.
|
private |
Definition at line 477 of file codecompletion.h.
|
private |
critical section to protect accessing m_SystemHeadersMap
Definition at line 485 of file codecompletion.h.
|
private |
thread to collect header file names, these header file names can be prompt for auto suggestion after #include < or #include " directives.
Definition at line 482 of file codecompletion.h.
|
private |
delay after receive editor activated event the reason we need a timer is that we want to get a stable editor activate information thus we will only handle the last editor activated editor The timer will be restart when an editor activated event happens.
Definition at line 381 of file codecompletion.h.
|
private |
delay after project saved event
Definition at line 371 of file codecompletion.h.
|
private |
timer triggered by editor hook function to delay the real-time parse
Definition at line 354 of file codecompletion.h.
|
private |
delay after receive a project save/modified event
Definition at line 374 of file codecompletion.h.
|
private |
timer for toolbar we only show an updated item in CC's toolbar's item list when caret position is stable for a period of time.
Definition at line 360 of file codecompletion.h.
|
private |
the CC's toolbar
Definition at line 391 of file codecompletion.h.
|
private |
indicate whether the CC's toolbar need a refresh, this means the toolbar list will be reconstructed
Definition at line 418 of file codecompletion.h.
|
private |
force to re-collect the CC toolbar's item information this means we will parse the buffer to collect the scope information and then rebuild the toolbar items
Definition at line 424 of file codecompletion.h.
|
private |
Definition at line 342 of file codecompletion.h.