views:

783

answers:

4

Does any one know of a way to control how Visual Studio handles curly braces in Html view?

Type...

<% if (true) { %>

Then

<% { %>

And visual studio will auto format it as such.

<% if (true)
   { %>    
<% } %>

Not a major issue but nest a few of these using foreach and it gets messy.

A: 

Take a look at tools -> options -> texteditor -> JScript -> Formatting!

Henk
Not following gave this ago but JScript isnt going to effect ASPX pages (HTML)
bleevo
A: 

As the code is written in C#, it should be governed by the settings in tools | options | texteditor | c# | formatting.

Øyvind Skaar
So there is not a way to have 1 setting for ASPX pages and another for CS files?
bleevo
Don't think so. In the next version of VS we will get html snippets that hopefully be customizable. If you use ReSharper, you might solve this using Live Templates.
Øyvind Skaar
+1  A: 

Well its not really a sollution, but what i do is that i hit Ctrl+x to undo, and it will undo the formatting - there is not another way that i know off, other that changed it in all C# documents.

Jesper Blad Jensen aka. Deldy
Sad that you can't set them individually
bleevo
A: 

http://forums.asp.net/t/1478453.aspx

there is also a 'formatting' section in the jscript node. that was what my issue was.