Bug 405078

Summary: Incorrectly indented switch/case when inside if(), while(), ...
Product: [Mono] MonoDevelop Reporter: Jan Oravec <jan.oravec>
Component: C# BindingAssignee: Mike Krueger <mkrueger>
Status: RESOLVED DUPLICATE QA Contact: MD Bugs <monodevelop-bugs>
Severity: Minor    
Priority: P5 - None    
Version: SVN   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Jan Oravec 2008-06-30 14:55:06 UTC
I am using 'Indent case labels' and 'Place goto labels one indent less than current' options.

The following code indents wrongly:

if (true)
	switch ("foo")
{
	case "foo":
	Console.WriteLine ();
}

I would expect case body to be indented to the right, as it is when if() is removed.
Comment 1 Jeff Stedfast 2008-06-30 15:03:20 UTC
as a temporary workaround, just add braces to the if-statement as well:

if (true)
{
   ...
}

that should make the smart indenter work again (it gets confused with some situations)
Comment 2 Lluis Sanchez 2010-02-22 17:52:36 UTC
Mike, can you take care of this?
Comment 3 Mike Krueger 2010-02-23 12:23:19 UTC
I'll mark it as a dupe. I wanted to throw old the old smart indenter & replace with the new one. Unfortunately it's not ready yet (need the new parser infrastructure with exact token positions).

In the mean time we've some issues with this - basically for indenting constructs we need an indenter based on a full c# parser - all other 'tricks' for indenting c# code won't be successful.

*** This bug has been marked as a duplicate of bug 325187 ***