Questions before buying PhpStorm

I want to buy a new IDE soon and therefore I have to decide between Zend Studio and your product, PhpStorm. Currently I am testing PhpStorm 3 (unstable).

Code formatting is a very important feature for me and so I have a few questions:

  • PhpStorm always adds a new line to the end of the file - even if there is a closing ?>-Tag. Is there any possibility to turn this behaviour off?
  • I want to indent empty lines equal to previous line, is that possible?
  • How can I indent empty lines in phpDoc comments by one single space?


Thanks in advance.

- Sebastian
7 comments
Comment actions Permalink

Hi soettl,

1) File | Settings | Editor | Ensure blank line before end of the file on Save
2) & 3) Not sure what you mean here. But I'm not using formatter that much so I possibly just missing such existing setting somewhere. In any case -- please provide code snippet explaining how it works right now & how it should work instead -- maybe it's a bug (if such setting does exist).

0
Comment actions Permalink

I have the same problem with the whitespaces and automatic reformatting, I just tested and this behaviour is a bug when not using tab characters for indenting.

When tabs are not used and phpStorm saves a file that has "empty" rows (ie. rows that have only spaces), the spaces are stripped out.

For example I have this LESS-file:

table.custom {
    color: black;

    div {
        float: left;
    }
}



The empty row before the row starting div declaration has now four spaces but when saving, the row goes completely empty. If tab character is used, it remains correctly.

This is a major pain in the ass because we have almost 2k rows in our main LESS-file and everytime I try to commit my changes, all the empty rows show up as modifications in VCS because all of the other developers have working editors which add/handle spaces correctly. ;)
0
Comment actions Permalink

Did you try to go to preferences->Editor- and there under general you have option: Strip trailing spaces on Save: None or just modiied lines ?

Regards

0
Comment actions Permalink

Hi Andriy,

thanks for your reply.

The code formatter does always add a new line before the closing ?>-Tag, not at the end of the file.

I want to format my code this way:

class Testing {
     /**
      * comment
      * [blank comment line, but indented with one single space]
      * @var     integer
      */
     protected $test1 = 0;
     [blank line, but indented equal to previous line]
     protected $test2 = 0;
     [blank line, but indented equal to previous line]
     public function __construct($test1, $test2) {
          // first assignment
          $this->test1 = $test1;
          [blank line, but indented equal to previous line]
          // second assignment
          $this->test2 = $test2;
     }
}


This is how it looks like now:

class Testing {
     /**
      * comment
      *[blank comment line, not indented]
      * @var     integer
      */
     protected $test1 = 0;
[blank line, not indented]
     protected $test2 = 0;
[blank line, not indented]
     public function __construct($test1, $test2) {
          // first assignment
          $this->test1 = $test1;
[blank line, not indented]
          // second assignment
          $this->test2 = $test2;
     }
}
[new line]



Is that possible in PhpStorm 3?

- Sebastian

0
Comment actions Permalink

Hi soettl,

Thanks for clarification -- now I understand you you meant.

The code formatter does always add a new line before the closing ?>-Tag

Not exactly -- rather "after the class" I would say -- if you add some php command after class but before such closing tag, new line will not be added before the tag but will be before that line (after the class). Possibly it's a bug (I'm not sure) -- I have played with different options and always have the same result. I think it's worth reporting it as a bug on Issue Tracker (if it's not a bug, then at least you should have proper clarification on this).

Is that possible in PhpStorm 3?

In current EAP build -- no -- at least I was unable to acheive such results. I would recommend submitting feature requests (1 ticket per option -- it's easier to track and implementing in this way for devs) on Issue Tracker: http://youtrack.jetbrains.net/issues/WI

0
Comment actions Permalink

I already opened a ticket for this issue. While the correct functionality can apparently be achieved as it is (2.1.5) it is still inconsistent depending on does one use tab characters or spaces for indentation.

http://youtrack.jetbrains.net/issue/WI-7985

0

Please sign in to leave a comment.