Author Topic: New code completion remarks/issues  (Read 157619 times)

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5277
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #210 on: October 31, 2009, 04:14:48 pm »
Quote
At this time, we don't need to rebuild the tree again.
hi,ollydbg:
The contexts in C:\BBB\AAA.cpp are different from C:\BBB\AAA.h,why we don't need to rebuild the tree again?
At this time, we get the same browser tree, if you select "current file's token" in browser view.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #211 on: November 01, 2009, 03:18:43 am »
when the parse is done ,the UpdateClassBrowser(); will be called in void NativeParser::OnParserEnd(wxCommandEvent& event)
at this time ,some token maybe has been changed.So the tree should be rebuilt.
and in the situation you mentioned.yes,it don't need be rebuilt.But how do we distinguish these , need or not.


by the way,ollydbg,have you encounter this issue.http://forums.codeblocks.org/index.php/topic,11432.0.html
« Last Edit: November 01, 2009, 03:20:42 am by blueshake »
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5277
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #212 on: November 02, 2009, 10:18:02 am »
Here is another bug.

See the screen shot:



And the test code:

Code: [Select]
#include <iostream>

using namespace std;

int variableA;

int main()
{
    int variableA;
    variableA = 1;
    cout << "Hello world!" << endl;
    return 0;
}

Both the auto variable in main and global variable will be shown together.

This is because:

1, the global variable "variableA" was already exist in the Token trie.
2, the auto variable "variableA" was added when parsing the function block.

So, my suggestion is:

Search the local tokens first. I mean, if we find a token is already exist in the local context, we don't need to search the global namespace.

This can make code completion more fast.


If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12911
    • Travis build status
Re: New code completion remarks/issues
« Reply #213 on: November 02, 2009, 10:24:46 am »
Hm, Olly having both in the tooltip can be quite helpful.
If for example the tooltip looks like this:

global int variableA
local int variableA

or
int ::variableA
int variableA
int my_namespace::variableA
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #214 on: November 02, 2009, 11:29:36 am »
Hm, Olly having both in the tooltip can be quite helpful.
If for example the tooltip looks like this:

global int variableA
local int variableA

or
int ::variableA
int variableA
int my_namespace::variableA

should be easy to do this.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #215 on: November 02, 2009, 11:47:26 am »
Hm, Olly having both in the tooltip can be quite helpful.
If for example the tooltip looks like this:

global int variableA
local int variableA

or
int ::variableA
int variableA
int my_namespace::variableA



