Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
Patch: function arguments added to autocomplete tooltip
oBFusCATed:
Generally it is better to post it on the tracker and if you feel that it needs to be discussed you can start a topic in the forum...
p2rkw:
I'm still working on doc helper, and I don't know how to check which position in autocomp list is selected. I arleady capture up and down arrows, but I can't capture mouse clicks. I got 2 ideas how to solve it:
1. create new event type i.e wxEVT_SCI_AUTOCOMP_MOVED in wxscintilla.cpp, there are already few events between C::B begin and C::B end
2. create timer in CodeCompletion that when autocompete list will be active will check which item is selected.
What should I do? Maybe you have other ideas?
ollydbg:
--- Quote from: p2rkw on December 05, 2012, 01:27:32 am ---1. create new event type i.e wxEVT_SCI_AUTOCOMP_MOVED in wxscintilla.cpp, there are already few events between C::B begin and C::B end
--- End quote ---
I see in sdk\wxscintilla\src\wxscintilla.cpp
--- Code: ---
BEGIN_EVENT_TABLE(wxScintilla, wxControl)
EVT_PAINT (wxScintilla::OnPaint)
EVT_SCROLLWIN (wxScintilla::OnScrollWin)
EVT_SCROLL (wxScintilla::OnScroll)
EVT_SIZE (wxScintilla::OnSize)
EVT_LEFT_DOWN (wxScintilla::OnMouseLeftDown)
// Let Scintilla see the double click as a second click
EVT_LEFT_DCLICK (wxScintilla::OnMouseLeftDown)
EVT_MOTION (wxScintilla::OnMouseMove)
EVT_LEFT_UP (wxScintilla::OnMouseLeftUp)
#if defined(__WXGTK__) || defined(__WXMAC__)
EVT_RIGHT_UP (wxScintilla::OnMouseRightUp)
#else
EVT_CONTEXT_MENU (wxScintilla::OnContextMenu)
#endif
EVT_MOUSEWHEEL (wxScintilla::OnMouseWheel)
EVT_MIDDLE_UP (wxScintilla::OnMouseMiddleUp)
EVT_CHAR (wxScintilla::OnChar)
EVT_KEY_DOWN (wxScintilla::OnKeyDown)
EVT_KILL_FOCUS (wxScintilla::OnLoseFocus)
EVT_SET_FOCUS (wxScintilla::OnGainFocus)
EVT_SYS_COLOUR_CHANGED (wxScintilla::OnSysColourChanged)
EVT_ERASE_BACKGROUND (wxScintilla::OnEraseBackground)
EVT_MENU_RANGE (10, 16, wxScintilla::OnMenu)
EVT_LISTBOX_DCLICK (wxID_ANY, wxScintilla::OnListBox)
END_EVENT_TABLE()
--- End code ---
So, it looks like you can add one for EVT_LISTBOX, see http://docs.wxwidgets.org/trunk/classwx_list_box.html
--- Quote ---
EVT_LISTBOX(id, func):
Process a wxEVT_COMMAND_LISTBOX_SELECTED event, when an item on the list is selected or the selection changes.
EVT_LISTBOX_DCLICK(id, func):
Process a wxEVT_COMMAND_LISTBOX_DOUBLECLICKED event, when the listbox is double-clicked.
--- End quote ---
wxScintilla::OnListBox basically just enter the selected text in autocompletion:
--- Code: ---void wxScintilla::OnListBox(wxCommandEvent& WXUNUSED(evt))
{
m_swx->DoOnListBox();
}
--- End code ---
--- Code: ---void ScintillaWX::DoOnListBox() {
AutoCompleteCompleted();
}
--- End code ---
So, double click on the list box will finally call AutoCompleteCompleted(), which just enter a selected item's text.
p2rkw:
Ollydbg, thanks a lot for advice :) Inspired by your post I tried to handle EVT_LISTBOX event:
--- Code: ---cbStyledTextCtrl* control = editor->GetControl();
control->Connect(wxID_ANY, EVT_LISTBOX,
(wxObjectEventFunction)&CodeCompletion::OnAutocompleteListbox,
NULL, this );
--- End code ---
but event has never occurred. So I set breakpoint on wxScintilla::OnListBox, and find out that this method is never called! So I had to go deeper and I find that wxxcintilla doesn't use wxListBox but wxListView, so I have to handle wxEVT_COMMAND_LIST_ITEM_SELECTED.
Now, all I need is documentation, but CC parser doesn't recognize them. Maybe parser should read xml generated by doxygen?
parsing comments in CC:
pros:
- builtin
- realtime parsing
cons:
- not implemented
reading from xml:
pros:
- xml is easy to read
- can read external documentation( user will only specify patches to it)
cons:
- user must have already generated docs
What you think, what will be better?
ollydbg:
--- Quote ---So I had to go deeper and I find that wxxcintilla doesn't use wxListBox but wxListView, so I have to handle wxEVT_COMMAND_LIST_ITEM_SELECTED.
--- End quote ---
Good, well done!
--- Quote from: p2rkw on December 05, 2012, 07:17:25 pm ---Now, all I need is documentation, but CC parser doesn't recognize them. Maybe parser should read xml generated by doxygen?
parsing comments in CC:
pros:
- builtin
- realtime parsing
cons:
- not implemented
reading from xml:
pros:
- xml is easy to read
- can read external documentation( user will only specify patches to it)
cons:
- user must have already generated docs
What you think, what will be better?
--- End quote ---
I prefer enhance the CodeCompletion plugin. Currently, all the c/c++ style comments were skipped in the Tokenizer. What I think is: add some kind of comment parser which is independent from the normal c/c++ parser. Use the comment parser to find the comments "around" the Token. Because we have the file/line information in each Token, when we try to show the documents of a specific Token, we can let the comment parser to parse the code snippet around the Token position, and show the comments.
As a conclusion, the comment parser only runs when it needed. :)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version