共用方式為


View White Space

Keyboard:  CTRL + R, CTRL + W
Menu:  Edit -> Advanced -> View White Space
Command:  Edit.ViewWhiteSpace
Versions:  2008,2010
Published:  4/9/2010
Code:  vstipEdit0043

I've hijacked today's tip to remind everyone that next Monday I will start giving away $100 ThinkGeek gift certificates (one every day for about 30 days).  For details of my evil plan, go here.  Also, make sure to sign up for a Visual Studio Launch event in your area.  Happy coding!

Download the seriously cool Tip of the Day Extension to get the daily tips delivered to your Start Page!

 

Ever want to see the white space you are working with?  Maybe you want to know if your spaces are tabs or you have extra spaces on lines.  It's easy to view white space.  Just go to Edit -> Advanced -> View White Space (CTRL + R, CTRL + W) to go from this:

image

 

To this:

image

Comments

  • Anonymous
    April 08, 2010
    I've always used Ctrl-Shift-8 but Ctrl-R, Ctrl-W is easier to type if I can re-train my brain after all these years. :)

  • Anonymous
    April 08, 2010
    I Think this is a very Geek-y tip - and I love it - doesnt hurt that its my birthday.  Oh wait that doesnt start until Monday?  Oh well never mind - I still love this tip - I have a lot of code using spaces that should be using tabs - now I can see where the places to change are :)

  • Anonymous
    April 09, 2010
    muhahaha already working me for the gift certificates I see :P

  • Anonymous
    April 11, 2010
    Alternative is Ctrl-E, Ctrl-S.

  • Anonymous
    April 11, 2010
    Daniel, Good one!  That is a C# key mapping but you have inspired me to include additional mappings in the book.  I have had enough people ask about additional mappings that it's probably time to document them. Z

  • Anonymous
    August 27, 2010
    Hey Now Zain, Another Great one! Was looking for the hotkey -  CTRL + R, CTRL + W & o'f course you got it. Thx 4 the info, Catto

  • Anonymous
    November 30, 2011
    You know that in the next revision of visual studio, this is all not going to work..

  • Anonymous
    November 30, 2011
    Forward, Actually it WILL work in the next version of Visual Studio and works even in the beta that you can download today.  :) Z

  • Anonymous
    June 04, 2012
    The comment has been removed

  • Anonymous
    June 04, 2012
    Hey Martin :) Spaces and tabs are usually what you get with a feature like this.  What other whitespace would you like to see? Z

  • Anonymous
    February 20, 2014
    @Martin Anderson: Visual Studio automatically turns your tabs into spaces for you. As usual, this is a configurable setting. Some people prefer this because some operating systems interpret tabs as being equal to different numbers of spaces. (If I recall, it's 4 spaces to a tab in Windows, and 3 to a tab in *nix OSs)