首页 > 解决方案 > 当列中有一些注释时对齐列中的字段

问题描述

如果列中有注释,请尝试弄清楚如何对齐列中的字段。没有注释它工作得很好。

我想在执行代码重新格式化时实现以下视图:

    @Null
    private UUID   id;

    @NotNull
    private UUID   otherId;

    @NotNull(groups = ...)
    private String title;

但是当我们使用带注释的字段时,启用“组声明->在列中对齐字段”的代码重新格式化似乎无法确定这样的组声明,因此收到以下视图:

    @Null
    private UUID id;

    @NotNull
    private UUID otherId;

    @NotNull(groups = ...)
    private String title;

有人知道如何解决吗?

标签: intellij-idea

解决方案


IntelliJ 格式化程序中没有选项可以实现这一点,但 Eclipse Code Formatter 插件可以完成这项工作。

https://plugins.jetbrains.com/plugin/6546-eclipse-code-formatter


推荐阅读