Bug 17765 - Format selection adding extra leading whitespace on function
Summary: Format selection adding extra leading whitespace on function
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 4.3.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: master
Assignee: Mike Krüger
Depends on:
Reported: 2014-02-13 17:43 UTC by Adam Patridge
Modified: 2014-04-01 07:58 UTC (History)
2 users (show)

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

Example of issue (with whitespace non-issue) (96.05 KB, image/gif)
2014-02-13 17:46 UTC, Adam Patridge

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:

Description Adam Patridge 2014-02-13 17:43:12 UTC
When I select a C# function, from the start of the access modifier to the ending curly brace, and choose Format Selection, I end up with a function with double whitespace in front of the access modifier. This happens even if the code selected is completely matching the policy. If I select even one piece of the whitespace before the access modifier, it works fine.

I confirmed this with two situations:
* default XS C# formatting policy and no overrides in the solution or project
* default XS C# formatting policy with a solution overriding most of it

Take this chunk of code:

namespace FormatSelectionTest
	public class EmptyClass
		public EmptyClass ()

If I select the constructor from the "p" in public to its closing curly brace and "Format selection", it will look like this (with no selection and the cursor right before the "p" in public):

namespace FormatSelectionTest
	public class EmptyClass
				public EmptyClass ()

If, instead, my selection includes any whitespace (tab or space), the code is unchanged and the selection stays the same.
Comment 1 Adam Patridge 2014-02-13 17:46:32 UTC
Created attachment 6042 [details]
Example of issue (with whitespace non-issue)
Comment 2 Mike Krüger 2014-02-14 03:18:18 UTC
wow that's a really detailed bug report.

Comment 3 Udham Singh 2014-04-01 07:58:21 UTC
I have checked this issue on following builds:

Mac OS X 10.9.2
Xamarin Studio : 4.2.4 (build 266)
Xamarin.iOS : (Enterprise Edition)
Xamarin.Android : 4.12.1 (Enterprise Edition)

Screencast: http://screencast.com/t/5zKRpsuKP

This issue is working fine. Hence, I am closing this issue.