PhpStorm no longer helps with formatting the code on the go

I remember that when I first installed PhpStorm I saw that after typing { and pressing ENTER, PS automatically put the complimentary } character on another line and put the cursor in between them on a separate line. I must have broken this somehow as now nothing particular happens when I type "{". How could I fix this?

0
2 comments

Henno, there is an option in Settings|Editor|Smart Keys|Insert pair '}'. If the flag is off, PhpStorm will not insert a pair } on Enter.

0

Well, actually, in my case, I got the complimentary } character but not just in the right place. Phpstorm did not do the magic of creating another two lines and putting the cursor on the first and the complimentary } character on the second line. After much frustration with finding the influencing option, I came across of one called "Smart indent". Turning that on again did the trick. I unchecked it because I had issues with PS autoindenting incorrectly: when I explicitly indented the line to the left for aestetic purposes and just pressed enter after a semicolon, PS stubbornly intented to the very beginning of the next line, unless I was inside some sort of loop or other structure. When Smart indent was off, PS intented pleasantly to the same offset as the line before as I desired. I did not realize that that also broke the magical

............ {
    |
}

formatting.

0

Please sign in to leave a comment.