VS Custom Text Markers

Some time ago I wrote about how I’d been trying to create some custom text markers in VS 2005. Well, as usual other things came up and I lost interest in drawing little custom glyphs in the margin of Visual Studio. I returned to this this evening because I wanted to add some custom text markers to my xpath expression tester which I’m re-developing as a VS 2005 utility. Previously I’d been able to register my text marker and receive an ID (that I should have been able to use to then go and draw it) but this drawing step always failed. After reflecting on the problem for some time (and with newfound insights re: VS and the dynamic service locator pattern) I decided I needed to focus on registering the object that was going to provide the text markers with VS (since everything else seemed fine). Previously I had done this the way it tells you to do it in the documentation - through  the IProfferService interface. This didn’t work. Tonight I tried a different tactic - using the AddService method of the IServiceContainer interface. That seemed to work (it may call into profferservice underneath…I’m not sure). You can see the results for yourself below. The classic “coding horror” face drawn in the left-hand margin of VS. Not entirely appropriate for XPath but maybe for somebody’s code review tool? The reccomended practice here is to draw something vector-ish so it can scale up to larger font sizes, but the coding horror face is more fun for a demo.

Comments

Jeff Atwood
This is awesome. I also want a VS.NET 2005 add-in that automatically submits code to http://www.thedailywtf.com while you’re at it..
26/09/2005 2:49:00 PM