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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: New code completion remarks/issues
« Reply #30 on: September 24, 2009, 01:05:25 pm »
YES, I can confirm this works now !!!
I've committed including another very bad parser bug I fixed. It slipped in with the last modification I did before doing the merge... bad boy... SO could your all please try again? Also: I am generally interested in code snippets to test the CC plugin. I am planning to put all of them in a "test" project.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #31 on: September 24, 2009, 02:52:06 pm »
Quote
hello,did anyboby notice that codecompletion bar that miss some function in codecompletion.cpp.
see my snap3 .I can confirm that it work at rev 5731 see  the snap4 .
it seems that the codecompletion's member function were not included in this situation.what is going on ?
hello,Morten
is this issue solved?
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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #32 on: September 24, 2009, 03:13:36 pm »
Quote
hello,did anyboby notice that codecompletion bar that miss some function in codecompletion.cpp.
see my snap3 .I can confirm that it work at rev 5731 see  the snap4 .
it seems that the codecompletion's member function were not included in this situation.what is going on ?
hello,Morten
is this issue solved?
No, the bug you reported in reply #19 is still exist in rev 5817
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 killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: New code completion remarks/issues
« Reply #33 on: September 24, 2009, 03:19:52 pm »
I can confirm my reported issues are still fixed with the latest code in svn.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #34 on: September 24, 2009, 03:36:37 pm »
I can confirm my reported issues are still fixed with the latest code in svn.
fixed or not?  :?
I tested your example, the bug still exists.


Edit

I can confirm it works!!!
« Last Edit: September 24, 2009, 03:48:12 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 blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #35 on: September 24, 2009, 03:39:36 pm »
I can confirm it work for killerbot's issue.
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 #36 on: September 24, 2009, 03:41:50 pm »
but the issue on reply#19  still exists
the parser stop in the end of wxArrayString GetIncludeDirs(cbProject &project)

the next codes are not parsed.

see the attachment.the CodeCompletion token has no implement file.

[attachment deleted by admin]
« Last Edit: September 24, 2009, 03:53:56 pm 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?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: New code completion remarks/issues
« Reply #37 on: September 24, 2009, 03:51:00 pm »
Another issue in some classes/files I can not see/jump to the implementation.
For example cbEditor.
The toolbar does not show any members of cbEditor if I am in cbeditor.cpp, only cbEditorInternalData.

Jump to declaration and jump to implementation is broken for many functions ( I guess the same that are not listed in toolbar and/or symbols browser).

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #38 on: September 24, 2009, 03:54:12 pm »
The bug followed the routine .If the golbal function followed some kind of class member function,then the class member function will be not parsed.(e.g. cbeditor.cpp)
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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #39 on: September 24, 2009, 04:04:09 pm »
The bug followed the routine .If the golbal function followed some kind of class member function,then the class member function will be not parsed.(e.g. cbeditor.cpp)

If I only copy three function implementation from line 517 to line 743 of codecompletion.cpp .

Code
int CodeCompletion::CodeComplete()
{
......
}

bool TestIncludeLine(wxString const &line)
{
......
}

wxArrayString GetIncludeDirs(cbProject &project)
{
......
}



see the screenshot, the parser works quite well.



Both two global functions and one class member function will be recognized correctly.
« Last Edit: September 24, 2009, 04:06:01 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: 9694
Re: New code completion remarks/issues
« Reply #40 on: September 24, 2009, 04:15:55 pm »
I personally believe it's related to the handling of the const keyword in a function signature. For the classes where it works not here *always* the previous method has a const.
I've extarcted all the patches I applied from the beginning of the refactoring meanwhile and try to reproduce by which step this behaviour was introduced. So far I am at step 2...  so this may take a while... (taking Murphy into account it'll be the last step).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #41 on: September 25, 2009, 06:45:16 am »
hello all.

I just enabled the parser_thread_output guard, and try to exam the parser_thread log. It seems when parsing codecompletion.cpp, the parser exits after parsing function: GetIncludeDirs.

