Bug 4330 - Autoformatter sends comments to new line
Summary: Autoformatter sends comments to new line
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: Trunk
Hardware: PC Linux
: Low enhancement
Target Milestone: ---
Assignee: Mike Krüger
Depends on:
Reported: 2012-04-07 13:40 UTC by Peter Hultqvist
Modified: 2012-04-13 04:16 UTC (History)
1 user (show)

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:

Description Peter Hultqvist 2012-04-07 13:40:45 UTC
Comments // or /**/ on the end of a line inside a method are sent to the next line by the autoformatter.
Similar comments to fields or properties inside a class are not affected in this way:


class Foo
	int a; //test1

	int b ()
		a = 0;//test2

Turns into:

class Foo
	int a; //test1

	int b ()
		a = 0;
		//test2 <--this is it

Tested on commit adf90ebaf0a35121341dfde5701fd9f48ad3d48e Sat Apr 7 09:41:52 2012 +0200
Comment 1 Mike Krüger 2012-04-07 14:19:15 UTC
I regard this kind of comment as lesser readable than the thing above of the construct.

Allowing that would surely require a new formatting setting. But one I'll go to add.
Comment 2 Peter Hultqvist 2012-04-07 14:22:28 UTC
I'm not sure I following your comment but to clarify.
The bug was that //test2 is sent to the line below, I was expecting it to stay on the "a=0" line
Comment 3 Mike Krüger 2012-04-07 14:28:01 UTC
our formatter atm would allow;

int a;


int a;

That's atm the formatting style, it disallows

int a; //test1

I think that I need to add a setting for allowing that since forcing comments correctly treated as type member/statement does make sense. But I understand that there is need for the comment in the same line.

I'll add a setting for it - it's not much work doing that
Comment 4 Mike Krüger 2012-04-07 14:28:35 UTC
btw. I think the final 3.0 will have it, I think I will even turn it default on :)
Comment 5 Peter Hultqvist 2012-04-09 15:24:21 UTC
Good to hear.

From what I remember this is a new behavior, previously those comments were left as they were placed.

Also it should be the default for the "VisualStudio" Code Formatting but I made another bug about that among other things.
Comment 6 Mike Krüger 2012-04-09 15:33:51 UTC
The behavior is the same - but the on the fly formatter is on as default.
Comment 7 Mike Krüger 2012-04-13 04:16:05 UTC