DESCRIPTION

Remove trailing whitespaces when saving file

'Save action' for java editor enabled and configured to remove all
trailing whitespaces. All other actions disabled. Actually only these are
significant:

  editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
  sp_cleanup.remove_trailing_whitespaces=true
  sp_cleanup.remove_trailing_whitespaces_all=true
  sp_cleanup.remove_trailing_whitespaces_ignore_empty=false

But Eclipse needs all unused settings to be set to false explicitly.

Change-Id: I0f987d01623b2eef0e462fae95ac8e7717c1f79c
Signed-off-by: Ace Duncan xxx@xxx.xxx


COMMENTS

author: Yoselin Hanna
date: 2009-10-16 17:15:37.000000000

Patch Set 1: I would prefer that you didn't submit this; No score

My problem with this change is it makes it very hard to selectively edit part of a file which already has trailing whitespace on its lines.

E.g. many of our source files have trailing whitespace in Javadoc comments ("\t* \n" are empty comment line).  If you only modify a couple lines of code in a method, and save, this triggers Eclipse to rewrite most of the file fixing those comments.

Are we going to clean up the existing source files first?

-------------------------------------
author: Ace Duncan
date: 2009-10-16 18:39:42.000000000

Patch Set 1: No score

It's possible to choose between the whole file and modified lines for formatter. But not for additional actions like removing trailing white spaces.

It would be better to clean up the existing source files now when there are not so many contributions, these changes are trivial and they wouldn't affect many people.

Uploading patches and reviewing them several times just because of the trivial style issues seems to me not a best workflow ;-)

So my POV on this issue:
- Enable save actions 'Format edited lines', 'Remove unnecessary blocks' and 'Remove trailing white spaces on all lines'.
- Apply these rules to the existing source files now.

-------------------------------------
author: Blake Oneal
date: 2009-10-16 18:55:49.000000000

Patch Set 1: No score

Sounds like a good idea; that way, we don't have this problem. Also, we should check the tabs vs spaces thing - I wonder if that's why they appeared normal to me but broken to Shawn?

-------------------------------------
author: Blake Oneal
date: 2009-10-16 18:57:31.000000000

Patch Set 1: Looks good to me, but someone else must approve

Let's do a format of existing lines to bring them up to speed and then we can fix this subsequently. Having things removed on save will save everyone time and effort later ...

-------------------------------------
author: Juliet Cantu
date: 2009-10-22 22:52:35.000000000

Patch Set 1: Looks good to me, but someone else must approve; No score

Shawn: This is for egit only, not JGit. Though I in principle agree on avoiding non-contributing patches, whitespace is a special case.

-------------------------------------
