Community
Participate
Working Groups
Build Identifier: 20120614-1722 When saving a change to a Java file in a compare editor, the configured save actions should be performed as they are if the file is edited in a normal editor. If this is not the desired default behavior, there should be an option to enable it. The consequence of this bug is that edits performed during code reviews result in incorrectly formatted code being committed. Then the reformatting that is skipped ends up happening during unrelated later edits and produces noise in diffs/patches/code reviews. Bug 381626 is the same issue (but more specific), but it was incorrectly closed as a duplicate of bug 253184, which it is not a duplicate of (since that bug specifically requests that files be reformatted before being compared). Either 381626 should be reopened, or it should change to closed as a duplicate of this bug, not the other bug. Reproducible: Always Steps to Reproduce: 1. Configure save actions to format source code 2. Open a file in the compare editor (e.g. double-click on an already-changed file from the Synchronize view) 3. Mess up the formatting of the file (e.g. insert extra spaces) 4. Save the file Expected: The file should be formatted as it is when saved from a normal editor Actual: The file is not formatted
Graham, in the Java>Editor>Save Actions preferences page, there is an option to "format edited lines". Please select that option. I think you've selected "Format all lines" and thats why you're facing this issue. Moving to JDT/Text for follow up.
*** This bug has been marked as a duplicate of bug 253184 ***
Changing to "Format edited lines" had no discernible effect on the on-save behavior of the compare editor. It still did not reformat the lines edited while in the compare editor (or any other). I see no evidence that any enabled save actions are performed during a save from a compare editor. Also, that change would have an undesired effect on save actions in normal (non-compare) editors. This bug is not a duplicate of bug 253184. Again, that bug refers formatting the source BEFORE comparing it, not formatting (or performing other enabled save actions) on save AFTER changes are made in the compare editor. Also, this bug is not specifically about formatting, it is about performing any and all of the enabled save actions. That includes removing unused imports, which bug 381626 specifically is about; that bug is still also incorrectly marked as a duplicate of big 253184.
(In reply to comment #3) > Changing to "Format edited lines" had no discernible effect on the on-save > behavior of the compare editor. It still did not reformat the lines edited > while in the compare editor (or any other). I see no evidence that any enabled > save actions are performed during a save from a compare editor. Also, that > change would have an undesired effect on save actions in normal (non-compare) > editors. > > This bug is not a duplicate of bug 253184. Again, that bug refers formatting > the source BEFORE comparing it, not formatting (or performing other enabled > save actions) on save AFTER changes are made in the compare editor. Also, this > bug is not specifically about formatting, it is about performing any and all of > the enabled save actions. That includes removing unused imports, which bug > 381626 specifically is about; that bug is still also incorrectly marked as a > duplicate of big 253184. The summary of the other bug was misleading.
*** Bug 381626 has been marked as a duplicate of this bug. ***
Surely this is not an enhancement? If save actions are defined, they may be important for code integrity.