java - Intellij with google-java-format - 如何在新行中进行 Java 注释

标签 java intellij-idea

我在 MacO 上使用 IntelliJ IDEA 2018.1(社区版) 并安装 google-java-format插件,但是当我通过 Command + Shift + F 格式化代码时,它总是将我的类成员及其注释放在同一行,例如:

@NotNull private String someString;

有谁知道如何配置才能使它们位于两条单独的线路上?

我遵循 this 的帮助,但这没有帮助。

提前致谢。

最佳答案

我之前在使用 google-java-format 插件时遇到过这个问题。因此,请尝试卸载该插件并使用 intellij-java-google-style.xml

可以关注这个link 。我在这里简单回顾一下:

Download the intellij-java-google-style.xml file from the http://code.google.com/p/google-styleguide/ repo.

Windows: Copy it into your config/codestyles folder in your IntelliJ settings folder. Under Settings -> Editor -> Code Style select the google-styleguide as current code style for the Metanome project.

Macintosh: Download it and go into Preferences -> Editor -> Code Style. Click on Manage and import the downloaded Style Setting file. Select GoogleStyle as new coding style.

关于java - Intellij with google-java-format - 如何在新行中进行 Java 注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51329779/

相关文章:

android-studio - Android Studio 3.2 Canary 14 Github 集成

c# - 从c#到Java接收字符串错误

java - 在 IntelliJ IDEA 中导入 Maven 依赖项

java - Intellij IDEA 支持调试ant构建的项目吗?

java - 在 if 语句中检查多个字符串的最佳方法

java - 告诉intelliJ在java项目中使用scalac编译模块?

java - Gradle 找不到 Apache commons

java - 如何编写一个java web服务来做远程登录?

java - 用负数代替正数

java - 缓存使用多个参数构建的对象