Reputation: 11702
Every once in a while I will paste in some code and it will lose all its tabs and look pretty bad
I know that in the vs2008 xml viewer there is a button to format(indent) all the code to the correct hierarchy
Is there such a function or macro or shortcut key that i could apply this to a section of code (or to all the code in that window)?
Upvotes: 0
Views: 4361
Reputation: 95
Item #42 from "Pimp My IDE": 101 Visual Studio tips, tricks, and add-ins by Brian Schroer. Some of the other tips are pretty good too.
Upvotes: 1
Reputation: 13649
Format document
( Ctrl-K, Ctrl-D )
Format selection
( Ctrl-K, Ctrl-F )
Upvotes: 2
Reputation: 16743
Careful on the keyboard shortcuts, I think they are dependent upon the developer environment style settings, e.g. my format document is Ctrl+K, D
Upvotes: 4
Reputation: 329
Edit Menu - then Advanced - then Format Selection (if you have it highlighted).
Shortcut Key is: Ctrl + E, F (for selection) and Ctrl + E, D (for document)
Upvotes: 5