Patch for doing this.
Code: [Select]
Index: src/plugins/codecompletion/parser/token.cpp
===================================================================
--- src/plugins/codecompletion/parser/token.cpp (revision 5894)
+++ src/plugins/codecompletion/parser/token.cpp (working copy)
@@ -136,6 +136,10 @@
 wxString Token::DisplayName() const
 {
     wxString result;
+    if (m_IsTemp)
+        result << _T("local ");
+    else
+        result << _T("global ");
     if      (m_TokenKind == tkClass)
         return result << _T("class ")     << m_Name << _T(" {...}");
     else if (m_TokenKind == tkNamespace)
see the screen shot.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline jaxon

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: New code completion remarks/issues
« Reply #216 on: November 02, 2009, 01:06:04 pm »
Sorry, but it seems for me, that we need only variable used by compiler in current context to be shown in the tooltip. And yes, as ollydbg said, it should be faster.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5277
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #217 on: November 02, 2009, 03:54:11 pm »
Hi, all, I personally agree with jaxon.

I have debug the code whole day :(, and finally find that this is a bug in the code below:

Code: [Select]
bool NativeParser::ParseLocalBlock(cbEditor* ed, int caretPos)
{
    if (!ed)
        return false;

    Parser* parser = FindParserFromEditor(ed);
    if (!parser)
        return false;

    if (!parser->Done())
        return false;

    if (s_DebugSmartSense)
        Manager::Get()->GetLogManager()->DebugLog(_T("Parse local block"));

    int blockStart = FindCurrentFunctionStart(ed, 0, 0, caretPos);
    if (blockStart != -1)
    {
        ++blockStart; // skip {
        int blockEnd = caretPos == -1 ? ed->GetControl()->GetCurrentPos() : caretPos;
        if (blockEnd < 0 || blockEnd > ed->GetControl()->GetLength())
            return false;

        if (blockStart >= blockEnd)
            blockStart = blockEnd;

        wxString buffer = ed->GetControl()->GetTextRange(blockStart, blockEnd);
        buffer.Trim();
        if (!buffer.IsEmpty() && !parser->ParseBuffer(buffer, false, false, true))
        {
            if (s_DebugSmartSense)
                Manager::Get()->GetLogManager()->DebugLog(_T("ERROR parsing block:\n") + buffer);
        }
        else
        {
            if (s_DebugSmartSense)
            {
                #if wxCHECK_VERSION(2, 9, 0)
                Manager::Get()->GetLogManager()->DebugLog(F(_T("Block:\n%s"), buffer.wx_str()));
                #else
                Manager::Get()->GetLogManager()->DebugLog(F(_T("Block:\n%s"), buffer.c_str()));
                #endif
                Manager::Get()->GetLogManager()->DebugLog(_T("Local tokens:"));
                for (size_t i = 0; i < parser->GetTokens()->size(); ++i)
                {
                    Token* t = parser->GetTokens()->at(i);
                    if (t && t->m_IsTemp)
                        Manager::Get()->GetLogManager()->DebugLog(_T(" + ") + t->DisplayName());
                }
            }
            return true;
        }
    }
    else
    {
        if (s_DebugSmartSense)
            Manager::Get()->GetLogManager()->DebugLog(_T("Could not determine current block start..."));
    }
    return false;
}

for example, at this time( see my example code), the LocalBlock is the function body of main to the current caret:

Code: [Select]
int variableA;
    variableA = 1;

After parsing the buffer, the parser mistakenly added the local variableA to the global namespace.. I think the correct way should be :
set the the local variableA's parent as Token "main" (not the global namespace).

Also, there is another issue in these code:

nativeparser.cpp line 1597:

Code: [Select]
   // always add scope -1 (i.e. global namespace)
    search_scope->insert(-1);

    // find all other matches
    std::queue<ParserComponent> components;
    BreakUpComponents(parser, actual, components);

    m_LastAISearchWasGlobal = components.size() <= 1;
    if (!components.empty())
        m_LastAIGlobalSearch = components.front().component;

    // actually find all matches in selected namespaces
    for (TokenIdxSet::iterator it = search_scope->begin(); it != search_scope->end(); ++it)
    {
        if (s_DebugSmartSense)
        {
            Token* scopeToken = tree->at(*it);
            #if wxCHECK_VERSION(2, 9, 0)
            Manager::Get()->GetLogManager()->DebugLog(F(_T("Parent scope: '%s' (%d)"), scopeToken ? scopeToken->m_Name.wx_str() : _T("Global namespace"), *it));
            #else
            Manager::Get()->GetLogManager()->DebugLog(F(_T("Parent scope: '%s' (%d)"), scopeToken ? scopeToken->m_Name.c_str() : _T("Global namespace"), *it));
            #endif
        }
        FindAIMatches(parser, components, result, *it, noPartialMatch, caseSensitive, true, 0xffff, search_scope);
    }

    cached_editor = editor;
    if (result.size() || (m_EditorEndWord - m_EditorStartWord))
        cached_editor_start_word = m_EditorStartWord;
    cached_search = actual;
    cached_results_count = result.size();

    return result.size();
}


In the code above, the "global namespace" is added by default. I don't think is is necessary, I personally use this method

1, check the result.size() at the end of AI()
2, if the result.size is zero, we should add the global namespace, and do the FindAIMatches() in the global namespace.

In this way, if the token is already found in the local context or matches as a class members, we don't need to use global namespace search.

By the way, the AI() function( and the related functions to do the show the tips) code is really hard to read!!!, that's irradiated me so much!!! :(, I think we should refactor it, especially change the variable names.
« Last Edit: November 02, 2009, 04:03:41 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: New code completion remarks/issues
« Reply #218 on: November 02, 2009, 09:45:20 pm »
Hm, Olly having both in the tooltip can be quite helpful.
Definitely. Look: Naming a local variable like a global one is bad style. Surely you might forget this sometimes but if the tooltip reminds you accordingly this is just helpful. So please don't strip this (really useful) information. Not even for the sake of speed.
I agree (however) with displayinf this with a "global/local" prefix.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5277
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #219 on: November 10, 2009, 02:11:12 pm »
Hi, all, here, I announce this patch of the code completion plugin.

Some time, when you are debugging, both the GDB value tips and CC's tips window will pop up, and overlayed. That's very annoying. The currently method try to close the tip window, when the new tip will be shown, the GDB's tip always shown later, so, GDB's tip always force the CC's tip to close, and win the battle. :D


Edit1
Sorry, When adding the patch, my computer hangs. So, here is the patch:

Code: [Select]
Index: codecompletion.cpp
===================================================================
--- codecompletion.cpp (revision 5908)
+++ codecompletion.cpp (working copy)
@@ -112,25 +112,26 @@
 // just because we don't know other plugins' used identifiers,
 // we use wxNewId() to generate a guaranteed unique ID ;), instead of enum
 // (don't forget that, especially in a plugin)
-int idMenuCodeComplete = wxNewId();
-int idMenuShowCallTip = wxNewId();
-int idMenuGotoFunction = wxNewId();
-int idMenuGotoPrevFunction = wxNewId();
-int idMenuGotoNextFunction = wxNewId();
-int idMenuGotoDeclaration = wxNewId();
-int idMenuGotoImplementation = wxNewId();
-int idMenuOpenIncludeFile = wxNewId();
-int idViewClassBrowser = wxNewId();
-int idEditorSubMenu = wxNewId();
-int idClassMethod = wxNewId();
+int idMenuCodeComplete          = wxNewId();
+int idMenuShowCallTip           = wxNewId();
+int idMenuGotoFunction          = wxNewId();
+int idMenuGotoPrevFunction      = wxNewId();
+int idMenuGotoNextFunction      = wxNewId();
+int idMenuGotoDeclaration       = wxNewId();
+int idMenuGotoImplementation    = wxNewId();
+int idMenuOpenIncludeFile       = wxNewId();
+int idViewClassBrowser          = wxNewId();
+int idEditorSubMenu             = wxNewId();
+int idClassMethod               = wxNewId();
 int idUnimplementedClassMethods = wxNewId();
-int idGotoDeclaration = wxNewId();
-int idGotoImplementation = wxNewId();
-int idOpenIncludeFile = wxNewId();
-int idStartParsingProjects = wxNewId();
-int idCodeCompleteTimer = wxNewId();
-int idFunctionsParsingTimer = wxNewId();
+int idGotoDeclaration           = wxNewId();
+int idGotoImplementation        = wxNewId();
+int idOpenIncludeFile           = wxNewId();
+int idStartParsingProjects      = wxNewId();
+int idCodeCompleteTimer         = wxNewId();
+int idFunctionsParsingTimer     = wxNewId();
 
+
 // milliseconds
 #define EDITOR_AND_LINE_INTERVAL 150
 
@@ -193,8 +194,14 @@
 
     if (!cfg->Exists(_T("token_replacements")))
     {
-        // first run; add default replacements
+        // first run; add default replacements string
         Tokenizer::SetReplacementString(_T("_GLIBCXX_STD"), _T("std"));
+        Tokenizer::SetReplacementString(_T("_GLIBCXX_BEGIN_NESTED_NAMESPACE"), _T("+namespace"));
+        Tokenizer::SetReplacementString(_T("_GLIBCXX_END_NESTED_NAMESPACE"), _T("}"));
+        Tokenizer::SetReplacementString(_T("_GLIBCXX_BEGIN_NAMESPACE"), _T("+namespace"));
+        Tokenizer::SetReplacementString(_T("_GLIBCXX_END_NAMESPACE_TR1"), _T("}"));
+        Tokenizer::SetReplacementString(_T("_GLIBCXX_BEGIN_NAMESPACE_TR1"), _T("-namespace tr1 {"));
+
     }
     else
         cfg->Read(_T("token_replacements"), &repl);
@@ -522,9 +529,10 @@
     if (!IsAttached() || !m_InitDone)
         return -1;
 
-    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("code_completion"));
+    ConfigManager* cfg   = Manager::Get()->GetConfigManager(_T("code_completion"));
     EditorManager* edMan = Manager::Get()->GetEditorManager();
