Visual Studio 2010着色器,智能感知器及其他.从哪儿开始! [英] Visual studio 2010 colourizers, intellisense and the rest. Where to start!

查看:123
本文介绍了Visual Studio 2010着色器,智能感知器及其他.从哪儿开始!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,在我开始之前,我意识到有很多关于此主题的文档,但是到目前为止,我什至没有为VS2010进行基本的着色.

我的目标是简单地打开一个文档,所有内容都变成红色,从这里我可以实现相关的解析逻辑.

这是我尝试过/发现的:

1)下载了所有的relevent SDK,并找到了ook示例( http://code.msdn .microsoft.com/ookLanguage )-未构建,无法正常工作.

2)通过使用托管包框架实现语言服务"一文,对MEF几乎一无所知-

对于MEF示例,我的假设是我需要加入"IScanner.ScanTokenAndProvideInfoAboutIt"以提供语法高亮显示?如果我能使用这种方法,那会很好.

所以我想我的第一个问题是我应该在这里采用哪种方法?还是两者都以某种方式联系在一起?

我的第二个问题是,在哪里可以找到实现沼泽标准基本语法突出显示和智能感知或VS2010的基本正常工作项目?

第三,在我创建包的MEF示例中,为我创建了一堆测试项目.我似乎认为集成测试以某种方式启动了VS2010测试平台,但测试失败.用测试编写我的服务会很好,但是我不知道我可以/如何测试每个交互,因此对测试语言服务的任何引用都将有所帮助.

最后,请以我认为有用的方式抛出任何资源/书籍链接.

干杯,克里斯.

抱歉,我意识到这是部分问题,但我从来没有这么困惑过.

解决方案

首先,使用MEF 打包示例.基本上,您在问题中提到MEF的每个地方实际上都不是MEF,而是托管包框架(MPF),俗称托管语言服务(MLS).您会通过两种方式知道您的扩展是否正在使用MEF:vsixmanifest将您的程序集列出为包含MEF组件,并且您在代码中看到了[Export][Import]属性.

最简单的方法 是使用MEF.因为已经安装了SDK,所以您还拥有一个用于编辑器分类器项目的模板(在新建项目"对话框的C# (or VB)->Extensibility->Editor classifier下).您当然可以使用语言服务/着色器/程序包来执行此操作,但是比等效的分类器要多得多的代码.

Ook解决方案是此示例,并且应该工作;如果它无法构建/正常工作,那么您可以给我发送电子邮件(在Microsoft中为noahric),提示您看到了什么错误,以便可以向该样本的所有者发送电子邮件给我?

通常,您还应该阅读

Ok, before I begin I realize that there is a lot of documentation on this subject but I have thus far failed to get even basic colourization working for VS2010.

My goal is to simply get to a point where I can open a document and everything is coloured red, from here I can implement the relevant parsing logic.

Here's what I have tried/found:

1) Downloaded all the relevent SDK's and such- Found the ook sample (http://code.msdn.microsoft.com/ookLanguage) - didn't build, didn't work.

2) Knowing almost nothing about MEF read through "Implementing a Language Service By Using the Managed Package Framework" - http://msdn.microsoft.com/en-us/library/bb166533(v=VS.100).aspx

This was pretty much a copy and paste of all the basic stuff here, and also updating some references which were out of date with the sample see: http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/a310fe67-afd2-4592-b295-3fc86fec7996

Now, I have got to a point where when running the package MEF appears to have hooked up correctly (I know this because with the debugger open I can see that the packages initialize and FDoIdle methods are being hit).

When I open a file of the extension I have registered with the ProvideLanguageExtensionAttribute everything dies as if in an endless loop, yet no debug symbols hit (though they are loaded).

Looking at the ook sample and the MEF examples they seem to be totally different approaches to the same problem. In the ook sample there are notions of Clasifications and Completion controllers which aren't mentioned in the MEF example. Also, they don't seem to create a Package or Language service, so I have no idea how it should work?

With the MEF example, my assumption is that I need to hook into the "IScanner.ScanTokenAndProvideInfoAboutIt" to provide syntax highlighting? Which would be fine if I could ever hit this method.

So my first question I guess is which approach should I be taking here? Or do they both somehow tie together?

My second questions is, where can I find a basic fully working project that implements bog standard basic syntax highlighting and intellisense or VS2010?

Thirdly, in the MEF example when I created a Package there were a bunch of test projects created for me. I appears that the integration tests launch the VS2010 test rig somehow, but the test fails. It would be good to write my service with tests but I have no idea what/how I can test each interaction so any references to testing Language services would be helpful.

Finally, please throw any resource/book links my way that I may find useful.

Cheers, Chris.

N.B. Sorry I realize this is part question part rant, but I have never been so confused.

解决方案

First, the package example is not using MEF. Essentially everyplace that you mention MEF in your question is not actually MEF, but the managed package framework (MPF), also colloquially called the managed language service (MLS). You'd know if your extension was using MEF by two things: the vsixmanifest lists your assembly as containing a MEF component, and you see [Export] and [Import] attributes in the code.

The easiest way to do this is to use MEF. Since you have the SDK installed, you also have a template for an editor classifier project (under C# (or VB)->Extensibility->Editor classifier in the New Project dialog). You can certainly do this with a language service/colorizer/package, but there will be significantly more code than the equivalent classifier.

The Ook solution is the sample for this and should work; if it doesn't build/work, then can you send me email (noahric at microsoft) with what errors you are seeing so I can email the owner of that sample?

In general, you should also read my answer for the question on "How can I write a plugin for VS2010 using MEF?". That has links to other resources that should help.

这篇关于Visual Studio 2010着色器,智能感知器及其他.从哪儿开始!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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