How to write a Visual Studio extension for a template or markup language that supports embedded code snippets

Is it possible to write an extension for Visual Studio 2010 that provides syntax highlighting, intellisense, outlining, etc for a custom template or markup language supporting embedded code snippets, 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, most importantly, without having to reimplement syntax highlighting, intellisense, etc. for the embedded programming language (i.e. C# or VB)?

The SDK documentation seems to suggest that the Visual Studio editor supports embedded languages via projection buffers, but it doesn't really give any details or examples. Some of the "legacy interop interfaces used for the editor and language services" in Microsoft.VisualStudio.TextManager.Interop also seem to be relevant, e.g. IVsTextBufferCoordinator, but the documentation doesn't say much about how all these pieces fit together.

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?

Does maybe anyone have more information on the APIs relevant for supporting embedded languages or could point me into the right direction?

14
задан Stephan Tolksdorf 2 May 2011 в 21:08
поделиться