如何为支持嵌入式代码段的模板或标记语言编写Visual Studio扩展 [英] How to write a Visual Studio extension for a template or markup language that supports embedded code snippets

查看:107
本文介绍了如何为支持嵌入式代码段的模板或标记语言编写Visual Studio扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以为Visual Studio 2010编写扩展程序,从而为支持嵌入式代码段的自定义模板或标记语言提供语法突出显示,智能感知,概述等功能,类似于Razor中的工具ASP .NET MVC 3?可以在不使用私有API的情况下完成此操作,而无需访问Microsoft内部文档,并且最重要的是,,而不必为嵌入式编程语言重新实现语法突出显示,智能感知等功能(例如C#或VB)?

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)?

SDK文档似乎建议 Visual Studio编辑器通过 投影缓冲区支持嵌入式语言 ,但实际上并没有提供任何细节或示例. IVsTextBufferCoordinator ,但文档没有"关于所有这些部分如何组合在一起,我不多说.

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?

也许有人对支持嵌入式语言的API有更多了解吗?或者可以为我指明正确的方向?

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

推荐答案

您应该看看 https://以github.com/SparkViewEngine/SparkSense 为例.它是为Spark View引擎构建的,可为VS 2010提供智能感知.

You should take a look at https://github.com/SparkViewEngine/SparkSense as an example. It was built for the spark view engine to provide intellisense for VS 2010.

"SparkSense是Visual Studio 2010的插件,当将Spark用作包括ASP.NET MVC在内的各种MVC框架的View Engine时,它将启用各种工具支持和生产力功能"

"SparkSense is a plugin for Visual Studio 2010 that enables various tooling support and productivity features when using Spark as a View Engine for various MVC frameworks including ASP.NET MVC"

这篇关于如何为支持嵌入式代码段的模板或标记语言编写Visual Studio扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