-    cbEditor* ed = edMan->GetBuiltinActiveEditor();
+    cbEditor* ed         = edMan->GetBuiltinActiveEditor();
+
     if (!ed)
         return -3;
 
@@ -554,7 +562,8 @@
             ed->GetControl()->ClearRegisteredImages();
 
             bool caseSens = parser ? parser->Options().caseSensitive : false;
-            wxArrayString items; items.Alloc(result.size());
+            wxArrayString items;
+            items.Alloc(result.size());
             int pos   = ed->GetControl()->GetCurrentPos();
             int start = ed->GetControl()->WordStartPosition(pos, true);
             wxArrayInt already_registered;
@@ -748,6 +757,8 @@
     return dirs;
 }
 
+// Do the code completion when we enter:
+// #include "| or #include <|
 void CodeCompletion::CodeCompleteIncludes()
 {
     if (!IsAttached() || !m_InitDone)
@@ -758,20 +769,22 @@
         return;
 
     EditorManager* edMan = Manager::Get()->GetEditorManager();
-    cbEditor* ed = edMan->GetBuiltinActiveEditor();
+    cbEditor* ed         = edMan->GetBuiltinActiveEditor();
+
     if (!ed)
         return;
 
-    Parser* parser = m_NativeParser.FindParserFromActiveEditor();
+    Parser* parser      = m_NativeParser.FindParserFromActiveEditor();
     const bool caseSens = parser ? parser->Options().caseSensitive : false;
 
     FileType ft = FileTypeOf(ed->GetShortName());
     if ( ft != ftHeader && ft != ftSource) // only parse source/header files
         return;
 
-    int pos = ed->GetControl()->GetCurrentPos();
+    int pos          = ed->GetControl()->GetCurrentPos();
     int lineStartPos = ed->GetControl()->PositionFromLine(ed->GetControl()->GetCurrentLine());
-    wxString line = ed->GetControl()->GetLine(ed->GetControl()->GetCurrentLine());
+    wxString line    = ed->GetControl()->GetLine(ed->GetControl()->GetCurrentLine());
+
     //Manager::Get()->GetLogManager()->DebugLog("#include cc for \"%s\"", line.c_str());
     line.Trim();
     if (line.IsEmpty() || !TestIncludeLine(line))
@@ -784,6 +797,7 @@
         return;
     ++quote_pos;
 
+    // now, we are after the quote prompt
     wxString filename = line.substr(quote_pos, pos - lineStartPos - quote_pos);
     filename.Replace(_T("\\"), _T("/"), true);
 
@@ -823,6 +837,7 @@
         }
     }
 
