我在 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/