Java – stop code formatting and remove spaces from eclipse

I recently started using java again. I set up my development environment in eclipse. It has a convenient format function that can format code for you That's a good reason I've been able to set up to almost perfectly meet my code standards, except for local variable declarations I like to keep my declarations queued (there is even an option for class parameter declarations to do what I want)

That's what I want:

void jad()
{
    int         alpha              = 1;
    String      beta               = "jad";
    MyOwnObject SomeReallyLongName = new MyOwnObject();
}

Instead, the eclipse format gives me:

void jad()
{
    int alpha = 1;
    String beta = "jad";
    MyOwnObject SomeReallyLongName = new MyOwnObject();
}

I don't mind if it formats it the way I want it to, if it doesn't delete the blank I put there > I'll like it< If it could be done for me, it would certainly be better Who knows how to make eclipse do such a thing? (no options found in the code style editor)

Solution

In fact, the formatter will do this alignment for you Go to preferences – > java – > code style – > format and edit configuration files Viewing the indent tab, there will be an option to align the fields in the column

But it just aligns classes, not method variables, so it's not what you want

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>