Code::Blocks
March 11, 2010, 09:01:42 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Code::Blocks 8.02 has been released!
 
   Home   Help Search Login Register  :: WebsiteWiki  
Pages: 1 ... 16 17 [18]
  Send this topic  |  Print  
Author Topic: New code completion remarks/issues  (Read 19086 times)
oBFusCATed
Lives here!
****
Posts: 641


« Reply #255 on: January 02, 2010, 07:45:25 pm »

Works fine here (debian 64-bit).
Both work (the completion and the calltip problems)?
Logged
jens
Global Moderator
Lives here!
*****
Posts: 2545



WWW
« Reply #256 on: January 02, 2010, 08:26:39 pm »

Works fine here (debian 64-bit).
Both work (the completion and the calltip problems)?

No only the completion and the tooltip for method.
Logged

Regards

Jens

debian - nightlies and wxWidgets (msw-)cross-build libs for "i386" and "amd64" : http://apt.jenslody.de/
C::B changelog: http://apt.jenslody.de/ChangeLog
oBFusCATed
Lives here!
****
Posts: 641


« Reply #257 on: January 29, 2010, 11:28:41 pm »

Another bug, this time 100% reproducible:



Steps:
1. Create console project
2. Remove the auto generated code
3. Paste the code below:
Code:

struct TestStruct
{
    int a;

    int Test()
    {
        int test_1, test_2;
        tes
    }
};

4. Hit ctrl + space at "tes" line
5. Type t_ and repeat step 4. ... works as expected.

Tested on gentoo amd64 + cb 6112 debugger branch
Logged
ollydbg
Lives here!
****
Posts: 1230


Interests on OpenCV and Robotics


WWW
« Reply #258 on: January 31, 2010, 02:23:10 am »

Another bug, this time 100% reproducible:

Ok, I just do more test, for example, if you paste these code to your main.cpp.
Test Code one:
Code:
struct TestStruct
{
    int test_3;

    int Test()
    {
        int test_1, test_2;
        te
    }
};
Then you get the auto-completion list is:(see the screen shot as attachment 1)
Code:
template
Test
test_3

These Code two:
Code:
struct TestStruct
{
    int test_3;

    int Test()
    {
        int test_1, test_2;
        test_
    }
};
Then you will get only "test_3" in auto-completion list.(see attachment2)

These code three:

Code:
struct TestStruct
{
    int aaaaa;

    int Test()
    {
        int test_1, test_2;
        test_
    }
};

Now, it can autocomplete both "test_1" and "test_3". see the screen shot of attachment 3.


« Last Edit: January 31, 2010, 02:24:57 am by ollydbg » Logged

Note: I'm not the author of Ollydbg debugger! Never ask question about that.
ollydbg
Lives here!
****
Posts: 1230


Interests on OpenCV and Robotics


WWW
« Reply #259 on: January 31, 2010, 02:54:04 am »

Let me explain why this bug happened.
It is related to the "initial search scope" in the CC's source code of AI() function.

