Complete Statement bug?

Hi folks,

I can't find workaround with Complete Statement feature. I like this feature very much but I facing this kind of a problem. If my code begins intended with TAB, then after using this feature hitting CTRL+SHIFT+ENTER it removes all tabs from the left side. eg:

any ideas how to stop it?

thanks

     if (isset($_GET['test'])) 

becomes
if (isset($_GET['test'])) {

}
0
3 comments

It was a feature that was requested a while ago: https://youtrack.jetbrains.com/issue/WI-24317
Basically, PhpStorm puts the completed line to the proper indent position.

If you have this code:

<?php
function a() {
if (true)<caret>
}

The result would be:

<?php
function a() {
    if (true) {
        <caret>
    }
}

Similarly, if you have something like this:

<?php
    if (true)<caret>

Complete Statement will result in:

<?php
if (true) {
    <caret>
}

Because the line wasn't indented properly originally.

0
Avatar
Permanently deleted user

Thanks, but what if I used to write code from intended line and don't like to start it from the edge?

0

We don't support arbitrary indent levels, unfortunately. The best workaround I can offer you is that you enable Settings | Editor | Code Style | PHP | Tabs and Indents | Indent code in PHP tags, so that the code was indented to your liking automatically.

0

Please sign in to leave a comment.