locked
Visual Studio Extension: How to use projection buffers to support languages embedded in C# RRS feed

  • Question

  • The projection technique projection technique can be used to customize the Visual Studio editor for supporting embedded languages.

    The examples available here, here and here (editor customization for Django) all support scripting languages embedded in HTML. The implementations seem to be tied to the built-in HTML editor.

    Does anyone have suggestions on how to achieve similar functionality for languages embedded in C#? I tried to replicate the projection buffer solution used for the Django editor and change the content type from “HTML” to “CSharp”. The editor seems to recognize the content as “code” but does not provide syntax highlighting, IntelliSense, etc.

    Thursday, July 21, 2016 3:53 PM

All replies

  • Hi Ion Neag,

    >>The editor seems to recognize the content as “code” but does not provide syntax highlighting, IntelliSense, etc.

    Please check the following link. Markdown editor in Web Essentials to support syntax highlighting & IntelliSense for embedded code blocks.

    http://blog.slaks.net/2013-12-10/syntax-highlighted-markdown-code-blocks-web-essentials/

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. 

    Microsoft does not control these sites and has not tested any software or information found on these sites;Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best regards,
    Li Wang

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Sunday, July 24, 2016 6:44 AM
  • Hi Li,

    Thank you for your response. I did look at the Markdown editor (as shown by one of the URL references included in my original question) and it appears to me that it is based on the built-in HTML editor from VS. My use case does not involve HTML content, only C# and a DSL embedded in it. Ideally, I would like to base my customization on the built-in C# editor.

    I guess I could try to use the Markdown editor approach without displaying any HTML content, by treating both C# and the DSL as embedded languages. However, I am not able to find any documentation for the APIs referenced in the Markdown editor. For example, the MarkdownBufferGenerator class derives from Microsoft.Html.Editor.ContainedLanguage. ArtifactBasedBufferGenerator. A web search for “ArtifactBasedBufferGenerator” returns only the Markdown editor source file and a GitterForum discussion on related topics. Am I missing something?

    Thanks,

    Ion

    Monday, July 25, 2016 11:51 PM