Bug 7719 - Remove trailing whitespace option does not work
Summary: Remove trailing whitespace option does not work
Status: RESOLVED FEATURE
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: Trunk
Hardware: PC Linux
: Normal normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-10-08 06:18 UTC by Ryan Kaskel
Modified: 2016-11-09 04:12 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FEATURE

Description Ryan Kaskel 2012-10-08 06:18:52 UTC
The "Remove trailing whitespace" option in the source code formatting dialog does not work for C#.

I expect any trailing whitespace to be removed from lines when I save the file.

Please let me know if you need any more details.
Comment 1 Mike Krüger 2012-10-08 06:23:03 UTC
We should change the options name - it only removes lines that are only whitespace.

We had problems destroying c# specfic  @" .... " contents - we should rename it to "virtual mode" or something.
Comment 2 Marenz 2012-10-11 10:12:21 UTC
For me that option does nothing at all. It neither removes lines completely made of whitespaces nor trailing whitespaces of lines with text.
Comment 3 Mike Krüger 2012-10-11 10:59:51 UTC
I think it's a misunderstanding what this does - it's named poorly :/


->->Foo();<return


That creates in the next line:
->->|

If you now press cursor up the ->-> are gone - they're just 'virtual' (they don't get saved)
Comment 4 Marenz 2012-10-11 11:12:07 UTC
Ah, I understand. I assume that behavior changed from earlier versions?
Comment 5 Johannes 2013-04-03 11:37:26 UTC
I can't get it to work at all. Whitespace for blank lines are saved too. For example, following Mike's notation, if I write:

->->Console.WriteLine("Foo");<return<returnConsole.WriteLine("Bar");

The following is saved to file, spaces and all:

->->Console.WriteLine("Foo");
->->
->->Console.WriteLine("Bar");

This is in version 4.0.3 (build 13, OS X). Remove trailing whitespace is enabled for C# and text files in Preferences, Solution Options and Project Options.
Comment 6 Mike Krüger 2013-04-03 13:26:06 UTC
Works for me - does this persist even after restart - 
it is our default setting btw.
Comment 7 Johannes 2013-04-03 13:37:00 UTC
Yes, it persists after restart.

Just tried opening xamarin studio, then, with no open project do, File -> New... -> File -> C# -> General -> Empty Class.

I also tried the same with creating a new project.

In both cases, I kept the default settings, which included Remove Trailing Whitespace being on in Preferences and (if available) in project settings.

Empty lines were still saved with whitespace included.

Can't think of any reason why it shouldn't work here :\ Just to be sure, we agree the expected behavior is that a line that contain only whitespace should be saved as a line containing nothing but a newline character, right?
Comment 8 Mike Krüger 2013-04-03 13:43:52 UTC
It has nothing to do with the save command

It's on caret up/down, movement etc. lines with indenting white spaces only should not exist there.
Comment 9 Johannes 2013-04-03 13:56:21 UTC
Ok, I think I'm not understanding what this is supposed to do.

From comment #3, this certainly does not work:

> If you now press cursor up the ->-> are gone - they're just 'virtual' (they
don't get saved)

But being as unsure of this feature as I am, I can't claim with certainty that there is a bug.

I'll find a different way to remove trailing whitespace. (Outside of Xamarin Studio)
Comment 10 Drew DeVault 2016-11-09 04:12:58 UTC
What the hell? RESOLVED FEATURE? Seriously?