Patch #3381 2012-11-30 14:18

p2rkw

CC,autocomplete: added argument's names and types to list
Download
3381-CC_autocomplet.patch (160.3 KB)
Category
Plugin::Refinement
Status
Accepted
Close date
2013-03-09 14:24
Assigned to
mortenmacfly
Index: src/CodeBlocks-unix.cbp
===================================================================
--- src/CodeBlocks-unix.cbp    (wersja 8785)
+++ src/CodeBlocks-unix.cbp    (kopia robocza)
@@ -1196,6 +1199,12 @@
         <Unit filename="plugins/codecompletion/coderefactoring.h">
             <Option target="Code-completion" />
         </Unit>
+        <Unit filename="plugins/codecompletion/doxygen_parser.cpp">
+            <Option target="Code-completion" />
+        </Unit>
+        <Unit filename="plugins/codecompletion/doxygen_parser.h">
+            <Option target="Code-completion" />
+        </Unit>
         <Unit filename="plugins/codecompletion/insertclassmethoddlg.cpp">
             <Option target="Code-completion" />
         </Unit>
Index: src/CodeBlocks.cbp
===================================================================
--- src/CodeBlocks.cbp    (wersja 8785)
+++ src/CodeBlocks.cbp    (kopia robocza)
@@ -1457,6 +1457,12 @@
         <Unit filename="plugins/codecompletion/coderefactoring.h">
             <Option target="Code-completion" />
         </Unit>
+        <Unit filename="plugins/codecompletion/doxygen_parser.cpp">
+            <Option target="Code-completion" />
+        </Unit>
+        <Unit filename="plugins/codecompletion/doxygen_parser.h">
+            <Option target="Code-completion" />
+        </Unit>
         <Unit filename="plugins/codecompletion/insertclassmethoddlg.cpp">
             <Option target="Code-completion" />
         </Unit>
Index: src/plugins/abbreviations/abbreviations.cpp
===================================================================
--- src/plugins/abbreviations/abbreviations.cpp    (wersja 8785)
+++ src/plugins/abbreviations/abbreviations.cpp    (kopia robocza)
@@ -198,6 +198,7 @@
             control->RegisterImage(0, wxBitmap(abbrev_xpm));
             items.Sort();
             wxString itemsStr = GetStringFromArray(items, _T(" "));
+            control->AutoCompSetSeparator(_T(' '));
             control->AutoCompShow(endPos-startPos, itemsStr);
         }
         m_IsAutoCompVisible = control->AutoCompActive();
Index: src/plugins/codecompletion/ccoptionsdlg.cpp
===================================================================
--- src/plugins/codecompletion/ccoptionsdlg.cpp    (wersja 8785)
+++ src/plugins/codecompletion/ccoptionsdlg.cpp    (kopia robocza)
@@ -35,6 +35,7 @@
 
 #include "ccoptionsdlg.h"
 #include "codecompletion.h"
