Block comments get misaligned on copy+paste
PhpStorm has recently started to mess code comments when I copy and paste, and "Reformat Code" doesn't seem to fix it. I haven't changed any code style setting and, if I had, I've no idea which one controls this. Any idea?
/*
* Block comments like this get sent to first line
*/
$foo = $this->getFoo($fooId);
Please sign in to leave a comment.
Hello Alvaro,
Do you have anything in Settings | Editor | Code Style > in the Formatter tab on the right under the Do not format line?
No, it's empty.
Interestingly, reformat code seems to work for docblocks (/**), but not for regular comments (/*). I've tried setting PHP code style from PER-CS (previously I was using PSR1/PSR-2) but it doesn't make any difference.
I can't tell for sure if copying and pasting is still broken.
Will it be possible to share your Code Style settings? They can be exported in Settings | Editor | Code Style > click on the gear icon near the scheme name > Export > IntelliJ IDEA code style XML.
Here you are.
Thank you. Unfortunately, I see nothing special here.
I reproduced the issue and can confirm that when pasting the comment right from the beginning of the line, the block comment is pasted as expected. However, if the line already has some indentation, the block will look as in your example.
I found a similar though quite old report on YouTrack: https://youtrack.jetbrains.com/issue/WI-26904. Please vote for it to be aware of the updates.