Menu

#1001 [CB 20.03 Bug Report] Not adding parentheses after function name auto completion

Undefined
fixed
None
Bug_Report
2020-09-30
2020-08-11
No

Dear all,
I've been using CB for 2 years now and I started it out in version 16.01 and I am still using this version because I don't like how version 17.12 looks and feels. But version 20.03 came out and went to check it out and I loved it.

However, the first thing I noticed when using it was that it is not adding parentheses after function name in auto completion and it is kind of a deal breaker. I am going to the settings toggling that option but nothing is changing. Even though it might not seem like a big deal but not having this feature is very annoying. I am not sure if this is a bug or it is one the changes in this new version.

Also selecting a few lines of code and want to put inside brackets or parentheses by just clicking the bracket or parentheses key is not working anymore. I think this is not a bug but I love that feature and was wondering if there is another way to accomplish this in.
However I made some tests and apparently this feature can be used in the CB 20.03, I openned the CB 20.03 having its default.conf file the same as the one I use in CB 16.01 and it worked but as soon as I deleted it and made CB 20.03 create its own default.conf file, the feature stopped working, and instead of embracing the selected blocked code when clicking one of these keys (, ), {, }, [, ], <, >, it just replaces it.

OS: Windows 10 64 bit
CB Release: Release 20.03 rev 11983 (2020-03-12 18:24:30) gcc 8.1.0 Windows/unicode - 64 bit

Some help please!!

Discussion

