Going through my folder of my blog “contact me” emails, I came across this question. I like tricking Visual Studio into doing things, so I thought I’d share.

Is there a way to display only line number of coded lines, i.e. don’t number blank lines? Numbered blank lines makes showing code in powerpoint decks hard to follow.

Here’s the screenshot of what could go into your powerpoint deck.

line numbers only on real lines of code

To do this,

  1. Enable Word Wrap (Tools Options – Text Editor – All Languages – General)
  2. At the end of the first real line (like #28 above), start inserting white space until it goes off the screen. Note the Word Wrap glyph.
  3. Turn off the Word Wrap glyph (same place as in step 1) and Turn off “View White Space” (Edit – Advance – View White Space)

Here’s what the hack really looks like

what hack looks like using visible white space

Sorry, this isn’t the start of a new VS tip series. Just wanted to share some q&a that have come in through my blog.

Technorati Tags: VS2005Tips,VS2008Tips