Code::Blocks

User forums => Using Code::Blocks => Topic started by: BlueHazzard on September 05, 2020, 07:13:06 pm

Title: Does doxygen documentation window and parenthesis completion work for you?
Post by: BlueHazzard on September 05, 2020, 07:13:06 pm
Hi,
i investigate on ticket https://sourceforge.net/p/codeblocks/tickets/1001/ 
Now i am wondering does the doxygen documentation popup and the parenthesis completion for functions work for you?
Can you give me your operating system and codeblocks/wxWidgets version?

For me on windows 7 and windows 10 wxWidgets v3.1.3-72-g014f04b437 it does not work.


For devs:
The problem is, that cbStyledTextCtrl does not send the wxEVT_COMMAND_LIST_ITEM_SELECTED event, what is responsible for some internal state management and the popup for the documentation window
Title: Re: Does doxygen documentation window and parenthesis completion work for you?
Post by: BlueHazzard on September 06, 2020, 01:58:01 pm
Also does not work with wxWidgets v3.1.4-216-gc2b1dbda83
Title: Re: Does doxygen documentation window and parenthesis completion work for you?
Post by: Miguel Gimenez on September 08, 2020, 03:53:36 pm
With C::B 13.12 on Mint 18.2 (wx3.0.2) both features work OK, I will check more recent releases.
Title: Re: Does doxygen documentation window and parenthesis completion work for you?
Post by: Miguel Gimenez on September 08, 2020, 04:00:37 pm
C::B 16.01 on Debian Stretch works OK.

EDIT: 17.12 on XP (wx2.8.12) works OK.
Title: Re: Does doxygen documentation window and parenthesis completion work for you?
Post by: oBFusCATed on September 08, 2020, 07:26:14 pm
What do you mean by "works"? It seems to work fine for me on linux with wx3.0.5.

Keep in mind that there is a big overhaul of the popup code in the wxWidgets we haven't backported, yet.
I started the work, but there were two problems back then - wx2.8 support and compiling some .mm files on macOS.
The former is no longer an issue, the latter still is.

So before doing any work related to this the we should backport their changes first!
Title: Re: Does doxygen documentation window and parenthesis completion work for you?
Post by: Miguel Gimenez on September 08, 2020, 07:48:54 pm
I mean "it does what it is supposed to do", i.e. code completion inserts the selected function name adding parentheses and shows associated doxygen information if any is available.

Current C::B revision (12198) compiled with wx3.1.3 or wx3.1.4 and running on Windows 7 fails. This means:
  - If you write, p.e. print and select printf from the code completion popup, you get printf without parentheses
  - If the function is documented with Doxygen, the documentation is not shown.
Title: Re: Does doxygen documentation window and parenthesis completion work for you?
Post by: Miguel Gimenez on September 08, 2020, 09:39:55 pm
I have bounded the problem with two nightlies:
2019/04/20, SVN11628, wx3.1.1 works
2020/02/08, SVN11957, wx3.1.3 does not work

The ones in between lack the wxWidgets files or crash when starting:

Code: [Select]
codeblocks.exe caused a Stack Overflow at location 000000006C5A0A42 in module wxmsw313u_gcc_cb.dll
This is on Windows 10.

EDIT: SVN11628 works with wx3.1.1, but fails with wx3.1.4
Title: Re: Does doxygen documentation window and parenthesis completion work for you?
Post by: BlueHazzard on September 09, 2020, 02:33:20 pm
Quote
Keep in mind that there is a big overhaul of the popup code in the wxWidgets we haven't backported, yet.
I started the work, but there were two problems back then - wx2.8 support and compiling some .mm files on macOS.
The former is no longer an issue, the latter still is.

Can you point to a source file or commit of wxWidgets? Or any other point i can look for this?

@Miguel Gimenez
Thank you for the testing. So it seems that it is a problem with the popup code on windows past wx3.1.1
Title: Re: Does doxygen documentation window and parenthesis completion work for you?
Post by: Miguel Gimenez on September 09, 2020, 04:14:23 pm
wxWidgets commit Reimplement wxPopupWindow as a WS_POPUP window under MSW (that went right into wx3.1.2 release) made C::B crash when a popup was about to be shown. This was discussed in ticket 773, https://sourceforge.net/p/codeblocks/tickets/773/ (https://sourceforge.net/p/codeblocks/tickets/773/)

https://github.com/wxWidgets/wxWidgets/commit/56c419116838045f23f046112960d4e42f98f80d (https://github.com/wxWidgets/wxWidgets/commit/56c419116838045f23f046112960d4e42f98f80d)

Later NewPagodi restored popup behaviour under MSW with commit Add wxPU_CONTAINS_CONTROLS style for wxPopupWindow

