Bug 4348 - "Visual-Studio" style formatter
Summary: "Visual-Studio" style formatter
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: Trunk
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-04-09 15:21 UTC by Peter Hultqvist
Modified: 2012-04-10 01:28 UTC (History)
1 user (show)

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


Attachments
dialog setting (63.01 KB, image/png)
2012-04-09 15:42 UTC, Peter Hultqvist
Details


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 NOT_REPRODUCIBLE

Description Peter Hultqvist 2012-04-09 15:21:03 UTC
The "Visual-Studio" c# code format rules does not match the result in Visual-Studio.

The following code is formatted by VisualStudio 2010:

namespace ConsoleApplication1
{
	class Program
	{
		public int MyProperty
		{
			get
			{
				return 4;
			}
			set { }
		}
		static void Main(string[] args)
		{
			Console.WriteLine();
			while (true)
			{
				return; //bye bye
			}
		}
	}
}

But when the same "VisualStudio" code style is used in MonoDevelop the code gets formatted like this:

namespace ConsoleApplication1
{
	class Program
	{
		public int MyProperty {
			get {
				return 4;
			}
			set { }
		}
		static void Main (string[] args)
		{
 Console.WriteLine ();
			while (true) {
				return;
				//bye bye
			}
		}
	}
}

What differs is, and thus the bugs:
- Start bracket on property get should be on a new line.
- Start bracket on while should be on a new line.
- There should not be a space between method name and the parentheses in the method call.
- Same for method declaration, there should not be a space after the method name.
- First statement in the Main function only get a single space for indentation.
- Comment after return should stay on that line(This one is already reported in #4330)
Comment 1 Mike Krüger 2012-04-09 15:31:46 UTC
There is no such thing as 'visual studio code style' in monodevelop vanilla.

I don't assume you're running monodevelop trunk/master but some 2.8.x or a unity version.  The formatting got broken (writeline) current trunk/master isn't able to do that anymore.

We've predifined code styles in master now - and you're referring to the 'Allman' style - which works.

(however I need to add the option how comments should be indented)
Comment 2 Peter Hultqvist 2012-04-09 15:42:51 UTC
Created attachment 1638 [details]
dialog setting

This is the "VisualStudio" setting that the bug refers to
Comment 3 Peter Hultqvist 2012-04-09 15:45:44 UTC
I do use the master branch of the github mono/monodevelop updated today.

Yes the allman works, thanks.

But the visual-studio was an option.
Comment 4 Peter Hultqvist 2012-04-09 15:49:36 UTC
Sorry my mistake, found out the "Visual Studio" was a custom style.
Comment 5 Mike Krüger 2012-04-10 01:28:27 UTC
I think we should do allman by default - we're going to rework the UI and options this year - code formatting options are a high priority item for me.