2

There was an add-on called Power Commands (Now productivity power tools) in visual studio to format the code on save.

I was so used to see my code format on save that I cannot change that habit. Is there a way to do that in Eclipse?

I can only assign one thing to Ctrl+S otherwise because if I assign Save & Format Code to the same keys, once I press the shortcut it will do neither but propose me what I want to do with the shortcut. Is there an add-on or a way to do it?

Chandrayya G K
  • 8,719
  • 5
  • 40
  • 68
phadaphunk
  • 12,785
  • 15
  • 73
  • 107

2 Answers2

3

Go to

Window > Preferences 

then to

Java > Editor > Save actions

and tick Perform the selected actions on save, then tick Format source code

You can also let eclipse perform Additional actions which you can freely configure.

A4L
  • 17,353
  • 6
  • 49
  • 70
1

Sure. You can do that in your eclipse workspace. Set your own custom save actions.

Here is what you need to do. enter image description here Navigate to Window --> Preferences, Search for Save in it. and enable the Perform Selected actions on Save checkbox.

Hrishikesh
  • 2,033
  • 1
  • 16
  • 26