冲突的扩展问题 - 通过IVsTextView检测调试器画布 [英] Conflicting extension issue - Detecting Debugger Canvas via IVsTextView

查看:80
本文介绍了冲突的扩展问题 - 通过IVsTextView检测调试器画布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在编写Visual Studio的扩展,它与Debugger Canvas有一些冲突。最后我得到一个属于Debugger Canvas选项卡的IVsTextView,但我不知道如何将其检测为一个。我试图得到它的窗框,使用代码
,如下所示:

We're writing an extension to Visual Studio which has some conflicts with Debugger Canvas. In the end I am getting an IVsTextView that belongs to Debugger Canvas tab, but I am not sure how to detect it as one. I've tried to get its window frame, using code like this:


            IVsWindowFrame windowFrame = null;
            IObjectWithSite objWithSite = (IObjectWithSite)view;

            IntPtr ip;
            Guid serviceProviderGuid = typeof(IServiceProvider).GUID;
            objWithSite.GetSite(ref serviceProviderGuid, out ip);
            if (ip != IntPtr.Zero)
            {
                IServiceProvider serviceProvider = (IServiceProvider)Marshal.GetObjectForIUnknown(ip);
                Marshal.Release(ip);

                Guid windowFrameTypeGuid = typeof(SVsWindowFrame).GUID;
                Guid windowFrameInterfaceGuid = typeof(IVsWindowFrame).GUID;
                serviceProvider.QueryService(ref windowFrameTypeGuid, ref windowFrameInterfaceGuid, out ip);
                if (ip != IntPtr.Zero)
                {
                    windowFrame = (IVsWindowFrame)Marshal.GetObjectForIUnknown(ip);
                    Marshal.Release(ip);
                }
            }

推荐答案

Hi Vitaly,

Hi Vitaly,

您可以检查ITextView的TextBuffer或TextViewModel。如果您在画布中,则"编辑缓冲区"的内容类型将是投影。如果你在一个完整的标签中它将是CSharp,Basic等。

You could check the TextBuffer or the TextViewModel of the ITextView. If you are in the canvas the content type of the EditBuffer will be a projection. And if you're in a full tab it will be CSharp, Basic, etc.

您可以使用IVsEditorAdaptersFactoryService :: GetWpfTextView(IVsTextView适配器)从IVsTextView获取ITextView。

You can use IVsEditorAdaptersFactoryService::GetWpfTextView(IVsTextView adapter) to get the ITextView from the IVsTextView.

如果您认为此解决方案可以解决您的问题或者您需要更多信息,请与我们联系。

Please let me know if you think this solution could fix your issue or if you need more info.

 

谢谢!

Adrian


这篇关于冲突的扩展问题 - 通过IVsTextView检测调试器画布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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