Here is the log:

Code
......
DoParse() : Loop:m_Str='int ', token='SortCCList'
HandleFunction() : Adding function 'SortCCList': m_Str='int '
HandleFunction() : name='SortCCList', args='(const wxString& first, const wxString& second)', peek='{'
HandleFunction() : Skipped function SortCCList impl. from 440 to 470
HandleFunction() : Add token name='SortCCList', args='(const wxString& first, const wxString& second)', return type='int '
DoParse() : Loop:m_Str='', token='int'
DoParse() : Loop:m_Str='int ', token='CodeCompletion'
DoParse() : Loop:m_Str='int ', token='CodeComplete'
HandleFunction() : Adding function 'CodeComplete': m_Str='int '
HandleFunction() : name='CodeComplete', args='()', peek='{'
HandleFunction() : Skipped function CodeComplete impl. from 473 to 645
HandleFunction() : Add token name='CodeComplete', args='()', return type='int '
DoParse() : Loop:m_Str='', token='bool'
DoParse() : Loop:m_Str='bool ', token='TestIncludeLine'
HandleFunction() : Adding function 'TestIncludeLine': m_Str='bool '
HandleFunction() : name='TestIncludeLine', args='(wxString const &line)', peek='{'
HandleFunction() : Skipped function TestIncludeLine impl. from 648 to 664
HandleFunction() : Add token name='TestIncludeLine', args='(wxString const &line)', return type='bool '
DoParse() : Loop:m_Str='', token='wxArrayString'
DoParse() : Loop:m_Str='wxArrayString ', token='GetIncludeDirs'
HandleFunction() : Adding function 'GetIncludeDirs': m_Str='wxArrayString '
HandleFunction() : name='GetIncludeDirs', args='(cbProject &project)', peek='{'
HandleFunction() : Skipped function GetIncludeDirs impl. from 667 to 2060
HandleFunction() : Add token name='GetIncludeDirs', args='(cbProject &project)', return type='wxArrayString '

************it seems the parser stops here!!!!!!!********************

Reparsing saved files...
Starting batch parsing



Note:


Skipped function GetIncludeDirs impl. from 667 to 2060

Edit:

So, I still believe it is something related to parsing such statement:

Code
....
fullname.Replace(_T("\\"), _T("/"), true);
...

"\\"   and "/" should carefully be tokenized.


Edit2

If you would like to do such test, you'd better delete all the include statement from the codecompletion.cpp, and copy these code to an empty console project. otherwise, too many logs will be  outputs when parsing these header files. :D
« Last Edit: September 25, 2009, 06:57:27 am 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 blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #42 on: September 25, 2009, 07:06:32 am »
But what about cbeditor.cpp.
It seems there is no statement fullname.Replace(_T("\\"), _T("/"), true); in the file.
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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #43 on: September 25, 2009, 07:23:43 am »
But what about cbeditor.cpp.
It seems there is no statement fullname.Replace(_T("\\"), _T("/"), true); in the file.


The same thing happens if you try to parse the cbEditor.cpp, here is the log:

Code
HandleFunction() : Adding function 'IsPreprocessor': m_Str='bool '
HandleFunction() : name='IsPreprocessor', args='(int style)', peek='{'
HandleFunction() : Skipped function IsPreprocessor impl. from 269 to 274
HandleFunction() : Add token name='IsPreprocessor', args='(int style)', return type='bool '
DoParse() : Loop:m_Str='', token='bool'
DoParse() : Loop:m_Str='bool ', token='IsCharacterOrString'
HandleFunction() : Adding function 'IsCharacterOrString': m_Str='bool '
HandleFunction() : name='IsCharacterOrString', args='(int style)', peek='{'
HandleFunction() : Skipped function IsCharacterOrString impl. from 277 to 289
HandleFunction() : Add token name='IsCharacterOrString', args='(int style)', return type='bool '
DoParse() : Loop:m_Str='', token='bool'
DoParse() : Loop:m_Str='bool ', token='IsCharacter'
HandleFunction() : Adding function 'IsCharacter': m_Str='bool '
HandleFunction() : name='IsCharacter', args='(int style)', peek='{'
HandleFunction() : Skipped function IsCharacter impl. from 292 to 304
HandleFunction() : Add token name='IsCharacter', args='(int style)', return type='bool '
DoParse() : Loop:m_Str='', token='void'
DoParse() : Loop:m_Str='void ', token='DoBraceCompletion'
HandleFunction() : Adding function 'DoBraceCompletion': m_Str='void '
HandleFunction() : name='DoBraceCompletion', args='(const wxChar& ch)', peek='{'
HandleFunction() : Skipped function DoBraceCompletion impl. from 307 to 3240
HandleFunction() : Add token name='DoBraceCompletion', args='(const wxChar& ch)', return type='void '
Reparsing saved files...
Starting batch parsing

