Bug 180349 - [misc] Remove trailing spaces as an option while saving files
Summary: [misc] Remove trailing spaces as an option while saving files
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 enhancement with 11 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
: 311173 341407 359214 (view as bug list)
Depends on: 195063
Blocks:
  Show dependency tree
 
Reported: 2007-03-31 09:28 EDT by Christophe Bismuth CLA
Modified: 2020-10-16 09:08 EDT (History)
17 users (show)

See Also:


Attachments
remove space (633 bytes, text/plain)
2014-02-21 07:35 EST, sudhakar dantanala CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Bismuth CLA 2007-03-31 09:28:54 EDT
Dear Team,

Removing trailing spaces while saving file could be an option. Of course, this option would be disabled by default to avoid damaging on CVS/SVN.

Thank you all for your so incredible work,
Christophe Bismuth
Comment 1 Dani Megert CLA 2007-04-02 03:24:18 EDT
This is possible for Java files in the Java editor.
Comment 2 Dani Megert CLA 2010-05-01 03:21:06 EDT
*** Bug 311173 has been marked as a duplicate of this bug. ***
Comment 3 Dani Megert CLA 2010-05-18 11:51:46 EDT
*** Bug 311173 has been marked as a duplicate of this bug. ***
Comment 4 Dani Megert CLA 2010-05-19 02:43:37 EDT
*** Bug 311173 has been marked as a duplicate of this bug. ***
Comment 5 anatoly techtonik CLA 2010-05-19 02:54:34 EDT
What is the status of this bug after 3 years?
Comment 6 Dani Megert CLA 2010-05-19 03:14:32 EDT
(In reply to comment #5)
> What is the status of this bug after 3 years?
No time to work on this but would accept a high quality patch.
Comment 7 anatoly techtonik CLA 2010-05-19 18:01:53 EDT
(In reply to comment #6)
> No time to work on this but would accept a high quality patch.

What do I need to start?
Comment 8 Dani Megert CLA 2010-05-20 02:33:26 EDT
(In reply to comment #7)
> (In reply to comment #6)
> > No time to work on this but would accept a high quality patch.
> 
> What do I need to start?
Bug 195063 needs to be addressed. For a summary of the problems/questions to solve see bug 195063 comment 6.
Comment 9 Olivier Thomann CLA 2011-03-30 14:35:13 EDT
*** Bug 341407 has been marked as a duplicate of this bug. ***
Comment 10 Sergey Prigogin CLA 2011-03-30 14:52:28 EDT
(In reply to comment #8)
> (In reply to comment #7)
> > (In reply to comment #6)
> > > No time to work on this but would accept a high quality patch.
> > 
> > What do I need to start?
> Bug 195063 needs to be addressed. For a summary of the problems/questions to
> solve see bug 195063 comment 6.

I don't think there is a need to be as fancy as described in bug 195063 comment 6. CDT currently supports removing trailing whitespace in edited lines only, which exactly what most users are looking for. See createSaveActionEdit method in /org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java
Comment 11 anatoly techtonik CLA 2011-06-28 11:28:22 EDT
Any progress on that after yet another year? Removing trailing whitespace from edited lines is definitely that I want. However, bug #311173 was marked as a duplicate of this bug, and chances to fix it were drastically reduced by this action.
Comment 12 Dani Megert CLA 2011-07-04 09:30:20 EDT
(In reply to comment #11)
> Any progress on that after yet another year?
Sorry, no resources to work on this.
Comment 13 Dani Megert CLA 2011-07-04 09:31:49 EDT
(In reply to comment #12)
> (In reply to comment #11)
> > Any progress on that after yet another year?
> Sorry, no resources to work on this.

Having said that, if someone is interested in this and wants to provide a high quality patch it would be welcome.
Comment 14 anatoly techtonik CLA 2011-07-04 09:39:16 EDT
Agile says that if task is too complicated, it should be split. I've heard that bug #311173 is covered in CDT and JDT as well. How about start with that? It will be real at least.
Comment 15 Dani Megert CLA 2011-07-04 09:47:03 EDT
(In reply to comment #14)
> I've heard that
> bug #311173 is covered in CDT and JDT as well. How about start with that? It
> will be real at least.
I don't get your point.
Comment 16 anatoly techtonik CLA 2011-07-04 10:22:38 EDT
(In reply to comment #15)
> (In reply to comment #14)
> > I've heard that
> > bug #311173 is covered in CDT and JDT as well. How about start with that? It
> > will be real at least.
> I don't get your point.

All right. Let's explain from the start.

(In reply to comment #12)
> (In reply to comment #11)
> > Any progress on that after yet another year?
> Sorry, no resources to work on this.

No resources means that there are nobody to work on this, probably because the task is huge. There is a set of methodologies available that help in these cases. They are often referenced to as "agile" - you may have heard about agile manifesto.

This task is gathered from several _close, but different_ user stories, which were closed as duplicates. These stories are often easier to implement than master bug, sometimes they are contradicting, sometimes they can take a completely different approach than master ticket. For example, bug #311173 can be fixed on formatter level instead of on file save. The approach you choose to quickly mark bugs as duplicates (instead of dependencies) makes the master issue overcomplicated. The issue becomes "epic" - another term from agile.

Task is considered "epic" when nobody is able to tackle it due to time or other constrains - i.e. you don't have resource. The common methodology to approach these things is to split epic task into several user stories and if stories still take more than one day to handle - split them in tasks.

I propose to start with bug #311173 and split it into tasks. There might be ready to use pieces of code in CDT and JDT projects that solve exactly this user story, but not the story in this master report.
Comment 17 Dani Megert CLA 2011-07-04 10:39:11 EDT
My question was not about "agile" - I know what this is ;-), but rather for "I've heard that
bug #311173 is covered in CDT and JDT as well. How about start with that?".

Anyway, the first task to solve is bug 195063 which is about pushing down (i.e. reuse) the code in JDT to allow doing things on save.
Comment 18 anatoly techtonik CLA 2011-07-04 11:20:57 EDT
(In reply to comment #17)
> My question was not about "agile" - I know what this is ;-), but rather for
> "I've heard that
> bug #311173 is covered in CDT and JDT as well. How about start with that?".
> 
> Anyway, the first task to solve is bug 195063 which is about pushing down (i.e.
> reuse) the code in JDT to allow doing things on save.

Why is it so strictly necessary to remove whitespaces on save? ISTM that detecting  touched lines on save (for removing trailing spaces) is more complicated than doing it while formatting entered text.
Comment 19 Dani Megert CLA 2011-07-04 11:38:06 EDT
> Why is it so strictly necessary to remove whitespaces on save? ISTM that
> detecting  touched lines on save (for removing trailing spaces) is more
> complicated than doing it while formatting entered text.
'Save' explicitly terminates the editing. If you want to implement this while typing you can end up in strange user interactions and you also need to make sure it gets removed on save (e.g. type 'Tab' + save) because otherwise you end up with trailing whitespace again.
Comment 20 Dani Megert CLA 2011-09-29 03:31:32 EDT
*** Bug 359214 has been marked as a duplicate of this bug. ***
Comment 21 Marvin Fröhlich CLA 2011-09-29 04:42:56 EDT
(In reply to comment #20)
> *** Bug 359214 has been marked as a duplicate of this bug. ***

Actually my report goes slightly further than this bug. Hence it is not a real duplicate of this, but a relative.

In addition to this bug, my suggestion adds this: Yes, remove trailing whitespaces on option, but leave those meant for indentation in empty lines (compare to previous non-empty line).
Comment 22 sudhakar dantanala CLA 2014-02-21 07:35:42 EST
Created attachment 240193 [details]
remove space

remove trailing space