[英]How to apply indentations settings for comment line (IntelliJ IDEA / Android Studio)
I certainly know how to use the line comment shortcut, ctrl
+ /
, but for some reason the comment starts at the end of line.我当然知道如何使用行注释快捷方式ctrl
+ /
,但由于某种原因,注释从行尾开始。
If I start with this code:如果我从这段代码开始:
if (something) {
return 5;
}
And use the shortcut from IntelliJ, I end up with:并使用 IntelliJ 的快捷方式,我最终得到:
if (something) {
// return 5;
}
But I expect things to look like this:但我希望事情看起来像这样:
if (something)
// return 5;
}
Is there any way to configure this in IntelliJ?有没有办法在 IntelliJ 中配置它? I tried changing the code syntax rules for my target language, but it didn't change anything.我尝试更改目标语言的代码语法规则,但没有任何改变。
This setting can be changed in (Settings / Preferences -> Editor -> Code Style -> Java -> Code Generation)
可以在(Settings / Preferences -> Editor -> Code Style -> Java -> Code Generation)
中更改此设置
Options:选项:
Line comment at first column.
Block comment at first column.
It should work both for Android Studio and IntelliJ IDEA.它应该适用于 Android Studio 和 IntelliJ IDEA。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.