使用托管程序包框架实现语言服务 [英] Implementing a Language Service By Using the Managed Package Framework

查看:90
本文介绍了使用托管程序包框架实现语言服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照演练中列出的步骤进行操作( http://msdn.microsoft.com/zh-cn/library/bb166360.aspx ),用于实现和注册LanguageService,但我根本无法使其正常工作.

I've followed the steps listed in the walk through (http://msdn.microsoft.com/en-us/library/bb166360.aspx) for implementing and registering a LanguageService and I simply can't get it to work.

我的程序包正确加载,可以添加功能菜单项和选项页面,但是无法打开注册到我的服务的文件.当我连接调试器时,我可以看到我的VSPackage正在构建,加载并使其FDoIdle方法被调用了两次.在那之后,实验性的Visual Studio会话陷入了困境,似乎陷入了无限循环.如果我尝试将.txt文件保存为我的文件类型,则该文件会正确保存,但不会在Visual Studio中加载,并且会出现Object null异常.

My package loads correctly, I can add functioning menu items and option pages, but I cannot open files registered to my service. When I attach a debugger, I can see my VSPackage being constructed, loaded, and having its FDoIdle method called twice. After that, experimental Visual Studio session goes off into the weeds and appears to get stuck in an infinite loop. If I try to save a .txt file as my file type, the file is saved correctly but it does not load in Visual Studio and I get an Object null exception.

我可以看到我在此问题中提到的问题:

I can see my problem mentioned in this question: Visual studio 2010 colourizers, intellisense and the rest. Where to start!

该解决方案似乎是不使用托管程序包框架,而是使用管理扩展性框架.太好了,但我真的很想知道我在MPF LanguageService实施中做错了什么.

The resolution seems to be to not use the Managed Package Framework and instead use the Manage Extensibility Framework. That's great and all, but I'd really like to know what I'm doing wrong with my MPF LanguageService implementation.

有人使用MPF成功创建了LanguageService吗?任何人都可以将我引向一个可行的示例或演练吗?

Has anyone successfully created a LanguageService by using MPF? Can anyone direct me to a working example or walkthrough?

问题已解决!:

我做了一些进一步的调试,并注意到实验性的Visual Studio实例被卡住了,反复调用以下内容:

I did some further debugging and noticed the experimental Visual Studio instance getting stuck calling the following repeatedly:

Microsoft.VisualStudio.Editor.Implementation.VsFontsAndColorsInformation.TryGetIndexForNativeItem(字符串名称,IVsColorTable colorTable,Int32& colorTableIndex)

Microsoft.VisualStudio.Editor.Implementation.VsFontsAndColorsInformation.TryGetIndexForNativeItem(String name, IVsColorTable colorTable, Int32& colorTableIndex)

直觉上,我在ProvideLanguageServiceAttribute中将RequestStockColors参数指定为true,现在可以打开文件类型了.我简单的扫描仪甚至具有有效的语法着色!

On a hunch I specified the RequestStockColors parameter to true in the ProvideLanguageServiceAttribute, and I can now open my file type. My simple scanner even has working syntax coloring!

推荐答案

问题已解决!:

我做了一些进一步的调试,并注意到实验性的Visual Studio实例被卡住了,反复调用以下内容:

I did some further debugging and noticed the experimental Visual Studio instance getting stuck calling the following repeatedly:

Microsoft.VisualStudio.Editor.Implementation.VsFontsAndColorsInformation.TryGetIndexForNativeItem(字符串名称,IVsColorTable colorTable,Int32& colorTableIndex)

Microsoft.VisualStudio.Editor.Implementation.VsFontsAndColorsInformation.TryGetIndexForNativeItem(String name, IVsColorTable colorTable, Int32& colorTableIndex)

直觉上,我在ProvideLanguageServiceAttribute中将RequestStockColors参数指定为true,现在可以打开文件类型了.我简单的扫描仪甚至具有有效的语法着色!

On a hunch I specified the RequestStockColors parameter to true in the ProvideLanguageServiceAttribute, and I can now open my file type. My simple scanner even has working syntax coloring!

这篇关于使用托管程序包框架实现语言服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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