How to stop Eclipse formatter from placing all enums on one line

后端 未结 6 713
感情败类
感情败类 2021-01-30 03:55

I have enums like:

public static enum Command
{
login,
register,
logout,
newMessage
}

When formatting the file, the output becomes:

<         


        
6条回答
  •  -上瘾入骨i
    2021-01-30 04:29

    It's slightly ugly too, but if your company policy prevents you from changing the formatter, you can just put comments at the end of lines you don't want to be wrapped.

    public static enum Command 
    {
        login,//
        register,//
        logout,//
        newMessage//
    };
    

提交回复
热议问题