Author Topic: Beautify and function return type  (Read 4336 times)

btrey

  • Junior Community Member
  • Posts: 2
  • Hero Points: 1
Beautify and function return type
« on: May 28, 2007, 09:15:39 PM »
This seems rather simple but if there's an option for it I can't find it.  Is there a way to have the C/C++ beautify tool place the function return type on the same line?  Currently, it's doing this:

int
MyFunc(char *arg)

I want it like this:

int MyFunc(char *arg)

Thanks!

sndom

  • Community Member
  • Posts: 70
  • Hero Points: 1
Re: Beautify and function return type
« Reply #1 on: September 11, 2014, 02:58:43 PM »
I've just been looking for a way to configure this in v19 Beta 3.  Am I missing something?

I have some code that does:

int
foo( int a )
{
    return a;
}

That I'd like to beautify like this:

int foo( int a )
{
    return a;
}

Dom

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Beautify and function return type
« Reply #2 on: September 11, 2014, 03:12:45 PM »
There's no existing setting that will pull those into the same line.  I'll investigate that for v19.  (my gut feeling is that it's not hard to do correctly for C/C++/Objective-C with the current code, but if it makes the unit tests catch fire, I'll have to put it off to another release).

sndom

  • Community Member
  • Posts: 70
  • Hero Points: 1
Re: Beautify and function return type
« Reply #3 on: September 11, 2014, 04:39:12 PM »
Thanks Patrick.

On a somewhat related note, there are beautifier settings for left or right justification for table alignment of instance/class declarations and local var declarartions, but no option to remove any existing alignment.

I have code like this:

Code: [Select]
struct foo
{
    int    a;
    double b;
}
which I want to turn into:

Code: [Select]
struct foo
{
    int a;
    double b;
}

Whilst I can change the justification, I can't remove it.

Cheers
Dom

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Beautify and function return type
« Reply #4 on: September 11, 2014, 07:35:59 PM »
Added an option for the function declaration return types, Newlines -> Statements and Declarations -> Force return type to one line.  It won't be in the next drop, but the one after that.

For the justification, I'm not sure if I'll get to adding a third setting for that for v19.  Playing with it, I noticed that disabling the justification settings, and enabling "Remove duplicate whitespace between words" doesn't clean it up either.  So that's a bug I need to look at.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Beautify and function return type
« Reply #5 on: September 15, 2014, 01:12:09 PM »
Fixed the "Remove duplicate whitespace between words" setting so it can respace structure declarations if the justification setting is disabled.  It will be in the next drop.