News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Please let CC to support the global namepace

Started by Loaden, January 06, 2010, 10:39:41 AM

Previous topic - Next topic

Loaden

#include <iostream>
#include <windows.h>

using namespace std;

int main()
{
   ::Mess // HERE,no-work. if not use global namespace, it's work fine.
   return 0;
}

I try to add a rule, and adding this rules, and CB not start now.
<::>
<![CDATA[]]>
</::>

blueshake

Patch for it. :D
Index: src/plugins/codecompletion/nativeparser.cpp
===================================================================
--- src/plugins/codecompletion/nativeparser.cpp (revision 6089)
+++ src/plugins/codecompletion/nativeparser.cpp (working copy)
@@ -1638,9 +1638,9 @@
             }
             Manager::Get()->GetLogManager()->DebugLog(F(_T("BreakUpComponents() Found component: '%s' (%s)"), tok.wx_str(), tokenTypeString.wx_str()));
         }
+        if (tok.Length() != 0 || tokenType == pttSearchText)
+            components.push(pc);

-        components.push(pc);
-
         if (tokenType == pttSearchText)
             break;
     }



see the screen shot.
welcome to test it.

[attachment deleted by admin]
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?

Loaden

Yes, it works well Thank you very much!
But there is a small problem, see the picture prompts.


[attachment deleted by admin]

Loaden

All other tests are good.

[attachment deleted by admin]

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?

MortenMacFly

Quote from: blueshake on January 17, 2010, 08:02:23 AM
Patch for it. :D
[...]
welcome to test it.
Nice one. Can you do me a favor (for the future) and comment such changes? It's not very clear in the first place what the if statement actually means. Thanks! :-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

MortenMacFly

Quote from: Loaden on January 06, 2010, 10:39:41 AM
I try to add a rule, and adding this rules, and CB not start now.
<::>
<![CDATA[]]>
</::>

You do know how often "::" appears in C++ code (e.g. MyClass::MyMethod)?! ;-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

blueshake

well.

it mean nothing if the tokenType  is not pttSearchText.

for example:

for global codecompletion,such codes:

::abc

when we type these codes,the search will break the texts(::abc) into two compesents.

one is "" ,type is pttNameSpace
another is "abc" ,type is pttSearchText.

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?

blueshake

#8
continue my comment.

so for pttNameSpace type ,if its text(tok) is empty.we need to eat this component.that is why the statement  tok.Length() != 0 in the if condition.
but for pttSearchText type ,we can not do this.because for such search codes(ss:: ),so we need another statement tokenType == pttSearchText in the if condition too.
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?

ollydbg

Quote from: blueshake on January 18, 2010, 02:48:08 AM
continue my comment.

so for pttNameSpace type ,if its text(tok) is empty.we need to eat this component.that is why the statement  tok.Length() != 0 in the if condition.
but for pttSearchText type ,we can do this.because for such search codes(ss::),so we need another statement tokenType == pttSearchText in the if condition too.
So, you mean: if we breakUP this statement"::abc".
We should result only One ParserComponent. right?
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.

blueshake

yes,only abc should be keeped.so the cc will work like global search.
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?

blueshake

@Loaden

can you try this patch and give me feedback?

Is  this issue still there?

QuoteBut there is a small problem, see the picture prompts.

patch:
Index: src/plugins/codecompletion/nativeparser.cpp
===================================================================
--- src/plugins/codecompletion/nativeparser.cpp (revision 6089)
+++ src/plugins/codecompletion/nativeparser.cpp (working copy)
@@ -1638,9 +1638,9 @@
             }
             Manager::Get()->GetLogManager()->DebugLog(F(_T("BreakUpComponents() Found component: '%s' (%s)"), tok.wx_str(), tokenTypeString.wx_str()));
         }
+        if (!tok.IsEmpty() || (tokenType == pttSearchText && components.size() != 0))
+            components.push(pc);

-        components.push(pc);
-
         if (tokenType == pttSearchText)
             break;
     }
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?

Loaden

Quote from: blueshake on January 18, 2010, 04:20:51 AM
@Loaden

can you try this patch and give me feedback?

Is  this issue still there?

QuoteBut there is a small problem, see the picture prompts.

patch:
Index: src/plugins/codecompletion/nativeparser.cpp
===================================================================
--- src/plugins/codecompletion/nativeparser.cpp (revision 6089)
+++ src/plugins/codecompletion/nativeparser.cpp (working copy)
@@ -1638,9 +1638,9 @@
             }
             Manager::Get()->GetLogManager()->DebugLog(F(_T("BreakUpComponents() Found component: '%s' (%s)"), tok.wx_str(), tokenTypeString.wx_str()));
         }
+        if (!tok.IsEmpty() || (tokenType == pttSearchText && components.size() != 0))
+            components.push(pc);

-        components.push(pc);
-
         if (tokenType == pttSearchText)
             break;
     }

It's OK now! perfect!

[attachment deleted by admin]

blueshake

Quote from: blueshake on January 18, 2010, 04:20:51 AM
@Loaden

can you try this patch and give me feedback?

Is  this issue still there?

QuoteBut there is a small problem, see the picture prompts.

patch:
Index: src/plugins/codecompletion/nativeparser.cpp
===================================================================
--- src/plugins/codecompletion/nativeparser.cpp (revision 6089)
+++ src/plugins/codecompletion/nativeparser.cpp (working copy)
@@ -1638,9 +1638,9 @@
             }
             Manager::Get()->GetLogManager()->DebugLog(F(_T("BreakUpComponents() Found component: '%s' (%s)"), tok.wx_str(), tokenTypeString.wx_str()));
         }
+        if (!tok.IsEmpty() || (tokenType == pttSearchText && components.size() != 0))
+            components.push(pc);

-        components.push(pc);
-
         if (tokenType == pttSearchText)
             break;
     }





@morten

seems you don't apply this patch correctly,so in current cc, when you type "(" ,cc will give a lot of wrong tips.can you check 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?

MortenMacFly

Quote from: blueshake on May 01, 2010, 06:15:57 AM
seems you don't apply this patch correctly,so in current cc, when you type "(" ,cc will give a lot of wrong tips.can you check this??
Work fine here...?! What exactly do you mean? Remember that this is just for global namespace. IIRC we had discussed this. So that's why it is as it is now.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]