Author Topic: Can CB autocomplete function parameters from the prototype?  (Read 8441 times)

Offline kfs1

  • Multiple posting newcomer
  • *
  • Posts: 18
Can CB autocomplete function parameters from the prototype?
« on: November 22, 2006, 09:27:11 pm »
You've defined your class, you're working thru the function list. You are about to define a member function. As you type it in, autocomplete helps you fill in the class name. Then it helps you fill in the function name, and then you type ( and it shows you the function parameters.

Is there a way at this point to get it to insert that info for you? (Other than going through the 'insert' menu, which I'm having problems with separately)

Offline kingfox

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: Can CB autocomplete function parameters from the prototype?
« Reply #1 on: November 23, 2006, 12:26:45 pm »
When u type (, the Code::Blocks will shows you the function parameters. It's the built function of C::B. Show as below:


[attachment deleted by admin]

Offline orefa

  • Multiple posting newcomer
  • *
  • Posts: 102
Re: Can CB autocomplete function parameters from the prototype?
« Reply #2 on: November 23, 2006, 02:38:03 pm »
Oh wow, I've been enjoying code completion for a while but I didn't know it could also show function parameters until now. Reason is: I don't use the Enter key but just finish typing the function name out of habit, it's more natural (the list does help to confirm the correct function and spelling). But then, the opening parenthesis does not trigger the list of parameters. As I play with it now I see that if I erase the '(' and type it again then the list appears. This behaviour may be a glitch. Or maybe there's a reason for it...

Offline kingfox

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: Can CB autocomplete function parameters from the prototype?
« Reply #3 on: November 24, 2006, 02:14:39 pm »
... ...But then, the opening parenthesis does not trigger the list of parameters. As I play with it now I see that if I erase the '(' and type it again then the list appears. This behaviour may be a glitch. Or maybe there's a reason for it...

I think maybe your typing speed is too fast, so C::B's code completion function can't follow your speed with default settings. You can adjust the delay of code completion as followed figure:


[attachment deleted by admin]

Offline orefa

  • Multiple posting newcomer
  • *
  • Posts: 102
Re: Can CB autocomplete function parameters from the prototype?
« Reply #4 on: November 24, 2006, 04:12:15 pm »
Thanks kingfox, but that's not it. The setting was at 500, I reduced it to 0 and the problem remains. It seems that any speed setting I can type "CreateCursor" for example and the list of functions remains visible while I pause for a few seconds. As soon as I type the '(' the list of function names disappears but the list of function parameters does not appear. I pause for a few seconds again, backspace over the '(', pause for a few seconds again, type '(' a second time and the list of parameters finally appears.

Another way to make it appear is to type "CreateCursor" and press a redundant 'Enter' to dismiss the list before typing the '('. It feels like code completion expects you to take some sort of action before it shows you the parameters. Maybe it is intended, as in "if you don't purposely ask for the parameter list you won't get it" but that is a different behaviour from the list of functions. Or maybe this is specific to Windows 2000. Can anyone else confirm this?

Offline kingfox

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: Can CB autocomplete function parameters from the prototype?
« Reply #5 on: November 25, 2006, 02:48:56 pm »
to orefa: you are right. If I type the whole function name myself instead choosing from function list, when I press "(" and wait, no function's parameters is listed. Maybe it's a bug of code completion.

BTW: My environment: WinXP w/t SP2, the newest Code::Blocks nightly build w/t MinGW.

Offline kfs1

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Can CB autocomplete function parameters from the prototype?
« Reply #6 on: November 28, 2006, 10:27:18 am »
Kingfox wrote: "When u type (, the Code::Blocks will shows you the function parameters"
Erh...
I wrote: "and then you type ( and it shows you the function parameters."

So I don't get your point.

My point was that it *only* shows you, it doesn't offer you the chance to insert that information.

Which is why I also wrote: "Is there a way at this point to get it to insert that info for you?" for when I am writing the function definition.

Here's how to replicate what I'm talking about.

Step 1. Declare a class and a function:

struct Foo {
 void VeryLongFunctionName(const std::string& argumentNumber1, const std::string& argumentNumber2, const std::map<const std::string, const std::vector<const std::string> >);
}


Step 2. Define the function

Step 2a. You type: void Foo::VeryL

The autocomplete tooltip appears, offering you "VeryLongFunctionName" - a single keypress autocompletes it for you.

Step 2b. You type: (

The parameter list tooltip appears, looking like an autocomplete.


Now you have two options:
- Type in the argument list - which will cause the tooltip to dissapear,
- Scroll back to the function declaration in the struct and copy & paste.

I want a third option:

- Press tab to have the argument-list prototype inserted for you.