Syntax Highlighting of an Embedded Language RRS feed

  • Question

  •  I'm using C# and Visual Studio 2012 to implement syntax highlighting of a language embedded in html (much like ASP code inside <% %>). So far, I've found out that I need to use  IProjectionBuffer to achieve this, but there are no examples of how to do this using MEF, apart from a somewhat vague description here: http://msdn.microsoft.com/en-us/library/dd885240.aspx#projection. Does anybody have any ideas as to how to proceed as far as the actual implementation is concerned?
    Monday, February 18, 2013 4:08 PM

All replies

  • You can find some example from MSDN library like:


    As I know, if you want to use IProjectionBuffer, you should import the editor service of IProjectionBufferFactoryService. And create a IProjectionBuffer using CreateProjectionBuffer Method:



    Tuesday, February 19, 2013 7:13 AM
  • Thank you for your answer. I appreciate it.

    The first link is in this matter, I daresay, useless. It doesn't mention projection buffers at all as it only describes the common scenario when implementing syntax highlighting. I should have mentioned in my first post that I actually did create and IProjectionBuffer with the factory method as described in the second link. I even assigned certain spans to it from a TextBuffer containing the whole content of an editor window. However, that got me nowhere. What do I do next? An example of how this is done in code would be VERY much appreciated, but any help that'll help me move forward is welcomed.

    Tuesday, February 19, 2013 5:06 PM