It seem the parser stops after parsing DoBraceCompletion. note:HandleFunction() : Skipped function DoBraceCompletion impl. from 307 to 3240

It's implementation is list below:

Code
void DoBraceCompletion(const wxChar& ch)
    {
        cbStyledTextCtrl* control = m_pOwner->GetControl();
        int pos = control->GetCurrentPos();
        int style = control->GetStyleAt(pos);
        if ( IsComment(style) || IsPreprocessor(style) )
            return;
        if ( ch == _T('\'') )
        {
            if ( (control->GetCharAt(pos) == ch) && (pos > 1) && (control->GetCharAt(pos-2) != _T('\\')) )
            {
                control->DeleteBack();
                control->GotoPos(pos);
            }
            else
            {
                if ( (control->GetCharAt(pos-2) == _T('\\')) || IsCharacterOrString(style) )
                    return;
                control->AddText(ch);
                control->GotoPos(pos);
            }
            return;
        }
        if ( ch == _T('"') )
        {
            if ( (control->GetCharAt(pos) == ch) && (pos > 1) && (control->GetCharAt(pos-2) != _T('\\')) )
            {
                control->DeleteBack();
                control->GotoPos(pos);
            }
            else
            {
                if ( (control->GetCharAt(pos-2) == _T('\\')) || IsCharacter(style) )
                    return;
                control->AddText(ch);
                control->GotoPos(pos);
            }
            return;
        }
        if ( IsCharacterOrString(style) )
            return;
        const wxString leftBrace(_T("([{"));
        const wxString rightBrace(_T(")]}"));
        int index = leftBrace.find(ch);
        const wxString unWant(_T(");\n\r\t\b "));
        #if wxCHECK_VERSION(2, 9, 0)
        if ((index != wxNOT_FOUND) && (unWant.find(wxUniChar(control->GetCharAt(pos))) != wxNOT_FOUND))
        #else
        if ((index != wxNOT_FOUND) && (unWant.find(control->GetCharAt(pos)) != wxNOT_FOUND))
        #endif
        {
            control->AddText(rightBrace.GetChar(index));
            control->GotoPos(pos);
            if (ch == _T('{'))
            {
                    const wxRegEx reg(_T("^[ \t]*{}[ \t]*"));
                    if (reg.Matches(control->GetCurLine()))
                    {
                control->NewLine();
                control->GotoPos(pos);
                        control->NewLine();
                return;
            }
        }
        }
        else
        {
            index = rightBrace.find(ch);
            if (index != wxNOT_FOUND)
            {
                if (control->GetCharAt(pos) == ch)
                {
                    control->DeleteBack();
                    control->GotoPos(pos);
                    return;
                }
            }
        }
    }

« Last Edit: September 25, 2009, 07:25:53 am 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 blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #44 on: September 25, 2009, 07:43:57 am »
@ollydbg
I comment wxArrayString GetIncludeDirs(cbProject &project)
and void CodeCompletion::CodeCompleteIncludes() function implementation.Then the cc works in the latest cc.
And I test the codes in codecompletion.cpp without any comment in svn 5731.Everything work perfectly.
« Last Edit: September 25, 2009, 07:50:14 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?