Reputation: 2045
How to make eclipse automatically format my code as I type?
Example: I want eclipse to change
a+b==0
to
a + b == 0
on the fly.
Is it possible?
Thanks!
Upvotes: 4
Views: 2767
Reputation: 72854
You can modify the settings to automatically format the code when saving. For Java code, for instance, go to Window -> Preferences -> Java -> Editor -> Save Actions. In that page, there is an option to format source code on save. By default, the Eclipse built-in formatter is configured to add spaces between operators and operands.
You can also manually format the code by pressing the key combination Ctrl+Shift+F.
Upvotes: 3