Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the style of line comment in phpstorm

How to change the default style of line comment in PHPStorm to at indentation level rather than at first column?

if ($condition) { // At first column.     // At indentation level } 
like image 855
Tranch Xiao Avatar asked Oct 17 '13 03:10

Tranch Xiao


People also ask

How to format PHP code in PhpStorm?

In the editor, select a code fragment you want to reformat. Before reformatting, you can take a look at the code style settings that are applied to the selected code: press Alt+Enter and click Adjust code style settings. From the main menu, select Code | Reformat Code or press Ctrl+Alt+L .

How do I beautify in PhpStorm?

The dialog appears when you press Ctrl+Alt+Shift+L in the editor of the current file. If you choose Code | Reformat Code from the main menu or press Ctrl+Alt+L , PhpStorm tries to reformat the source code of the specified scope automatically.

How do you comment out code?

The leading characters // are added to the beginning of each line when commenting one or more lines of code. You can also block comment multiple lines of code using the characters /* */ .

How do I align text in WebStorm?

TO set this code style go: File -> Settings -> Code style -> PHP(choose here your language) -> Other -> Align key-value pair - mark as checked. And then press Reformat code (Ctrl+Alt+L) and voila.


2 Answers

For "Ctrl+/" line commenting it is in "Settings->Code Style->PHP->Other->Code Commeting->Line comment at first column".

like image 59
pandasauce Avatar answered Sep 21 '22 13:09

pandasauce


Version 2017.3 and greater

Looking at this answer, noticed that it needs a little updating. As of version 2017.3, this has been updated to:

Preferences > Editor > Code Style > PHP > (tab) Code Generation > Comment Code > (uncheck) Line comment at first column

like image 36
bagsmode Avatar answered Sep 21 '22 13:09

bagsmode