Live Fast, Code Hard, Die Young

Are you experiencing that VS2010 is suddenly highlighting the current line in the text editor? Do you want to get rid of it? I’ll show you how – or maybe convince you to keep it!

 

Line highlighting

First of all, let me explain what I’m talking about in case you haven’t figured yet. Current line highlighting is when the entire line that your cursor is on is shown in a different color. In my case it looks like this:

image

This is not part of the default functionality in VS2010 so most users never see this. However, if you happen to install the Productivity Power Tools it will be enabled by default.

The idea is that highlighting the current line will make it easy to see where your cursor is when you have a large monitor and get lost.

Some users probably love this feature. Personally I don’t like it at all when my cursor “taints” the current row like this when I’m editing. I find it plain annoying!

 

Turning it off

The first solution if you don’t like it is obviously to turn it off completely. This is pretty easy to do using the settings which you can find under Tools->Options and then Productivity Power Tools. Just flick the switch to Off:

image

Now if that was all I had to say this wouldn’t be a useful blog post. Let’s see what we can do!

 

Making it work better

Instead of turning it off we can make better use of this feature. I actually think it is a very good idea to show where the cursor is. However, once I have found the place and start typing the highlighting is just in the way for me.

I have come up with a better solution that involves changing the color of the line depending on if the edit window is active or not. This is possible through the settings under Environment->Fonts and Colors. There are two entries for the Current Line color, one for when the line is active and one when it is inactive:

image

I have set the active color to White which means that when I’m in the edit window and typing the highlighting is hidden. When I navigate classes in the Solution Explorer or elsewhere it will light up. This will effectively work very nicely because when I’m working with other panels or windows and returning to the edit window I can find where I was pretty quickly.

Give it a try and see if it works for you! 🙂

 

Conclusion

Line highlighting is a pretty controversial feature. Some swear by it and some curse it. I hope my post shows one interesting hybrid way of using it that does not get in the way as much as the default behavior.

The Productivity Power Tools is a really nice addition to Visual Studio and I highly recommend it. Through the settings you can customize it even more if you don’t like how it works. I suggest you play around with it and see if you can find other useful tips and tricks to share. I’d love to hear about them so feel free to leave a comment on my blog! 🙂

Advertisement

Comments on: "Improving current line highlighting in VS2010" (4)

  1. Good one!

  2. Thanks! That was exactly what I was looking for.

  3. astrohart said:

    I don’t have a current line selection in the Display Items box. There’s Current List Location and Current Statement.

    • Make sure that you have enabled the “Highlight Current Line” feature in the Productivity Tools if you want to customize the highlighting color. You can enable it in the Options: screenshot

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: