SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: acmartin on April 30, 2022, 07:27:42 pm

Title: Beautify-- need {} braces around all IF's, but don't know how.
Post by: acmartin on April 30, 2022, 07:27:42 pm
I'd like to have the beautifier (default is generally what I end up ending, and its configured how I like except one this one thing)
(C/C++)

if (expr)
   thing();
else
   otherthing();

I want to force { braces } around the IF and the ELSE always -- so that it always comes:

if (expr)
{
   thing();
}

or :
if (expr)
{
  thing();
}
else
{
  things();
}

if (1 == 1)
 return;

becomes

if (1 == 1)
{
  return;
}

etc..

But I can't figure out to force that..

Any and all help appreciated!
Title: Re: Beautify-- need {} braces around all IF's, but don't know how.
Post by: patrick on May 03, 2022, 06:33:13 pm
We don't have a setting for adding in missing braces.  It has been requested before, so I'll update the feature request. 

It would definitely be useful when updating code from a different style that allowed brace-less control statements.