Creating a new tool window that uses my custom language service?

Locked Creating a new tool window that uses my custom language service?

  • Saturday, July 28, 2012 9:17 AM
     
      Has Code

    I've written a language service for an internal scripting language we use at my company. It's working great and is doing everything I need it to do. Now, I'm trying to write a listener window tool for the scripting language so that scripts can be executed during development. What I want to do is have this new tool window automatically use the language service I've written to give me syntax coloring and such.

    How can I tell VS that my new tool window is supposed to use the language service I've written?

    So far I've tried creating a new content type and linking that content type with the extension the language service is registered to use, but that doesn't seem to work:

    	internal static class FileAndContentTypeDefinitions
    	{
    		[Export]
    		[Name("DC")]
    		[BaseDefinition("code")]
    		internal static ContentTypeDefinition DCContentTypeDefinition;
    
    		[Export]
    		[FileExtension(".dc")]
    		[ContentType("DC")]
    		internal static FileExtensionToContentTypeDefinition DCFileExtensionDefinition;
    	}

    My language service registers the .dc file extension as its own.

    What is the correct way to do this? Thanks in advance!

     - Dylan

All Replies

  • Saturday, July 28, 2012 10:25 AM
     
     
    I've tried using SetLanguageServiceId on my IVsTextLines object, and while I can see internally that the types seem to be changed to my DC content type, I don't get any syntax coloring or anything that happens when I open an actual .dc file in VS' normal editor window.
  • Saturday, July 28, 2012 10:44 AM
     
     

    Furthermore, stepping into the VS Editor implementation DLLs with .NET Reflector, I can see that my language service is getting set correctly for the VsTextBufferAdapter object. So I guess my question is now "why isn't the syntax coloring showing up?"

     - Dylan