Menu

#33 C++11 Initializer lists fool code completion

Undefined
open
nobody
Feature_Request
2021-06-27
2014-08-14
JinShil
No

The code completion tooltip does not seem to recognize C++11 initializer lists. You can see from the attached image that it is miscounting the commas.

1 Attachments

Related

Tickets: #385

Discussion

  • Alpha

    Alpha - 2014-09-04
    diff --git a/src/plugins/codecompletion/nativeparser.cpp b/src/plugins/codecompletion/nativeparser.cpp
    index b1f0592..3a2c630 100644
    --- a/src/plugins/codecompletion/nativeparser.cpp
    +++ b/src/plugins/codecompletion/nativeparser.cpp
    @@ -890,6 +890,7 @@ int NativeParser::GetCallTips(wxArrayString& items, int& typedCommas, cbEditor*
         if (pos == wxNOT_FOUND)
             pos = searchData.control->GetCurrentPos();
         int nest = 0;
    +    int nestInit = 0; // C++11 initializer lists
         while (--pos > 0)
         {
             const int style = searchData.control->GetStyleAt(pos);
    @@ -905,7 +906,7 @@ int NativeParser::GetCallTips(wxArrayString& items, int& typedCommas, cbEditor*
                 return wxSCI_INVALID_POSITION;
             else if (ch == _T(','))
             {
    -            if (nest == 0)
    +            if (nest == 0 && nestInit == 0)
                     ++commas;
             }
             else if (ch == _T(')'))
    @@ -916,6 +917,13 @@ int NativeParser::GetCallTips(wxArrayString& items, int& typedCommas, cbEditor*
                 if (nest > 0)
                     break;
             }
    +        else if (nest == 0)
    +        {
    +            if (ch == _T('{'))
    +                ++nestInit;
    +            else if (ch == _T('}'))
    +                --nestInit;
    +        }
         }// while
    
         // strip un-wanted
    

    Probably handles this specific case, but our parser has more issues than just that: http://en.wikipedia.org/wiki/C%2B%2B11#Initializer_lists

     
  • ollydbg

    ollydbg - 2014-09-10
    • labels: --> CodeCompletion
     
  • Morten MacFly

    Morten MacFly - 2015-02-07
    • Type: --> Undefined
     
  • ollydbg

    ollydbg - 2015-10-10
    • labels: CodeCompletion --> CodeCompletion, c++11
     
  • Teodor Petrov

    Teodor Petrov - 2016-01-19
    • Type: Undefined --> Feature_Request
     
  • Teodor Petrov

    Teodor Petrov - 2018-11-18
    • Milestone: Next_Release --> Undefined
     
  • Andrew Cottrell

    Andrew Cottrell - 2021-06-27

    Looks to be the same as ticket 385.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.