Is it possible to use Visual Studio HTML formatting to format an embedded code block?
Asked Answered
P

3

8

I love Visual Studio's ability to auto format (CTRL + K,D). However, in HTML if you have something like:

<h1><%# Eval("SomeField") %></h1>  

It gets formatted this way:

<h1>
    <%# Eval("SomeField") %></h1>

I'm fairly certain that the line break after the <h1> tag is caused by Visual Studio's formatting rules for embedded code blocks. However I don't know where to edit those settings. All of the other rules are under Tools > Options > Text Editor.

Does anyone have any ideas?

Many thanks!

Persuasive answered 15/7, 2009 at 23:42 Comment(0)
M
4

Tools > Options > Text Editor > Html > Formatting

Tag wrapping section -> Tag Specific Options...

Default Settings (there are 4) - Change all the "Line breaks:" to "Before and after"

Maleficence answered 23/7, 2010 at 16:5 Comment(1)
That was the correct setting, but the value needed to be "None" in order to make it work the way I wanted it to (<h1><%# Eval("Field") %></h1>). Thanks for the lead!Persuasive
R
2

You were close...

Go to Tools > Options > Text Editor > Html > Format

In the tag wrapping section, click on "Tag Specific Options"

In the tree, under the "Client HTML Tags" node you'll see the embed element.

Set its line breaks to "Before Opening,within, and after closing."

Rhyton answered 5/8, 2009 at 21:32 Comment(1)
I thought that as a possibility too, but after trying it, I realized that option is for the HTML tag <embed></embed>. Thanks for taking a stab.Persuasive
S
0

Tag Specific Options->Default Settings->Client tag does not support content.

Set the Line Breaks to after tag.

Spillway answered 17/12, 2010 at 21:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.