+#include "doxygen_parser.h" // For DocumentationHelper
 
 static const wxString g_SampleClasses =
     _T("class A_class"
@@ -82,12 +83,16 @@
     EVT_BUTTON(XRCID("btnDelRepl"),         CCOptionsDlg::OnDelRepl)
     EVT_BUTTON(XRCID("btnColour"),          CCOptionsDlg::OnChooseColour)
     EVT_COMMAND_SCROLL(XRCID("sldCCDelay"), CCOptionsDlg::OnCCDelayScroll)
+    EVT_BUTTON(XRCID("btnDocBgColor"),      CCOptionsDlg::OnChooseColour)
+    EVT_BUTTON(XRCID("btnDocTextColor"),    CCOptionsDlg::OnChooseColour)
+    EVT_BUTTON(XRCID("btnDocLinkColor"),    CCOptionsDlg::OnChooseColour)
 END_EVENT_TABLE()
 
-CCOptionsDlg::CCOptionsDlg(wxWindow* parent, NativeParser* np, CodeCompletion* cc) :
+CCOptionsDlg::CCOptionsDlg(wxWindow* parent, NativeParser* np, CodeCompletion* cc, DocumentationHelper* dh) :
     m_NativeParser(np),
     m_CodeCompletion(cc),
-    m_Parser(np->GetParser())
+    m_Parser(np->GetParser()),
+    m_Documentation(dh)
 {
     ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("code_completion"));
 
@@ -102,6 +107,7 @@
     XRCCTRL(*this, "chkEvalTooltip",        wxCheckBox)->SetValue(cfg->ReadBool(_T("/eval_tooltip"),         true));
     XRCCTRL(*this, "chkAutoSelectOne",      wxCheckBox)->SetValue(cfg->ReadBool(_T("/auto_select_one"),      false));
     XRCCTRL(*this, "chkAutoAddParentheses", wxCheckBox)->SetValue(cfg->ReadBool(_T("/auto_add_parentheses"), true));
+    XRCCTRL(*this, "chkDetectImpl",         wxCheckBox)->SetValue(cfg->ReadBool(_T("/detect_implementation"),false));
     XRCCTRL(*this, "chkAddDoxgenComment",   wxCheckBox)->SetValue(cfg->ReadBool(_T("/add_doxgen_comment"),   false));
     XRCCTRL(*this, "chkEnableHeaders",      wxCheckBox)->SetValue(cfg->ReadBool(_T("/enable_headers"),       true));
     XRCCTRL(*this, "chkAutoLaunch",         wxCheckBox)->SetValue(cfg->ReadBool(_T("/auto_launch"),          true));
@@ -172,6 +178,13 @@
     XRCCTRL(*this, "chkInheritance",        wxCheckBox)->SetValue(m_Parser.ClassBrowserOptions().showInheritance);
     XRCCTRL(*this, "chkExpandNS",           wxCheckBox)->SetValue(m_Parser.ClassBrowserOptions().expandNS);
     XRCCTRL(*this, "chkTreeMembers",        wxCheckBox)->SetValue(m_Parser.ClassBrowserOptions().treeMembers);
+    
+    //Page Documentation
+    XRCCTRL(*this, "chkDocumentation",      wxCheckBox)->SetValue(m_Documentation->Options().m_Enabled);
+    XRCCTRL(*this, "chkDocPopupAlways",     wxCheckBox)->SetValue(m_Documentation->Options().m_ShowAlways);
+    XRCCTRL(*this, "btnDocBgColor",     wxButton)->SetBackgroundColour
download for full patch...
p2rkw 2012-11-30 16:51

tmp << _T(": ") << token->m_BaseType;

changed to:

tmp << _T(": ") << token->m_FullType;

mortenmacfly 2012-12-13 15:41

After having played with this: I think the default should not insert these arguments. In 90 percent of the cases you remove them afterwards, so its not helpful but more a pain. (Or, I may miss an important feature).

However, combined with a accelerator it is useful. Maybe that is possible? And if, could you also remove the types? I am thinking of the use case, where you typically name variables as they are required by an API like:

int index = 1;

std::string s_name = "Name"

// API call to: MyMethod(int index, std::string s_name)

MyMethod(

-> completes to:

MyMethod(index, s_name);

To make is more complex maybe only in there are two (local) variables with that name exist.

Please also for a patch start a topic in the forums for such discussion.

mortenmacfly 2012-12-14 17:58

Ooops - it seems additionally this patch does not apply anymore on trunk.

But it seems superseded by your other patch anyways as you have written here:

http://forums.codeblocks.org/index.php/topic,17146.msg118182.html#msg118182

What to do???

ID_100 2012-12-14 18:10

That true that default argument names are usually removed, but they are selected, so following code:

MyMeth|

will complete to:

MyMethod(index,s_name)

//...............^^^^^^^^^ - and those names will be selected, so you can start typing desired names as same like after normal complete:

MyMethod(|)

Arguments names usually describes their meaning.

I thought it will be helpful see them. If you really don't like it I can change this behaviour in revised patch.

ID_100 2012-12-14 18:12

>What to do???

When I finish help viewer I will sync it to trunk.

mortenmacfly 2012-12-14 19:36

OK nice. Nag me once you have news...

tpetrov 2012-12-28 21:55

Please update this patch, because I can't test it on newer revs...

mortenmacfly 2013-01-13 23:05

Sorry, but something is wrong with the patch - it does not apply.

Line 3728 reads:

\ Brak znaku nowej linii na końcu pliku

...this is unreadable and not patch conform.

Did you really use svn diff > my-patch to create the patch?

p2rkw 2013-01-13 23:42

>Did you really use svn diff > my-patch to create the patch?

Yes, of course. I saw this line, but I thought it will be ignored. I applied this patch few times under windows and linux and there was no errors (svn 1.7.7 and 1.7.8).

I removed this line, and successfully applied modified patch under windows. Can you test it now?

p2rkw 2013-01-14 00:24

I just removed unwanted chunks.

mortenmacfly 2013-01-14 16:01

Works now... thanks! I'll do testing - others are welcome to join!