Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhpStorm: Comment shortcut places slashes at beginning of line

When I use the comment shortcut (Ctrl + /) the slashes are placed at the beginning of the line, like this:

protected function before()
{
//    echo "(before) ";  
}

However I'd expect this behaviour:

protected function before()
{
    //echo "(before) ";  
}

How do I configure PhpStorm to use the latter approach?

like image 400
veteri Avatar asked Aug 31 '25 05:08

veteri


2 Answers

  1. Settings/Preferences
  2. Editor | Code Style | PHP
  3. Other tab and uncheck Line comments at first column option

enter image description here


In modern versions it is now located at the Code Generation tab:

enter image description here

like image 182
LazyOne Avatar answered Sep 02 '25 23:09

LazyOne


PhpStorm 2018.3 and newer:

  1. File -> Settings (Ctrl + Alt + S)

  2. Editor -> Code Style -> PHP

  3. (tab) Code Generation -> Comment Code -> (uncheck) Line comment at first column

like image 41
Mykola Avatar answered Sep 02 '25 23:09

Mykola