+    // popup the auto completion window
     if (files.GetCount() != 0)
     {
         files.Sort();
@@ -872,11 +887,12 @@
         // else, out of range
     }
 
-    int start = 0;
-    int end = 0;
-    int count = 0;
-    int commas = m_NativeParser.GetCallTipCommas(); // how many commas has the user typed so far?
+    int start           = 0;
+    int end             = 0;
+    int count           = 0;
+    int commas          = m_NativeParser.GetCallTipCommas(); // how many commas has the user typed so far?
     wxArrayString items = m_NativeParser.GetCallTips(maxCalltipLineSizeInChars);
+
     std::set< wxString, std::less<wxString> > unique_tips; // check against this before inserting a new tip in the list
     wxString definition;
     for (unsigned int i = 0; i < items.GetCount(); ++i)
@@ -923,8 +939,11 @@
     }
 
     wxString filename = ed->GetFilename();
+
+    // open the insert class dialog
     InsertClassMethodDlg dlg(Manager::Get()->GetAppWindow(), parser, filename);
     PlaceWindow(&dlg);
+
     if (dlg.ShowModal() == wxID_OK)
     {
         int pos = ed->GetControl()->GetCurrentPos();
@@ -1565,6 +1584,30 @@
         if (!Manager::Get()->GetConfigManager(_T("code_completion"))->ReadBool(_T("eval_tooltip"), true))
             return;
 
+
+        // Check the debugger is running...at this time, don't show cc tips
+        bool debuggerRunning = false;
+        PluginsArray arr = Manager::Get()->GetPluginManager()->GetOffersFor(ptDebugger);
+        if (arr.GetCount())
+        {
+            for(size_t i=0;i<arr.GetCount();i++)
+            {
+                cbDebuggerPlugin* debugger = (cbDebuggerPlugin*)arr[i];
+                if (!debugger)
+                    continue; //kinda scary if this isn't a debugger? perhaps this should be a logged error??
+                if (debugger->IsRunning())
+                {
+                    debuggerRunning=true;
+                    break;
+                }
+            }
+        }
+        if(debuggerRunning)
+        {
+            Manager::Get()->GetLogManager()->DebugLog(F(_T("debugger is running, skip.CC tips..")));
+            return;
+        }
+
         EditorBase* base = event.GetEditor();
         cbEditor* ed = base && base->IsBuiltinEditor() ? static_cast<cbEditor*>(base) : 0;
         if (!ed || ed->IsContextMenuOpened())


I just check if any debugger plugin was running, then, CC's tip should not been shown.

Edit2

I just use the aligner plugin to format some code.


« Last Edit: November 10, 2009, 02:45:28 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5277
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #220 on: November 10, 2009, 02:50:43 pm »
hi, all, here is another patch.

I have always compaint this bug, when the bottom tree was rebuild, the navigate position always go the the bottom of the tree. That means, the vertical scroll bar will always go the bottom of the window, so, the "private member tree items" always been shown, because they were under the "public member tree items".
see this post:
http://forums.codeblocks.org/index.php/topic,10693.0.html

In this patch, I just "remember" the first tree item, and force a navigation when the tree been built.

Code: [Select]
Index: classbrowserbuilderthread.cpp
===================================================================
--- classbrowserbuilderthread.cpp (revision 5908)
+++ classbrowserbuilderthread.cpp (working copy)
@@ -780,22 +780,29 @@
 #ifdef buildtree_measuring
     wxStopWatch sw;
 #endif
+
         tree->Freeze();
+
+
 #ifdef buildtree_measuring
     Manager::Get()->GetLogManager()->DebugLog(F(_T("tree->Freeze() took : %d ms"),sw.Time()));
     sw.Start();
 #endif
+
         tree->DeleteAllItems();
 #ifdef buildtree_measuring
     Manager::Get()->GetLogManager()->DebugLog(F(_T("tree->DeleteAllItems() took : %d ms"),sw.Time()));
     sw.Start();
 #endif
+
         node = tree->AddRoot(_T("Members")); // not visible, so don't translate
+
 #ifdef buildtree_measuring
     Manager::Get()->GetLogManager()->DebugLog(F(_T("tree->AddRoot() took : %d ms"),sw.Time()));
 #endif
     }
 
