Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2008 HTML formatting - does it ever work?

It's another Visual Studio 2008 HTML formatting question...I think I have either found a bug in the infamously bad VS HTML formatting, or I'm doing something wrong. Here's what I'm doing:

I remove all client side tags via:
Tools -> Options -> Text Editor -> HTML -> Format -> Tag Specific options

I then add b and span tags:

alt text http://www.xtupload.com/new/thumb-3BB0_49B92330.jpg

I press CTRL+E,CTRL+D and I get these two differing results:

1

alt text http://www.xtupload.com/new/image-CBF1_49B92330.jpg
The P before the span tag isn't formatted properly

2

alt text http://www.xtupload.com/new/image-3AB6_49B92330.jpg
The P tag is formatted correctly.

This for a .ASPX extension file.

like image 852
Chris S Avatar asked Mar 12 '09 15:03

Chris S


1 Answers

It looks like it is a bug, and isn't dependent on the tag being SPAN or B.

The work around I found

Add an extra space before the closing P.

How it fails

<p><b>My title</b></p>

Gets re-formatted as

<p>
  <b>My title</b></p>

How to get it to work

<p><b>My title</b> </p>

(NB the space after the B) gets reformatted as:

<p>
  <b>My title</b>
</p>

And that extra space is removed by VS anyway. Hallelujah my HTML looks beautiful!

like image 158
Chris S Avatar answered Nov 15 '22 05:11

Chris S