Bug 385996 - [save actions] Save actions should also work in Compare editor
Summary: [save actions] Save actions should also work in Compare editor
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.2   Edit
Hardware: All All
: P5 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 381626 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-07-25 18:20 EDT by Graham Johnson CLA
Modified: 2016-07-06 11:32 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Graham Johnson CLA 2012-07-25 18:20:49 EDT
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
Comment 1 Ayushman Jain CLA 2012-07-26 02:10:03 EDT
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.
Comment 2 Dani Megert CLA 2012-07-26 02:12:39 EDT

*** This bug has been marked as a duplicate of bug 253184 ***
Comment 3 Graham Johnson CLA 2012-07-26 12:31:26 EDT
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.
Comment 4 Dani Megert CLA 2012-07-27 01:57:40 EDT
(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.
Comment 5 Dani Megert CLA 2012-07-27 01:58:00 EDT
*** Bug 381626 has been marked as a duplicate of this bug. ***
Comment 6 Ed Willink CLA 2016-07-06 11:32:12 EDT
Surely this is not an enhancement? If save actions are defined, they may be important for code integrity.