Code:
// Start an Artificial Intelligence (!) sequence to gather all the matching tokens..
// The actual AI is in FindAIMatches() below...
size_t NativeParser::AI(TokenIdxSet& result,
                        cbEditor* editor,
                        const wxString& lineText,
                        bool noPartialMatch,
                        bool caseSensitive,
                        TokenIdxSet* search_scope,
                        int caretPos)
{
......
......



    if (result.size()<1) // found nothing in the search_scope, add global namespace
    {
        if (s_DebugSmartSense)
            Manager::Get()->GetLogManager()->DebugLog(F(_T("AI() result is zero. Adding global namespace.")));

        search_scope->insert(-1);
        FindAIMatches(components, result, -1, noPartialMatch, caseSensitive, true, 0xffff, search_scope);
    }

......



In the AI function, we firstly collect the "initial search scope", then do the recursive matching stage. I have already written some steps in the wiki, you can see here: 5 Automatic Code Completion, so, the "global namespace scope" is not added by default.( if I can remember, in a earlier revision, when we were collecting initial search scopes", global namespace is always added)

You can see the "if" condition.

For example, when we do the AI function in the code below:
Code:
struct TestStruct
{
    int test_3;

    int Test()
    {
        int test_1, test_2;
        te
    }
};

We firstly add the initial scope is "struct TestStruct", then do the AIMatch routing in this scope. Too bad that when the "local parser" parsing the local statement, both "test_1" and "test_2" will added to the "global scope namespace":
Code:
{
        int test_1, test_2;
        te
    }

So, when we do a AIMatch in the "strct TestStruct", we find we get the two matches: "Test()" and the member variable "test_3". At this time, we have already get the matching result size >1, so, due to the if condition, global namespace is not searched any more.

Solution:

We can have two solutions:
One: we can force to add the "global search scope" to the initial search, so that we can get the right matching result. the Pros is it is quite simple, the cons is that you will loose the performance and cause other issue.

For example:

Code:
int abcd;

int main()
{
    int abcd;
   ab
}

Here, both global variable and auto variable name will be prompted. In CB forum, some people just suggest the "auto variable" in the function body.

Two:
We don't need to add the global namespace in the initial search scope.
When the "local parser" parse the function body, the "auto variable" added as the children of the function body.

For example:
Code:
struct TestStruct
{
    int test_3;

    int Test()
    {
        int test_1, test_2;
        te
    }
};
This time, the initial search scope should be: "struct TestStruct" and the "Test()".
So, when we do an AIMatch under "TestStruct" scope, we get the "test_3" and "Test()" matches.
Also, when we do an AIMatch under "Test()", we get the "test_1" and "test_2" matches.
So, we get the expected prompted list.

I have tried to using this method, but I didn't get success, because, when a parserthread attached with a "local body" is initialed, the defualt m_Parent Token is always the "global namespace", so the "test_2" and "test_1" will always be added to the "global namespace".

If we can supply a way that we can "set" m_Parent pointer to "Test() Token", we can totally solved this problem.





Logged

Note: I'm not the author of Ollydbg debugger! Never ask question about that.
oBFusCATed
Lives here!
****
Posts: 641


« Reply #260 on: February 07, 2010, 05:58:32 pm »

We firstly add the initial scope is "struct TestStruct", then do the AIMatch routing in this scope. Too bad that when the "local parser" parsing the local statement, both "test_1" and "test_2" will added to the "global scope namespace":
Code:
{
        int test_1, test_2;
        te
    }

So, when we do a AIMatch in the "strct TestStruct", we find we get the two matches: "Test()" and the member variable "test_3". At this time, we have already get the matching result size >1, so, due to the if condition, global namespace is not searched any more.

So, this is a parser bug? Can it be fixed easily?
Logged
blueshake
Regular
***
Posts: 419



« Reply #261 on: February 09, 2010, 01:41:45 pm »

It is not a bug.it can be fixed easily. Very Happy
Logged

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?
damur
Newcomer
*
Posts: 1


« Reply #262 on: February 18, 2010, 02:11:47 am »

Hi!

I tried to use wxWidgets in Codeblocks, but Code Completion does not work correctly. And I think it's because of an #elif directive. Try this:
Code:
#define CONDITION

#if defined(SOMETHING)
    #include "something.h"
#elif defined(CONDITION)
    #include "class1.h"
#endif


int main()
{
    return 0;
}
class1.h is a file which is not part of your project (because else it would be parsed either way). So the file class1.h doesn't get parsed.
Interesting: replace "something.h" with "class1.h" and class1.h gets parsed, although SOMETHING is not defined.

Directives like this are used in most header files of wx base classes, for example "wx/button.h"

I'm using ubuntu9.10 and codeblocks SVN 6088. I tried also the 8.02 stable release, but it had the same bug.
Logged
blueshake
Regular
***
Posts: 419



« Reply #263 on: February 18, 2010, 02:24:51 am »

it is not a bug.it is just not implemented yet.Be patient! Ollydbg had done a little work.it will be solved soon.
Logged

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
Lives here!
****
Posts: 1230


Interests on OpenCV and Robotics


WWW
« Reply #264 on: March 02, 2010, 07:13:00 am »

It is not a bug.it can be fixed easily. Very Happy
@oBFusCATed
This is fixed in blueshakes this post: new cc search implemention.
Logged

Note: I'm not the author of Ollydbg debugger! Never ask question about that.
oBFusCATed
Lives here!
****
Posts: 641


« Reply #265 on: March 02, 2010, 09:09:48 am »

OK, Might test it...
Logged
ollydbg
Lives here!
****
Posts: 1230


Interests on OpenCV and Robotics


WWW
« Reply #266 on: March 02, 2010, 09:13:58 am »

OK, Might test it...
In fact, only one statement do the hack:

Code:
search_scope->insert(-1);//alwayser search the global scope.
Logged

Note: I'm not the author of Ollydbg debugger! Never ask question about that.
Pages: 1 ... 16 17 [18]
  Send this topic  |  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!