Author Topic: Patch: function arguments added to autocomplete tooltip  (Read 126024 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Patch: function arguments added to autocomplete tooltip
« Reply #30 on: November 29, 2012, 08:10:56 pm »
p2rkw:
First impressions - it look really bad, when longer functions are completed. It adds '...' at the end.
Is it possible to try to resize the completion window?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline p2rkw

  • Almost regular
  • **
  • Posts: 142
Re: Patch: function arguments added to autocomplete tooltip
« Reply #31 on: November 29, 2012, 08:44:14 pm »
My first idea was to call:
            ed->GetControl()->AutoCompSetMaxWidth(0);
            ed->GetControl()->AutoCompSetMaxHeight(12);
before AutoComp show, but this doesn't work. Maximum size of autocomp listbox is hardcoded in ListBoxImpl::GetDesiredRect() in file PlatWX.cpp:
(...) if (maxw > 350)
        maxw = 350;
add similar for maxh.
This limitations are unnecessary because later scintilla clamp rect returned by this function to values setted by AutoCompSetMaxWidth and AutoCompSetMaxHeight. So I removed this limitations and AutoCompSetMaxWidth and AutoCompSetMaxHeight works as it should be.
« Last Edit: November 29, 2012, 08:49:42 pm by p2rkw »

Offline p2rkw

  • Almost regular
  • **
  • Posts: 142
Re: Patch: function arguments added to autocomplete tooltip
« Reply #32 on: November 30, 2012, 03:00:49 pm »
I removed few bugs, now default arguments, and overloads are handled correctly. If you use autocomp outside function's block argument's types will be not removed (because outside blocks are only function's definitions/declarations).
I also apped patch for PlatWX.cpp - if you apply it your autocomplete listbox will be adjusted to widest match.
I think I finished this functionality, now I will work on documentation helper.

edit: patches are now in patch tracker.
« Last Edit: November 30, 2012, 03:25:56 pm by p2rkw »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Patch: function arguments added to autocomplete tooltip
« Reply #33 on: November 30, 2012, 03:43:11 pm »
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
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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Patch: function arguments added to autocomplete tooltip
« Reply #35 on: December 01, 2012, 11:46:46 am »
Then we choose one to be committed and the second will be fixed after the commit.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Patch: function arguments added to autocomplete tooltip
« Reply #36 on: December 01, 2012, 04:23:32 pm »
Commit this one first (it was here longer :)); I will update my patch after that.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Patch: function arguments added to autocomplete tooltip
« Reply #37 on: December 02, 2012, 04:26:32 pm »
I've found some problems with this patch:
1. completing push_back of a std::vector results in vec.push_back(__x)|, but what I want to have after the completion is vec.push_back|
2. completing end of a std::vector results in vec.end()|, I want it to be vec.end|

'|' is where the cursor is after the completion.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline p2rkw

  • Almost regular
  • **
  • Posts: 142
Re: Patch: function arguments added to autocomplete tooltip
« Reply #38 on: December 02, 2012, 04:58:43 pm »
You probably have disabled option "add parentheses after function autocomplete". Thanks for info. I'll fix it when Alpha's patch will be in svn.
btw: can you enable this option and say what you think about new behaviour?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Patch: function arguments added to autocomplete tooltip
« Reply #39 on: December 02, 2012, 05:11:22 pm »
Yes, it is disabled, but the first case will be an error even if it is enabled.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline p2rkw

  • Almost regular
  • **
  • Posts: 142
Re: Patch: function arguments added to autocomplete tooltip
« Reply #40 on: December 02, 2012, 05:56:54 pm »
Ok, I fixed it, but now I don't have time to generate patch.
When this option is enabled and you complete push_back then argument names (in this case "__x") will be selected. It's a feature :)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Patch: function arguments added to autocomplete tooltip
« Reply #41 on: December 02, 2012, 06:24:16 pm »
What do you mean by selected?
Keep in mind that this is bug in my opinion and it can be very annoying!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline p2rkw

  • Almost regular
  • **
  • Posts: 142
Re: Patch: function arguments added to autocomplete tooltip
« Reply #42 on: December 03, 2012, 03:30:15 pm »
Patch updated.

Btw. if I will prepare patch, should I start topic to describe it, send it directly to patch tracker, or maybe I shouldn't send anything at all?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Patch: function arguments added to autocomplete tooltip
« Reply #43 on: December 03, 2012, 04:00:03 pm »
Btw. if I will prepare patch, should I start topic to describe it, send it directly to patch tracker, or maybe I shouldn't send anything at all?
What patch? Some other patch? Are you asking what is the accepted procedure for providing patches?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline p2rkw

  • Almost regular
  • **
  • Posts: 142
Re: Patch: function arguments added to autocomplete tooltip
« Reply #44 on: December 03, 2012, 04:24:40 pm »
Yea, exactly.