+    wxTreeItemId firtItem;
     if (data)
     {
         switch (data->m_SpecialFolder)
@@ -819,6 +826,8 @@
                         AddChildrenOf(tree, rootFuncs, data->m_pToken->GetSelf(), tkFunction);
                         AddChildrenOf(tree, rootVars, data->m_pToken->GetSelf(), tkVariable);
                         AddChildrenOf(tree, rootOthers, data->m_pToken->GetSelf(), ~(tkNamespace | tkClass | tkEnum | tkAnyFunction | tkVariable));
+                        firtItem = rootCtorDtor;
+
                     }
                     else if (m_Options.sortType == bstScope && data->m_pToken->m_TokenKind & tkClass)
                     {
@@ -829,6 +838,9 @@
                         AddChildrenOf(tree, rootPublic, data->m_pToken->GetSelf(), ~(tkNamespace | tkClass | tkEnum), tsPublic);
                         AddChildrenOf(tree, rootProtected, data->m_pToken->GetSelf(), ~(tkNamespace | tkClass | tkEnum), tsProtected);
                         AddChildrenOf(tree, rootPrivate, data->m_pToken->GetSelf(), ~(tkNamespace | tkClass | tkEnum), tsPrivate);
+
+                        firtItem = rootPublic;
+
                     }
                     else
                     {
@@ -866,7 +878,19 @@
     if (bottom)
     {
         tree->ExpandAll();
+////        if(tree->GetRootItem())
+//        tree->EnsureVisible(tree->GetRootItem());
+        //tree->EnsureVisible(node);
+        if(firtItem.IsOk())
+        {
+            tree->ScrollTo(firtItem);
+            tree->EnsureVisible(firtItem);
+        }
         tree->Thaw();
+        //we should scrool to the first item!!
+//        wxTreeItemIdValue cookie;
+//        wxTreeItemId res = tree->GetFirstChild(start, cookie);
+
     }
 }
 


