Reformatting code often doesn't work

I use Ctrl-K, Ctrl-D a lot to format my code, but find that sometimes LinqPad refuses to format. For example, I was working on a sample bit of code (had the Language set to C# Program) and got as far as the following...

void Main() {
List codes = new List {
};
}

class SupportTicketProblemCode {
public bool Active { get; set; }
public string Description { get; set; }
public List ChildProblemCodes { get; set; }
}

At this stage, Ctrl-K, Ctrl-D was formatting the code fine. I then added some extra lines inside the List<> initialiser...

List codes = new List {
new SupportTicketProblemCode{
Active=true,
Description="Jim"
},
};

...and Ctrl-K, Ctrl-D doesn't do anything. There aren't any errors, as I can run the program (which doesn't actually do anything at the moment), but reformatting doesn't work. As you can see, the indentation on the SupportTicketProblemCode object is wrong, and there are missing spaces around the equals sign.

Any idea why Ctrl-K, Ctrl-D fails to format? I don't get any messages, don't get anything.

Thanks

Comments

Sign In or Register to comment.