locked
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:

    http://msdn.microsoft.com/en-us/library/dd885121.aspx

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

    http://msdn.microsoft.com/en-us/library/dd885994.aspx


    崖山之後無中國,明亡之後無華夏

    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