Visual studio 2010 着色器、智能感知等。从哪里开始!

发布于 2024-09-04 08:20:06 字数 1524 浏览 9 评论 0原文

好吧,在开始之前我意识到有很多关于这个主题的文档,但到目前为止我还没有获得适用于 VS2010 的基本着色。

我的目标是简单地达到可以打开文档并且所有内容都变成红色的程度,从这里我可以实现相关的解析逻辑。

这是我尝试/发现的:

1)下载了所有相关的 SDK 等 - 找到了 ook 示例(http: //code.msdn.microsoft.com/ookLanguage) - 未构建,不起作用。

2)对 MEF 几乎一无所知,请阅读“使用托管包框架实现语言服务” - http://msdn.microsoft.com/en-us/library/bb166533(v=VS.100).aspx

这几乎是所有内容的复制和粘贴这里的基本内容,以及更新一些与示例一起过时的参考,请参阅:http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/a310fe67-afd2-4592-b295-3fc86fec7996

现在,我已经到了这样的地步:运行包 MEF 时似乎已正确连接(我知道这一点是因为打开调试器后我可以看到包初始化和 FDoIdle 方法正在被命中)。

当我打开已向 ProvideLanguageExtensionAttribute 注册的扩展文件时,一切都会消失,就像陷入无限循环一样,但没有命中任何调试符号(尽管它们已加载)。

查看 ook 示例和 MEF 示例,它们似乎是解决同一问题的完全不同的方法。在 ook 示例中,存在 MEF 示例中未提及的分类和完成控制器的概念。另外,他们似乎没有创建包或语言服务,所以我不知道它应该如何工作?

对于 MEF 示例,我的假设是我需要连接到“IScanner.ScanTokenAndProvideInfoAboutIt”来提供语法突出显示?如果我能用这个方法就好了。

所以我想我的第一个问题是我应该在这里采取哪种方法?或者他们两者是否以某种方式联系在一起?

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

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

最后,请向我提供任何我可能觉得有用的资源/书籍链接。

干杯,克里斯。

注意:抱歉,我意识到这一部分是问题,一部分是咆哮,但我从来没有这么困惑过。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼波传意 2024-09-11 08:20:06

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

最简单的方法是使用 MEF。由于您已经安装了 SDK,因此您还有一个编辑器分类器项目的模板(在“新建项目”对话框中的“C#(或 VB)->扩展性->编辑器分类器”下)。您当然可以使用语言服务/着色器/包来做到这一点,但代码会比等效的分类器多得多。

Ook 解决方案就是此示例,应该可以工作;如果它无法构建/工作,那么您可以向我发送电子邮件(微软的 noahric),说明您看到的错误,以便我可以向该示例的所有者发送电子邮件吗?

一般来说,您还应该阅读我的回答“如何使用 MEF 为 VS2010 编写插件?”的问题。其中包含其他应该有帮助的资源的链接。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文