Question

In visual studio If I type:

int x=5*6+2*3;

It will automatically format it to:

int x = 5 * 6 + 2 * 3;

In eclipse I have to press CTRL+SHIFT+F to do this.

Is there any way I can make it happen automatically like in visual studio??

Thanks

Was it helpful?

Solution

PreferencesJavaCode StyleFormatterEdit 'Active Profile' → White SpacesExpressionsOperators (and the others)

Tick all desired boxes for white spaces, then Apply.

To inoke the formatter in the code editor, press CTRL + SHIFT + F (default).


You may also set the formatter to be invoked automatically on a Save Action, by going to PreferencesJavaEditorSave Actions → And tick Format Source Code, along with other desired configurations of course.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top