in

Platinum Bay

Peace, Love, Team System, and Community

This Blog

Syndication


.NETicated

Visual Studio Code Formatting

Working on a website in Visual Studio I found myself annoyed again by the extra spaces around <script /> tags when I type Ctrl+K+D (Format Code). It turns out however that this is easy to change. As with most Visual Studio customizations, the answer lies in Tools > Options.

Under Tools > Options > Text Editor > Html > Format, click the ‘Tag Specific Options…’ button. Under ‘Client HTML Tags’ find ‘script’. Finally, under ‘Line breaks’, change the default value from “2 Before opening, within, and 2 after closing” to “Before and After”, like the Rush song.

This isn’t specific to HTML though, most of the languages under Text Editor support formatting options. Another change I typically make is for CSS to use the Compact rules.

Happy Formatting!

12-20-2009 6-29-49

Comments

December 20, 2009 8:19 AM

Pingback from  Twitter Trackbacks for                 Visual Studio Code Formatting - .NETicated         [platinumbay.com]        on Topsy.com

 

December 20, 2009 8:47 PM

Pingback from  Dew Drop &#8211; Early Edition &#8211; December 21, 2009 | Alvin Ashcraft&#039;s Morning Dew

 

December 21, 2009 10:18 AM

Pingback from  Twitter Trackbacks for                 Visual Studio Code Formatting - .NETicated         [platinumbay.com]        on Topsy.com

 

December 21, 2009 10:18 AM

I have been using this feature extensively lately. The default settings in VS ends up adding too many new lines for my taste.

 

December 21, 2009 10:24 AM

This post was mentioned on Twitter by SteveAndrews: Blogged: Visual Studio Code Formatting http://tinyurl.com/ydb2dmk Working on a website in Visual Studio I found myself...

 

December 21, 2009 11:17 AM

Ahh, thank you.  This has always bugged me.  There are so many small issues w/ VS that I could fix if I could just remember to open Tools > Options.

Ryan Donahue
 

Leave a Comment

(required )  
(optional )
(required )  
Add

About Steve

Steve Andrews is a Team System MVP and INETA Speaker, and has been working as a developer for more than 9 years. During this time, he has designed and developed applications in such widely varying areas as trust accounting, medical information management, supply chain management, and retail systems. Steve is also an MCP, ICSOO, Speaker Liaison for the Philly .NET User Group, and community fanatic.
Powered by Community Server (Commercial Edition), by Telligent Systems
© Platinum Bay | Some Rights Reserved Creative Commons License

Disclaimer: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Feel free to challenge me, disagree with me, or tell me I'm completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or annonymous comments) - so keep it polite, please.