1 2 > >> (Page 1 of 2)
  • bluehazzard

    bluehazzard - 2020-08-11
    • assigned_to: bluehazzard
     
  • bluehazzard

    bluehazzard - 2020-08-11

    Related forum link

     
    • Helder Batalha

      Helder Batalha - 2020-08-11

      That's me who posted there, and I was asked to create a ticket here, as you can see in the last reply.

       

      Last edit: Helder Batalha 2020-08-11
  • Miguel Gimenez

    Miguel Gimenez - 2020-08-11

    Also selecting a few lines of code and want to put inside brackets or parentheses by just clicking the bracket or parentheses key is not working anymore.

    This is controlled by Settings -> Editor -> Editor settings -> Selection brace completion, and it is disabled by default. Just check it.

     
    • Helder Batalha

      Helder Batalha - 2020-08-11

      ooh thanks.

       
  • bluehazzard

    bluehazzard - 2020-09-03

    For some reason, this event in sdk\ccmanager.cpp:640

            stc->Connect(wxEVT_COMMAND_LIST_ITEM_SELECTED,
                         wxListEventHandler(CCManager::OnAutocompleteSelect), nullptr, this);
    

    is never triggered and for this a normaly backupcode is called in sdk\ccmanager.cpp:878

    if (   m_LastAutocompIndex != wxNOT_FOUND
                    && m_LastAutocompIndex < (int)m_AutocompTokens.size() )
                {
                    ccPlugin->DoAutocomplete(m_AutocompTokens[m_LastAutocompIndex], ed);
                }
                else // this case should not normally happen
                {
                    ccPlugin->DoAutocomplete(event.GetText(), ed);
                }
    

    Normaly the event in 640 should be called and trigger a timer event. In this timer event the variable m_LastAutocompIndex is set to a correct index...
    But this never happens, because CCManager::OnAutocompleteSelect is never triggered....

    very strange...

     
  • bluehazzard

    bluehazzard - 2020-09-03

    Ok, this is a mine field... a lot dead code here....

     
  • bluehazzard

    bluehazzard - 2020-09-04

    Is it possible, that the whole documentation popup is not working?

     
  • bluehazzard

    bluehazzard - 2020-09-04

    Ok, as far as i can find out:
    The above event was called when the user selected an item from the autocomplete list.
    This triggered the popup for the documentation and some indexing needed for completing the parethesis.

    Fixing the parenthesis issue is relative easy....
    fixing the documentation popup is quite difficult. The above event does not exists anymore it is replaced with SCN_AUTOCSELECTION. This scintilla event was introduced somewhere around 2017 and our scintilla does not have it. Does this mean, we use a at least 3 year old version?

    Does someone knows how to update? I have made a quick try, but i do not think that this is an easy task....

     
  • Teodor Petrov

    Teodor Petrov - 2020-09-04

    We use Scintilla 3.7.5. The last in wx is 3.7.2 I think. We could update to the latest 3.x release, which is a c++11 backport of 4.x releases. Neil went crazy and requires c++17 for 4.x releases. :)

    Updating scintilla is not a trivial excersize. :)
    I'll do it sometime in the future.

    What do you mean by the doc popup not working? It works fine for me. If you want to discuss this start a topic on the forum. I guess this is off topic here.

     
  • Miguel Gimenez

    Miguel Gimenez - 2020-09-15

    This commit broke parentheses addition and documentation popup. I have reverted the commit in wxMaster and both work again.

     
  • Teodor Petrov

    Teodor Petrov - 2020-09-15

    Does this feature work in the stc sample without modifications? Their popup code is different and probably we need to just take their changes.

     
  • Miguel Gimenez

    Miguel Gimenez - 2020-09-16

    I got it working just adding one line to PlatWX

     
    • Helder Batalha

      Helder Batalha - 2020-09-16

      So what happens now?
      So if I go and download the latest Codeblocks version the problem will be solved?
      Sorry I don't know how this works.

       
      • Miguel Gimenez

        Miguel Gimenez - 2020-09-16

        Now some developer (probably the owner of the ticket) should evaluate the patch and, if it is appropiate, modify the code in trunk.

        You now have four options, depending on your skills:
        1. Apply the patch to a copy of the source code and compile C::B yourself
        2. Wait for the patch to be applied in the repository, download the code and compile
        3. Wait for the first nightly after patch application
        4. Wait for the first release after patch application

        1 and 2 are not for beginners, 3 is very easy but some users do not like nightlies, 4 is the safest but slowest option (release cycle lasts about two years).

         
        • Helder Batalha

          Helder Batalha - 2020-09-16

          I am the owner of the ticket but I created it because I posted this problem in Codeblocks Forum and I was told to create a ticket here.

          1 and 2 are def not for me, I once tried to compile the entire source code but it threw a lot of errors that I tried googling but found nothing that would help so I gave up.

          I always saw those nightly builds but never really looked into them.

          4 is too much time to wait for a simple fix.
          Isn't there any guide that shows users how to compile the source code, maybe walk a beginner through.
          Could you help me to do it?

           
          • Miguel Gimenez

            Miguel Gimenez - 2020-09-16

            You are the creator, but the owner is bluehazzard; check the header at the top of the page.

            The wiki has some info, for example Installing Code::Blocks from source on Windows

            After you have compiled wxWidgets (and possibly boost) you can use your current C::B 20.03 to do the final compilation. If you have problems please use the forum.

             
            • Helder Batalha

              Helder Batalha - 2020-09-16

              Sorry, as you can see all of this is really new to me.

              Thanks for the link and the info's.
              Appreciate it.

               
    • Helder Batalha

      Helder Batalha - 2020-09-17

      I just spent the last few hours trying to successfully build codeblocks from the source code and I finally made it.
      As I was just trying to make it compile I didn't try to make the change in PlatWX, so now I am trying to get the patch to work.

      I added the line

      SetExtraStyle(GetExtraStyle() & ~wxWS_EX_BLOCK_EVENTS);
      

      But it is throwing 'undefined reference' errors:

      devel31_64\libwxscintilla_cb.a(Catalogue.o):Catalogue.cxx:(.rdata$.refptr.lmOScript[.refptr.lmOScript]+0x0)||undefined reference to `lmOScript'

      devel31_64\libwxscintilla_cb.a(Catalogue.o):Catalogue.cxx:(.rdata$.refptr.lmOpal[.refptr.lmOpal]+0x0)||undefined reference to `lmOpal'|

      I am googling it but nothing is coming up.

       
      • Miguel Gimenez

        Miguel Gimenez - 2020-09-17

        Please ask again in the forum attaching a.full rebuild log.

         

        Last edit: Miguel Gimenez 2020-09-17
        • Helder Batalha

          Helder Batalha - 2020-09-17

          I am running Code::Blocks 'Release 20.03 rev 11983 (2020-03-12 18:24:30) gcc 8.1.0 Windows/unicode - 64 bit' on Win 10 64 bit version 1909, I use the MinGw compiler that comes with the codeblocks.

          I am trying to build the codebloks trunk revision

          I openned the CodeBlocks_wx31_64.cbp project in src folder and I use wxWidgets-3.1.3.
          In the project build options I added '\src\exchndl\win64\lib' to 'search directories' in the linker tab.

          I go in 'src/sdk/wxscintilla/src/PlatWX.cpp' line 66 and I commented it out.

          #if wxCHECK_VERSION(3, 1, 0) && defined(__WXMSW__) && !defined(HAVE_DIRECTWRITE_TECHNOLOGY)
              // You need a build of wxWidgets with enabled Direct2D rendering support.
              // Unfortunately wxWidgets doesn't enable this by default when using non-Visual studio
              // compilers, so you have to enable it manually. To do so you have to edit the file
              // <wxWidgets-root>/include/wx/msw/setup.h.
              // Change "#define wxUSE_GRAPHICS_DIRECT2D 0" to "#define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT".
              // If you're rebuilding wxWidgets you might also have to edit the file
              // <wxWidgets-root>/lib/gcc_dll/mswu/wx/setup.h.
              #error "You need to have Direct2D capable wxWidget build to build Code::Blocks. We want to support fonts with ligatures!!!"
          #endif // wxCHECK_VERSION(3, 1, 0) && defined(__WXMSW__) && !defined(HAVE_DIRECTWRITE_TECHNOLOGY)
          

          The line (#error) that emits the error, I commented it out because I couldn't find the solution right away (I tried the one it is given in the instructions), so I decided to just skip it for the time being.

          Still in 'src/sdk/wxscintilla/src/PlatWX.cpp' file I added the line in the that was given in the patch:

          SetExtraStyle(GetExtraStyle() & ~wxWS_EX_BLOCK_EVENTS);
          

          To this function:

          wxSCIListBoxWin(wxWindow* parent, wxWindowID id, Point WXUNUSED(location)) :
                  wxPopupWindow(parent, wxBORDER_SIMPLE)
              {
          
                  // This is the line added
                 SetExtraStyle(GetExtraStyle() & ~wxWS_EX_BLOCK_EVENTS); 
                  lv = new wxSCIListBox(parent, id, wxPoint(-50,-50), wxDefaultSize,
                                        wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_NO_HEADER | wxBORDER_NONE);
                  lv->SetCursor(wxCursor(wxCURSOR_ARROW));
                  lv->InsertColumn(0, wxEmptyString);
                  lv->InsertColumn(1, wxEmptyString);
          
                  // NOTE: We need to fool the wxListView into thinking that it has the
                  // focus so it will use the normal selection colour and will look
                  // "right" to the user.  But since the wxPopupWindow or its children
                  // can't receive focus then we have to pull a fast one and temporarily
                  // parent the listctrl on the wxScintilla window and then call SetFocus and
                  // then reparent it back to the popup.
                  lv->SetFocus();
                  lv->Reparent(this);
          #ifdef __WXMSW__
                  lv->Show();
          #endif
          #if defined(__WXOSX_COCOA__) || defined(__WXGTK__)
                  // This color will end up being our border
                  SetBackgroundColour(wxColour(0xC0, 0xC0, 0xC0));
          #endif
              }
          

          And the build fails withe following build log:

          ||=== Build: sdk in Code::Blocks wx3.1.x (64 bit) (compiler: GNU GCC Compiler) ===|
          devel31_64\libwxscintilla_cb.a(Catalogue.o):Catalogue.cxx:(.rdata$.refptr.lmOScript[.refptr.lmOScript]+0x0)||undefined reference to `lmOScript'|
          devel31_64\libwxscintilla_cb.a(Catalogue.o):Catalogue.cxx:(.rdata$.refptr.lmOpal[.refptr.lmOpal]+0x0)||undefined reference to `lmOpal'|
          ||error: ld returned 1 exit status|
          ||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 41 second(s)) ===|
          

          I tried googling the problem but I found nothing helpful.

           

          Last edit: Helder Batalha 2020-09-17
          • Miguel Gimenez

            Miguel Gimenez - 2020-09-17

            This is not the place for this, please create a new topic in the forum with this information.

             
            • Helder Batalha

              Helder Batalha - 2020-09-17

              Ok, I see.
              Thanks for all your help.

              One more question though:

              1. Apply the patch to a copy of the source code...

              The way I have to do is like I did it? It is just to go int the file and add that line of code?

               

              Last edit: Helder Batalha 2020-09-17
              • Miguel Gimenez

                Miguel Gimenez - 2020-09-17

                Yes. I will try to help you more, but in the forum.

                BTW, the wiki article I recommended was outdated, I have reviewed it today and there you can see how to fix the DIRECT2D error.

                 
                • Helder Batalha

                  Helder Batalha - 2020-09-17

                  Yeah I noticed it was outdated but still it was of a tremendous help.

                  I have reviewed it today and there you can see how to fix the DIRECT2D error.

                  I will check it out now.

                  This is probably not the place but I will take the opportunity and ask you:
                  How does one go from the beginner level and reach the level you are and be able to contribute to the codeblocks development. I really love codeblocks and I would love to be able to give my contribute(hopefully a big one). Any suggestions?

                   
1 2 > >> (Page 1 of 2)

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.