https://github.com/wxWidgets/wxWidgets/commit/07f64c3b75c79b79b46a7e8ac8db585a618c57da (https://github.com/wxWidgets/wxWidgets/commit/07f64c3b75c79b79b46a7e8ac8db585a618c57da)

but looks like an event generation (or something similar) was not restored, leaving parentheses generation and documentation popup out of the game.

I have made the bisection between wx3.1.1 and wx3.1.3 using current C::B head, and I have also tested current master just in case; it also fails.
Title: Re: Does doxygen documentation window and parenthesis completion work for you?
Post by: oBFusCATed on September 09, 2020, 08:12:09 pm
Can you point to a source file or commit of wxWidgets? Or any other point i can look for this?
Nope. git log for the include/stc and src/stc folders in wxWidgets and you'll see it. But the change is massive and it is not the one described by Miguel Gimenez.

I mean "it does what it is supposed to do", i.e. code completion inserts the selected function name adding parentheses and shows associated doxygen information if any is available.
"Works" was directed at BlueHazzard, sorry for not being clear about it.
Title: Re: Does doxygen documentation window and parenthesis completion work for you?
Post by: Miguel Gimenez on September 15, 2020, 04:01:39 pm
If you edit src/common/popupcmn.cpp in wxMaster and change

Code: [Select]
bool wxPopupWindowBase::Create(wxWindow* WXUNUSED(parent), int WXUNUSED(flags))
 {
    // By default, block event propagation at this window as it usually
    // doesn't make sense. This notably prevents wxScrolledWindow from trying
    // to scroll popup contents into view if a popup is shown from it but
    // extends beyond its window boundaries.
    SetExtraStyle(GetExtraStyle() | wxWS_EX_BLOCK_EVENTS);

     return true;
 }

to

Code: [Select]
bool wxPopupWindowBase::Create(wxWindow* WXUNUSED(parent), int WXUNUSED(flags))
 {
     return true;
 }

then documentation popup and parentheses completion work again.

This change was made by Vadz four days after the one that made C::B crash, and wasn't reverted by NewPagodi when he restored wxPopupWindow original behaviour.

https://github.com/wxWidgets/wxWidgets/commit/9562ca2b70c5421a9f3e94d6ea818efad0ac265b#diff-ae8d87556bfe1b32c101c69c2fb1cec4 (https://github.com/wxWidgets/wxWidgets/commit/9562ca2b70c5421a9f3e94d6ea818efad0ac265b#diff-ae8d87556bfe1b32c101c69c2fb1cec4)

Title: Re: Does doxygen documentation window and parenthesis completion work for you?
Post by: BlueHazzard on September 15, 2020, 06:05:31 pm
So this is a wxWidgets bug?

NewPagodi  introduced new popup code for windows.
This introduced a bug https://trac.wxwidgets.org/ticket/18243
Vadz fixed it with this culprit code,
NewPagodi reverted, but missed the change from vadz?

so this should be reported to wxWidgets?

Edit: How did you even found this :)
Title: Re: Does doxygen documentation window and parenthesis completion work for you?
Post by: Miguel Gimenez on September 15, 2020, 07:01:29 pm
20/10/2018, Vadz changed the popup code. This change made C::B crash when showing a popup

https://github.com/wxWidgets/wxWidgets/commit/56c419116838045f23f046112960d4e42f98f80d

24/10/2018, Vadz blocked event transmission to parents. No apparent side effect, as C::B crashed because of previous commit, but this commit is the real culprit.

https://github.com/wxWidgets/wxWidgets/commit/9562ca2b70c5421a9f3e94d6ea818efad0ac265b

28/01/2019, NewPagodi restores behaviour prior to 20/10/2018 but doesn't revert the 24/10/2018 commit, possibly because he overlooked it. Now C::B does not crash, but documentation popup and parentheses addition fail.

https://github.com/wxWidgets/wxWidgets/commit/07f64c3b75c79b79b46a7e8ac8db585a618c57da

IMHO this should be reported to wxWidgets, unless somebody finds a workaround.

Quote
How did you even found this
The main problem was C::B crashiing between the first and the third commit, so I couldn't use bisection.

I made a diff between the code after the third commit and the code just before the first commit, and then removed all changes not related to popups. As you said it looked like an event problem, so a visual inspection led me to the code blocking event transmission (see line 230 in the attached file)
Title: Re: Does doxygen documentation window and parenthesis completion work for you?
Post by: Miguel Gimenez on September 16, 2020, 11:42:03 am
I made it work, patch posted in ticket 1001 (https://sourceforge.net/p/codeblocks/tickets/1001/ (https://sourceforge.net/p/codeblocks/tickets/1001/))