Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipse reformat only edited lines

I am working with Java. If I hit Ctrl+Shift+F in Eclipse Helios, it will auto format the entire file instead of the lines I edited. This becomes a nightmare at the time of check in when someone else uses a different style on the same file. Is there a way to tell eclipse to only format the touched lines in a file.

like image 220
user1010373 Avatar asked Sep 05 '13 18:09

user1010373


2 Answers

If you select a range of lines in the editor then the format is done just on that range, if there is nothing selected the whole file is formatted.

You can change the formatting style used in Preferences / Java / Code Style / Formatter.

You can control formatting and other actions done when saving a file in the Jova / Editor / Save Actions preferences.

like image 197
greg-449 Avatar answered Sep 23 '22 15:09

greg-449


Windows-Preferences-Java-Editor-Save Actions

Format only saved lines. However, if you hit Ctrl+shift+f i don't think there is a way that only edited lines will be saved.

like image 32
Kilokahn Avatar answered Sep 22 '22 15:09

Kilokahn