Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to disable trailing whitespace removal for empty lines #7

Closed
GoogleCodeExporter opened this issue Jul 30, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

Add an option similar to JDT's one: disable trailing whitespace removal for
empty lines.

Empty lines are widely used in virtually any source files to visually
delimit logical blocks: markup blocks in xml/html/jsp or methods/groups of
statements in java files, etc.

If trailing whitespace will be removed on these lines, cursor will "jump"
to the left while navigating the code with up/down arrows. If these lines
are long enough - this jumping will cause editor area to "jump" to the left
and back to the code/markup. Just try to move up and down in the file
consisting of mixed 300 chars long and empty lines and you will see what
I'm trying to describe :)

Attached patch includes proposed feature implementation. Though it looks
like it works as expected, I won't put too much promise into it. 

P.S. This patch includes one other relatively small change. I don't think
it worth creating separate request for this one.
I think "Remove trailing whitespace on save" should be disabled by default.
The main reason is that results of this operation remains unseen by junior
developers for a long time.
Consider project developed by a team. Junior developer just installed
eclipse with plugins his colleagues consider to be useful. Anyedittools is
one of them.
This developer makes small change (for example, removes single
System.out.println) and commits changes without reviewing them (a single
simple change after all). But instead, he commits 200+ changes (about 40%
of code lines are affected by trailing whitespace removal in several of our
projects) and it becomes quite hard to track down what actually changed in
said revision.

Though this feature is very useful, it could be quite troublesome for
unaware developers. And to make them aware, this feature should be enabled
by them in the first place :) 

Original issue reported on code.google.com by allat...@gmail.com on 20 Aug 2009 at 12:25

Attachments:

@GoogleCodeExporter
Copy link
Author

Thank you for the patch!

I will look later on it.

For the second part: I will definitely NOT disable the option to strip 
whitespace on 
save by default.

The reason is simple: in your example, not the junior developer has a problem, 
it's 
the senior developers duty to make sure that the codebase is in the good state. 
If 
it is not, then nobody should blame juniors.

I insist on a project/organisation wide code conventions, IF there is more then 
one 
man working on a code, it's simply a "must have". The simple solution would be 
made 
an initial cleanup WITHOUT changing the code logic before starting to work on a 
project.

If you still not agree, you can simply enable your own defaults by customizing 
Eclipse produkt .options in your organization and set whatever option you think 
is 
right for AnyEdit.

Regards,
Andrei

Original comment by iloveeclipse on 20 Aug 2009 at 5:13

  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

@GoogleCodeExporter
Copy link
Author

Issue 58 has been merged into this issue.

Original comment by iloveeclipse on 27 Aug 2011 at 1:01

@GoogleCodeExporter
Copy link
Author

Andrei,

Have you integrated this patch to ignore whitepsaces for empty lines? I think 
it makes a great addition to your already awesome tool.

Thanks,
Colter Haycock

Original comment by colterha...@gmail.com on 2 Nov 2012 at 4:41

@GoogleCodeExporter
Copy link
Author

Issue 41 has been merged into this issue.

Original comment by iloveeclipse on 2 Nov 2012 at 3:42

@GoogleCodeExporter
Copy link
Author

I apologize for not following the request and patch. I had too much other 
things in my life with slightly higher priority: marriage, child etc ... Now 
back to the topic: I've applied the proposed patch as is, with one small 
change: there are no changes to the default policy of stripping whitespace on 
save.

Will be part of 2.4.3 version, planned ASAP after some testing.

Original comment by iloveeclipse on 2 Nov 2012 at 3:46

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant