problem with code formatter and case indent

You can configure IntelliJ to format case statements with or without
indentation.

This works fine so long as you don't enclose your case block in {}. If
you do, it refuses to indent.  So what?  Take off the {}.  But
that will often create duplicate declarations.
--
Roedy Green Canadian Mind Products http://mindprod.com
Culture is your operating system.
~ Terence McKenna (born: 1946-11-16 died: 2000-04-03 at age: 53)

2 comments
Comment actions Permalink

In Java you can write and eventually get this after reformatting:
{code}

 
switch (c) {
    case 'a': {
        ...
    }
    case 'b': {
        ...
    }
}

{code}
and I'm not sure I understand what exactly is wrong here. It works this way at least in version 13.1 build 135.x.

0
Comment actions Permalink

On Thu, 08 May 2014 18:48:34 MSK, Rustam Vishnyakov
<rustam.vishnyakov@jetbrains.com> wrote, quoted or indirectly quoted
someone who said :

>and I'm not sure I understand what exactly is wrong here. It works this way at least in version 13.1 build 135.x.

try this

case "a":
  {
  x = 2;
  y = 2;
  break;
  }

then try this:

case "a:
   x = 2;
   y = 2;
   break;

You must have the code configuration configured both to indent and not
indent.

If anything , you would expect adding {} to give you deeper indent.
--
Roedy Green Canadian Mind Products http://mindprod.com
Culture is your operating system.
~ Terence McKenna (born: 1946-11-16 died: 2000-04-03 at age: 53)

0

Please sign in to leave a comment.