Folding 'elseif' like 'if'

Hi, i just started using PhpStorm, and i really like it alot, the only little snag i have is that the coding style we use is like this
if (boolean question) {
     do something intelligent
} elseif (another boolean question) {
     do something else
} else {
     default behavior
}

Now PhpStorm can fold 'if' and 'else' code-blocks quite nice, but i think it misses 'elseif' code-blocks.
So my suggestion is to include folding of 'elseif' code, but if anyone has a suggestion about how to do it myself im open to that also.

With thanks for an awesome product.
Nikolaj

9 comments
Comment actions Permalink

The thing is a tree structure of code blocks can't always be directly projected onto the side line.

Constructions like yours may require drawing both plus and minus signs in the same place (as two blocks overlap on line "} elseif () {"), thus we unite if/else blocks and fold them together.
To have separate folding, use line breaks between if and else:


if (boolean question) {
     do something intelligent
}
elseif (another boolean question) {
     do something else
}
else {
     default behavior
}


Though, it is discussable.

0
Comment actions Permalink

Why we should change our code style? Please invent way to give us ability to fold if and else independently. You can make wider margin and place 2 icons there or whatever you wish. But do not tell developer how they should format their code please!

0
Comment actions Permalink

I do not tell you to change code style. I only explain how it practically works now.

0
Comment actions Permalink

Sorry Valeria, but for me and for all who places curly bracket on the same line it means that folding doesn't work now (or at least it is unusable).

0
Comment actions Permalink

Overlapping folding manipulators is a known usability problem in JetBrains platform. It will be addressed by platform core team at some point at future, no estimate is available.

0
Comment actions Permalink

Dmitriy, can you please file a bug report?

Thanks,
Kirill

0
Comment actions Permalink

Folding manipulators overlay on gutter / Can't expand a collapsed node http://youtrack.jetbrains.net/issue/WI-1629

0
Comment actions Permalink

Thanks for reply.
I knew it was not a problem with an easy solution, folding of code is not an easy task.
I will be looking for this in upcoming releases.

To conclude, still an awesome product, small failing in fringe cases can not change that.

sincerest Nikolaj

0

Please sign in to leave a comment.