Author Topic: SE17 Indent Case From Switch Not Working  (Read 1496 times)

Dswag89

  • Community Member
  • Posts: 63
  • Hero Points: 4
SE17 Indent Case From Switch Not Working
« on: July 26, 2012, 04:12:44 pm »
I'm having problems getting case statements to indent properly.  I've tried Adaptive formatting both OFF and ON, yet SE17 still seems to do whatever the heck it wants.  I had been using the stock-standard 17.0.0.8 32-bit, and every time I did something around the case (add a new one, hit "enter" at the end of one, etc.), SE happily aligned it with the switch.  I just applied the latest hotfix (hotfix_se1700_2_cumulative.zip (Revision: 2)) and now it wants to indent the case statement 3 characters in (when adaptive is ON) and 0 characters in (when adaptive is OFF).  Frustrating, but not Earth-shattering.  I've searched the community here and haven't found anything exactly like it (except something in February which did not have a conclusion).  Hopefully there's a fix... anyone?

Dswag89

  • Community Member
  • Posts: 63
  • Hero Points: 4
Re: SE17 Indent Case From Switch Not Working
« Reply #1 on: July 26, 2012, 04:43:06 pm »
Sorry about the mixed syntax "SE17", I guess that should be "SE12" (always hated that mismatch between version number and model year: pick one and move on with it).  Anyway, I saw someone else elude to a problem with 17.0.1 so I updated to that.  My SE is now 17.0.1.0 32-bit, and it is still exhibiting the same problem.  With adaptive off I get
Code: [Select]
    switch ((foo))
    {
    case ():
        break;
    default:
        break;
    }
With adaptive on I get:
Code: [Select]
    switch (foo)
    {
       case():
           break;
       default:
           break;
    }
What I want (and what the rest of the code in my file) is:
Code: [Select]
    switch (foo)
    {
        case():
            break;
        default:
            break;
    }

chrisant

  • Senior Community Member
  • Posts: 1413
  • Hero Points: 131
Re: SE17 Indent Case From Switch Not Working
« Reply #2 on: July 26, 2012, 05:41:02 pm »
The last two examples "with adaptive on" and "what I want" look identical to me.  Is there a typo?

I recently reported a similar problem (adaptive formatting not taking effect properly while editing), and Support logged the issue and said the Dev team is working on it.  In the meantime Support suggested:

Quote
'Tools > Options > Languages > Application Languages > C/C++ > General' has three "Beautify" checkboxes near the bottom.  If you uncheck these, do you see the results you want?

That worked around the problem for me.  It seems like the new Beautifier is on by default, but overrides Adaptive Formatting.  Presumably the Dev team is working on a way for them to coexist or influence each other or something.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 787
  • Hero Points: 42
Re: SE17 Indent Case From Switch Not Working
« Reply #3 on: July 26, 2012, 06:38:36 pm »
Interested in seeing what the the difference should be between adaptive and the expected as well.

So what are your settings if you go to Tools -> Beautify -> Edit Profile and go to Indent -> Indent Rule Exceptions? 

Dswag89

  • Community Member
  • Posts: 63
  • Hero Points: 4
Re: SE17 Indent Case From Switch Not Working
« Reply #4 on: July 26, 2012, 07:10:48 pm »
The last two examples don't show the difference very well in the community.  The difference is a single space.  Example 2 (adaptive on) has the case 3 spaces in from the switch.  Example 3 (desired) has the case 4 spaces in from the switch.
Chrisant - Turning off those beautifiers did not seem to help.
Patrick - Under indent rule exceptions I see the culprit.  "Indent with" == 3.  Changing this to 4 fixes my problem.
Thanks for the help!