Project: JDT
Bug 201063 [save actions] Allow to 'Only format changed regions'
Reported: 2007-08-24 06:22:00 | Status: resolved fixed

I20070821-0800 When enabling format on save the high amount of outgoing changes due to formating changes is a major annoyance/makes it unusable for me. The ability to format (and maybe other actions) only changed regions would be a substantial improvement for this feature. I've wrote a prototype which does use the LastSaveReferenceProvider to determine the change region between the current and last save. I'll attach a patch. This enhancement has another nice side effect: Sometimes the formatter does format code to a form one does not want. Currently with format on save there is no way out, another major annoyance. With this patch all you do is 'undo' save action and format on save will not change the formatting next time you save (unless you change the region again of course).

Files changed in fix:
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTestCase.java org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/SaveParticipantTest.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpPostSaveListener.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CodeFormatFix.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CommentFormatFix.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/CleanUpSaveParticipantPreferenceConfiguration.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/CodeFormatCleanUp.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/CommentFormatCleanUp.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/ICleanUp.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/IMultiLineCleanUp.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/SaveParticipantMessages.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/CompilationUnitDocumentProvider.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/EditorUtility.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/saveparticipant/IPostSaveListener.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/saveparticipant/SaveParticipantMessages.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/saveparticipant/SaveParticipantRegistry.java