Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to write a Visual Studio extension for a template or markup language that supports embedded code snippets
    text
    copied!<p>Is it possible to write an extension for Visual Studio 2010 that provides syntax highlighting, intellisense, outlining, etc <strong>for a custom template or markup language supporting embedded code snippets</strong>, similar to the tooling for Razor in ASP .NET MVC 3? Can this be done without using private APIs, without access to Microsoft-internal documentation and, <em>most importantly</em>, <strong>without having to reimplement syntax highlighting, intellisense, etc. for the embedded programming language</strong> (i.e. C# or VB)?</p> <p>The SDK documentation <a href="http://msdn.microsoft.com/en-us/library/dd885240.aspx#projection" rel="noreferrer">seems to suggest</a> that the Visual Studio editor supports embedded languages via <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.text.projection.aspx" rel="noreferrer"><strong><em>projection buffers</em></strong></a>, but it doesn't really give any details or examples. Some of the "legacy interop interfaces used for the editor and language services" in <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.textmanager.interop.aspx" rel="noreferrer">Microsoft.VisualStudio.TextManager.Interop</a> also seem to be relevant, e.g. <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.textmanager.interop.ivstextbuffercoordinator.aspx" rel="noreferrer">IVsTextBufferCoordinator</a>, but the documentation doesn't say much about how all these pieces fit together. </p> <p>Provided that projection buffers actually do what I hope, where can I hook into the editor to replace a normal text buffer with a projection buffer?</p> <p>Does maybe anyone have more information on the APIs relevant for supporting embedded languages or could point me into the right direction?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload