简体   繁体   English

如何使JBoss Developer Studio使用Command + /自动缩进行注释?

[英]How can I get JBoss Developer Studio to auto-indent line comments with command+/?

When I comment a line of code in JBoss Developer Studio with command+/ , it makes the comment left-aligned. 当我使用command+/在JBoss Developer Studio中注释一行代码时,它会使注释左对齐。 Instead, I'd like the comment to follow the indentation size of my code block. 相反,我希望注释遵循代码块的缩进大小。 How can I accomplish this? 我该怎么做?

Current 当前

private static String transformSymbolicName(String unformatted) {
//  String formatted = unformatted.replace('-', '.').toLowerCase();
    return formatted;
}

Desired 期望

private static String transformSymbolicName(String unformatted) {
    // String formatted = unformatted.replace('-', '.').toLowerCase();
    return formatted;
}

JBoss>首选项> Java>代码样式>格式化程序>注释

Tools: JBoss Developer Studio 8, JDK 1.7.0_80, macOS Sierra 工具:JBoss Developer Studio 8,JDK 1.7.0_80,macOS Sierra

Go to

  1. Window -> Preferences 窗口->首选项
  2. on the left unwrap Java -> Code Style, choose Formatter 在左侧展开Java->代码样式,选择Formatter
  3. Click Edit... 点击编辑...
  4. Go to Comments tab In General Settings block and remove tick for: 转到“常规设置”块中的“注释”选项卡,并删除以下项的勾

    a. 一种。 Never indent line comments on first column 切勿在第一列缩进行注释

    b. Never indent block comments on first column 切勿在第一列缩进块注释

    You can see how it affects in the Preview window on the right 您可以在右侧的“预览”窗口中查看其影响

  5. Change profile name on the top and click Apply. 在顶部更改配置文件名称,然后单击“应用”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM