如何在phpstorm中设置行注释的风格?

时间:2022-12-26 23:42:37

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

如何将PHPStorm中的行注释的默认样式更改为缩进级别而不是第一列?

if ($condition) {
// At first column.
    // At indentation level
}

3 个解决方案

#1


17  

You can change this in "Options -> Code Style -> PHP -> Wrapping and Braces" and check "Comment at first colum".

您可以在“选项->代码样式-> PHP ->包装和大括号”中更改此选项,并检查“第一个colum的注释”。

#2


43  

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

对于“Ctrl+/”行注释,它在“设置->代码样式->PHP->其他->代码Commeting->行注释在第一列”。

#3


11  

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:

看着这个答案,注意到它需要一点更新。截至2017.3版本,已更新为:

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

选项>编辑器>代码样式> PHP >(选项卡)代码生成>注释代码> (uncheck)行注释在第一列

#1


17  

You can change this in "Options -> Code Style -> PHP -> Wrapping and Braces" and check "Comment at first colum".

您可以在“选项->代码样式-> PHP ->包装和大括号”中更改此选项,并检查“第一个colum的注释”。

#2


43  

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

对于“Ctrl+/”行注释,它在“设置->代码样式->PHP->其他->代码Commeting->行注释在第一列”。

#3


11  

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:

看着这个答案,注意到它需要一点更新。截至2017.3版本,已更新为:

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

选项>编辑器>代码样式> PHP >(选项卡)代码生成>注释代码> (uncheck)行注释在第一列