Author Topic: SE 2008 Insert padding between parans not working  (Read 5664 times)

DaveyC

  • Senior Community Member
  • Posts: 146
  • Hero Points: 9
SE 2008 Insert padding between parans not working
« on: April 02, 2008, 03:18:26 am »
I have "Insert padding between parenthesis" checked on and it is not working for functions, only loops.

SlickEdit Version 13.0.0.0

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2389
  • Hero Points: 328
Re: SE 2008 Insert padding between parans not working
« Reply #1 on: April 02, 2008, 01:55:00 pm »
That is by design, that setting only applies to loops and conditional statements.

You can enable "Pad parenthesis" in the Context Tagging(R) options to get padding around parenthesis for functions.

Unfortunately, this option is not supported by the beautifier at this time.  We have a feature request logged to add the feature.

DaveyC

  • Senior Community Member
  • Posts: 146
  • Hero Points: 9
Re: SE 2008 Insert padding between parans not working
« Reply #2 on: April 03, 2008, 01:10:04 am »
I have selected "Pad parenthesis" and "Insert space after comma" in Context Tagging and neither is working! Any ideas?

chrisant

  • Senior Community Member
  • Posts: 1413
  • Hero Points: 131
Re: SE 2008 Insert padding between parans not working
« Reply #3 on: April 03, 2008, 11:56:01 pm »
From the Help file:
Quote
• Pad parentheses - If selected, a space is inserted after the open parenthesis when a parameter name is automatically inserted. In addition, if you type a close parenthesis after an automatically inserted parameter, it will insert a space before the close parenthesis.
Do you mean that you typed "Foo(" and then the editor automatically inserted "barParam" like so "Foo(barParam" instead of like "Foo( barParam"?  That's what the "Pad parentheses" option in Context Tagging is for.  The option only controls spacing when SE automatically fills in parameter names for you.  If SE didn't fill in a parameter name, then the option wouldn't have been applicable.

There is no option in SE yet that always inserts a space after an opening paren, or after comma, or before a closing paren.  Ideally Adaptive Formatting would detect the style you want, and typing a closing paren would reformat the preceding parens to match the dominant style in the file.

If you always want a space to be inserted after an open paren while you type, you can write a macro that inserts "( ", and bind that to the open paren key.  If your needs are more sophisticated, you can add things like a close paren macro that automatically strips whitespace between an empty "(  )" pair.  Ideally I wouldn't need to write macros to get the behavior I want, but realistically there are a lot of people out there with differing expectations, so I'm happy that I'm able to write macros to customize the behavior to my liking.  :)
« Last Edit: April 03, 2008, 11:57:50 pm by chrisant »

DaveyC

  • Senior Community Member
  • Posts: 146
  • Hero Points: 9
Re: SE 2008 Insert padding between parans not working
« Reply #4 on: April 04, 2008, 04:31:59 am »
That's all fine and dandy but it was working perfectly in SE 2007. I also use the plugin and it works perfectly.
If this is working as designed then I don't like it at all! I'm having to type more, which is not good.  >:(

DaveyC

  • Senior Community Member
  • Posts: 146
  • Hero Points: 9
Re: SE 2008 Insert padding between parans not working
« Reply #5 on: April 08, 2008, 11:04:34 am »
What's the official SE response to this. My coding style is as follows:

Code: [Select]
foo( parm1, parm2, parm3 );

In SE 2007 it automatically inserted the spaces for me, now it doesn't. Is this working as designed?

hs2

  • Senior Community Member
  • Posts: 2736
  • Hero Points: 285
Re: SE 2008 Insert padding between parans not working
« Reply #6 on: April 08, 2008, 11:28:40 am »
I also think this is a bug. If not (can't believe that) the behaviour of the previous SE version(s) needs to be re-implemented since this is a quite common coding style. It's also part of quite a number of mandatory coding rules I've to deal with.
HS2

DaveyC

  • Senior Community Member
  • Posts: 146
  • Hero Points: 9
Re: SE 2008 Insert padding between parans not working
« Reply #7 on: April 08, 2008, 11:49:44 am »
hs2, I hope you're right! When this feature was introduced in SE2007 I was dancing the gay fandango in delight. I feel like a child that has
had their favorite toy taken away!

DaveyC

  • Senior Community Member
  • Posts: 146
  • Hero Points: 9
Re: SE 2008 Insert padding between parans not working
« Reply #8 on: April 08, 2008, 11:51:02 am »
errr, no swearing by the way! G-A-Y fandango is a dance ;)

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2389
  • Hero Points: 328
Re: SE 2008 Insert padding between parans not working
« Reply #9 on: April 08, 2008, 08:52:48 pm »
I just retested this in Slick-C and C++, and it worked as advertised.

Could you provide a complete example, and clarify three things:

1) have you rebound open paren?

2) Are you getting help from auto-complete or auto-list-members?
    That is, is there a member access operator involved?

3) Do you get parameter help for your function when you hit open paren?
    The auto-insert space logic is tied to the parameter help, if your
    function doesn't have a prototype that we can find, or if you have
    disabled auto function help, then that would explain your situation.
    In the first case, if we can't recognize the function, we generally
    won't insert extra stuff if we don't know what you are trying to do.

4) Does the function in question have a prototype with arguments?
    We do not insert the extra space for functions that have no args.