If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5277
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #221 on: November 10, 2009, 04:23:38 pm »
This is the third patch.  I just add one major check,

Code: [Select]
void NativeParser::OnEditorActivated(EditorBase* editor)
{
    if (!m_pClassBrowser)
        return;
    cbEditor* ed = editor && editor->IsBuiltinEditor() ? static_cast<cbEditor*>(editor) : 0;

//    cbEditor* ed = editor ? static_cast<cbEditor*>(editor) : 0;
//    EditorManager* edMan = Manager::Get()->GetEditorManager();
//    cbEditor* ed         = edMan->GetBuiltinActiveEditor();

    if (ed)
    {
        Parser* parser = FindParserFromEditor(ed);
        if (parser && parser->ClassBrowserOptions().displayFilter == bdfFile)
        {
            // check header and implementation file swap, if yes, don't need to rebuild browser tree
            m_pClassBrowser->UpdateView(true);  ***************here
        }
    }
}

I modify the UpdateView function prototype,  void UpdateView(bool checkHeaderSwap = false);
Which means, if we do the editor change, that is eg: c:/abc.h  to c:/abc.cpp, we don't need to rebuild the Browser tree.

also, a lot of c_str() function and wxWidgets version check macros have been removed, since using wx_str() is enough.



[attachment deleted by admin]
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5277
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #222 on: November 10, 2009, 04:32:24 pm »
I'm trying to document the parserthread.h. here is the patch to do this, some function prototypes were not described due to my little knowledge and English written ability. :(

I'd prefer some one can supplement this and help me. :D



[attachment deleted by admin]
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: New code completion remarks/issues
« Reply #223 on: November 10, 2009, 04:56:18 pm »
Hi, all, here, I announce this patch of the code completion plugin.
I am not sure about this one...
I am using CC in fact while debugging and this would not let me.

hi, all, here is another patch.
This is the third patch.  I just add one major check,
I'm trying to document the parserthread.h.
Those three are looking good  to me. I've applied them  in my local copy for testing... (where appropriate).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Online ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5277
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #224 on: December 01, 2009, 05:03:30 pm »
I'm so grad that several patches of visualfc and blueshake and mine has been tested and finally applied in the trunk. But it seems the documents are not so good, so, I will prepare another patch to fix some "bad or missing documents". :D

Currently, the latest trunk code has broken parsing the OpenCV prototype correctly. because in the OpenCV source code ,there are some statement like this:

Code: [Select]
CVAPI(void) cvFunction(XXXXX);

The new CC will regard the statement as two tokens, one is "CVAPI(void)", and the other is "cvFunction(XXXXX)", so, I'm not satisfied with this, maybe, I need to implement a macro replacement rule for the "CVAPI" macro. :wink:

By the way, I think this thread should be moved to CodeCompletion redesign sub-forum, because people here are all talking about the patches and the new CC features.

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.