Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
ClangComplete plugin
Lalaland:
Couple of improvements.
No more showing of things you cannot use:
(ClangComplete)
(Code Complete)
I also finally started sorting by libclang's "priority". Objects are sorted by priority first, and then by alphabetical order.
Summary, junk(such as definitions) floats to the bottom, but the usefull things (such as methods and members) are alphabetically sorted as you would expect.
The plugin is also now derived from cbCodeCompletionPlugin, but that does not do much as only the CodeComplete function does something.
EDIT: I have now also hidden everything starting with an '_'. Those internals should not be used anyways.
Lalaland:
I am having an issue. The code completion dialog will not show up when called in the middle of a word.
I am using the same code as the official plugin to generate the location for the code completion.
--- Code: --- int pos = control->GetCurrentPos();
int start = control->WordStartPosition(pos, true);
wxString final = GetStringFromArray(items, _(" "));
control->AutoCompSetCancelAtStart(false);
control->AutoCompSetAutoHide(true);
control->AutoCompShow(pos-start,final );
--- End code ---
Items is an array of the completions.
The following shows how it works with no letters, and then fails when trying to complete with at least one.
(I have posted so many pictures that I might as well try a video now)
http://youtu.be/AjbFL_n0qos
This is the only work left to completing in the middle of the word.
Alpha:
--- Quote from: Folco on November 15, 2011, 09:15:43 pm ---My personal opinion : I don't use these pictures. The names I choose are explicit, and I never learned the meaning of these symbols.
--- End quote ---
If you were wondering, I have added a table defining these symbols to the Code Completion plugin wiki-page.
@Lalaland: I am afraid I do not yet know enough about the process of code completion to help you, however, I did want to say: good job so far.
ollydbg:
--- Quote from: Alpha on November 19, 2011, 03:14:40 am ---
--- Quote from: Folco on November 15, 2011, 09:15:43 pm ---My personal opinion : I don't use these pictures. The names I choose are explicit, and I never learned the meaning of these symbols.
--- End quote ---
If you were wondering, I have added a table defining these symbols to the Code Completion plugin wiki-page.
--- End quote ---
This table is quite good, nice work!!!
--- Quote ---@Lalaland: I am afraid I do not yet know enough about the process of code completion to help you, however, I did want to say: good job so far.
--- End quote ---
I will try to give some help :D
ollydbg:
If you set a breakpoint in the function body: NativeParser::AI
You will get the call stack when you enter some chars in the middle of a word.
--- Code: ---> bt 30
#0 NativeParser::AI (this=0x3bf6040, result=std::set with 0 elements, searchData=0x22ed28, lineText="", isPrefix=true, caseSensitive=false, search_scope=0x22ecb8, caretPos=-1) at e:\code\cb\cb_trunk\src\plugins\codecompletion\nativeparser.cpp:2338
#1 0x65ec4ae1 in NativeParser::MarkItemsByAI (this=0x3bf6040, searchData=0x22ed28, result=std::set with 0 elements, reallyUseAI=true, isPrefix=true, caseSensitive=false, caretPos=-1) at e:\code\cb\cb_trunk\src\plugins\codecompletion\nativeparser.cpp:1745
#2 0x65ec47f9 in NativeParser::MarkItemsByAI (this=0x3bf6040, result=std::set with 0 elements, reallyUseAI=true, isPrefix=true, caseSensitive=false, caretPos=-1) at e:\code\cb\cb_trunk\src\plugins\codecompletion\nativeparser.cpp:1690
#3 0x65ea7554 in CodeCompletion::CodeComplete (this=0x3bf5ff8) at e:\code\cb\cb_trunk\src\plugins\codecompletion\codecompletion.cpp:1042
#4 0x65eac167 in CodeCompletion::DoCodeComplete (this=0x3bf5ff8) at e:\code\cb\cb_trunk\src\plugins\codecompletion\codecompletion.cpp:1776
#5 0x65eb2935 in CodeCompletion::EditorEventHook (this=0x3bf5ff8, editor=0x5685008, event=...) at e:\code\cb\cb_trunk\src\plugins\codecompletion\codecompletion.cpp:3346
#6 0x65f0958d in EditorHooks::HookFunctor<CodeCompletion>::Call (this=0x2f2e480, editor=0x5685008, event=...) at e:\code\cb\cb_trunk\src\include\editor_hooks.h:54
#7 0x00a943d1 in EditorHooks::CallHooks (editor=0x5685008, event=...) at e:\code\cb\cb_trunk\src\sdk\editor_hooks.cpp:60
#8 0x00a5a353 in cbEditor::OnScintillaEvent (this=0x5685008, event=...) at e:\code\cb\cb_trunk\src\sdk\cbeditor.cpp:3554
#9 0x00a59a67 in cbEditor::OnEditorCharAdded (this=0x5685008, event=...) at e:\code\cb\cb_trunk\src\sdk\cbeditor.cpp:3362
#10 0x627720b6 in wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () from E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
#11 0x62772520 in wxEvtHandler::SearchDynamicEventTable(wxEvent&) () from E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
#12 0x627725d3 in wxEvtHandler::ProcessEvent(wxEvent&) () from E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
#13 0x6285b59d in wxWindowBase::TryParent(wxEvent&) () from E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
#14 0x00b72642 in wxScintilla::NotifyParent (this=0x56af358, _scn=0x22f31c) at e:\code\cb\cb_trunk\src\sdk\wxscintilla\src\wxscintilla.cpp:5084
#15 0x00b752dc in ScintillaWX::NotifyParent (this=0x56ae008, scn=...) at e:\code\cb\cb_trunk\src\sdk\wxscintilla\src\ScintillaWX.cpp:521
#16 0x00bf287c in Editor::NotifyChar (this=0x56ae008, ch=67) at e:\code\cb\cb_trunk\src\sdk\wxscintilla\src\scintilla\src\Editor.cxx:4377
#17 0x00bf0cc8 in Editor::AddCharUTF (this=0x56ae008, s=0x55ca288 "C", len=1, treatAsDBCS=false) at e:\code\cb\cb_trunk\src\sdk\wxscintilla\src\scintilla\src\Editor.cxx:4081
#18 0x00c05a49 in ScintillaBase::AddCharUTF (this=0x56ae008, s=0x55ca288 "C", len=1, treatAsDBCS=false) at e:\code\cb\cb_trunk\src\sdk\wxscintilla\src\scintilla\src\ScintillaBase.cxx:76
#19 0x00b76da3 in ScintillaWX::DoAddChar (this=0x56ae008, key=67) at e:\code\cb\cb_trunk\src\sdk\wxscintilla\src\ScintillaWX.cpp:1067
#20 0x00b71b67 in wxScintilla::OnChar (this=0x56af358, evt=...) at e:\code\cb\cb_trunk\src\sdk\wxscintilla\src\wxscintilla.cpp:4811
#21 0x627720b6 in wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () from E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
#22 0x6277222a in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () from E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
#23 0x627725f6 in wxEvtHandler::ProcessEvent(wxEvent&) () from E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
#24 0x627b2c93 in wxWindow::HandleChar(unsigned int, long, bool) () from E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
#25 0x627b471a in wxWindow::MSWWindowProc(unsigned int, unsigned int, long) () from E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
#26 0x627af438 in wxWndProc () from E:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll
#27 0x7e418734 in USER32!GetDC () from C:\WINDOWS\system32\user32.dll
#28 0x000503b6 in ?? ()
warning: (Internal error: pc 0x101 in read in psymtab, but not in symtab.)
warning: (Internal error: pc 0x101 in read in psymtab, but not in symtab.)
warning: (Internal error: pc 0x101 in read in psymtab, but not in symtab.)
warning: (Internal error: pc 0x101 in read in psymtab, but not in symtab.)
#29 0x00000102 in ?? ()
>>>>>>cb_gdb:
--- End code ---
So, You can see in the AI's body:
--- Code: --- int pos = caretPos == -1 ? searchData->control->GetCurrentPos() : caretPos;
if (pos < 0 || pos > searchData->control->GetLength())
return 0;
m_EditorStartWord = searchData->control->WordStartPosition(pos, true);
m_EditorEndWord = pos; //editor->GetControl()->WordEndPosition(pos, true);
int line = searchData->control->LineFromPosition(pos);
// Get the actual search text, such as "objA.m_aaa.m_bbb"
wxString actual_search(lineText);
if (actual_search.IsEmpty())
{
// Get the position at the start of current line
const int startPos = searchData->control->PositionFromLine(line);
actual_search = searchData->control->GetTextRange(startPos, pos).Trim();
}
--- End code ---
Note, the actual_search is the current line Text you might interests.
PS: I'm debugging the c::b's trunk code.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version