title: Does anyone have an example of creating a custom text marker in Visual Studio?
body: <p>In case my initial approach is wrong, here's what I'm trying to accomplish.  I want to be able to recognize snippets of text in my code editor (I'm using C#, but that shouldn't matter) and change the way they are formatted.  Perhaps use different colors or fonts, etc.  I started off thinking this would be as easy as popping a regular expression into a config file somewhere and setting some defaults... not so much.  </p>
  
  <p>I've so far identified two potential ways to do this, the first is by creating a new Language Service for Visual Studio.  I don't think this makes sense because I'm really only augmenting the default C# lex &amp; parse.</p>
  
  <p>The second is by <a href="http://msdn.microsoft.com/en-us/library/bb165758(VS.80).aspx" rel="nofollow noreferrer">How to: Create Custom Text Markers</a>. This seems better, because if I'm reading it correctly this will allow me to create my own rules for recognizing sections of text (regex, etc) in the IDE and add Text Markers based on that.  Those will then be exposed in the Options -> Environment -> Fonts and Colors area in Visual Studio Options (similar to ReSharper Overrides, ReSharper DeadCode, etc.).</p>
  
  <p>Assuming the Custom Text Markers route is the way to go, and I'm open to other ideas, I need to implement the <a href="http://msdn.microsoft.com/en-us/library/bb165758(VS.80).aspx" rel="nofollow noreferrer">IVsPackageDefinedTextMarkerType</a> interface and implement the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.textmanager.interop.ivstextmarkertypeprovider.gettextmarkertype(VS.80).aspx" rel="nofollow noreferrer">GetTextMarkerType</a> method.  Sounds pretty straight forward...</p>
  
  <p>I then need to "proffer [my] marker type as a service", this is where I get a little lost.  There is an example of creating a custom service in the Visual Studio SDK, but I can't figure out how to tie the two together.  I've still got a lot of research to do on this topic, so I may answer my own question, but it'd be nice if someone could save me some time!</p>