MTilsted
MTilsted

Reputation: 5545

change how eclipse auto generated code looks

Is there a way to change how auto generated code looks in eclipse?

Currently it generate code like

   int a = something;

But I would really like it do do it like

   int a=something

That is: Without all that extra space. This also goes for functions, where there is an extra space before the ,

I would really prefer f(int a,int b); instead of f(int a, int b);

Upvotes: 0

Views: 95

Answers (1)

Zhedar
Zhedar

Reputation: 3510

You can always change the way your code is formatted in your preferences under Java --> Code-Style --> Formatter. Modify the existing styles or just create your own.
There's also a tab for white spaces. Just uncheck those before/after comma options.
Code already written can be formatted automatically by pressing ctrl + shift + f. (or cmd + shift + f on a Mac). enter image description here Example for methods:
enter image description here Assignments without spaces: enter image description here

Upvotes: 1

Related Questions