IVsExpansionManager 接口

表示外接管理器中,将发现,并显示特定代码的语言的代码段。

命名空间:  Microsoft.VisualStudio.TextManager.Interop
程序集:  Microsoft.VisualStudio.TextManager.Interop.8.0(在 Microsoft.VisualStudio.TextManager.Interop.8.0.dll 中)

语法

声明
<GuidAttribute("CA09E5EA-FEE7-4B52-AFE6-8EA2EC53F681")> _
<InterfaceTypeAttribute()> _
Public Interface IVsExpansionManager
[GuidAttribute("CA09E5EA-FEE7-4B52-AFE6-8EA2EC53F681")]
[InterfaceTypeAttribute()]
public interface IVsExpansionManager
[GuidAttribute(L"CA09E5EA-FEE7-4B52-AFE6-8EA2EC53F681")]
[InterfaceTypeAttribute()]
public interface class IVsExpansionManager
[<GuidAttribute("CA09E5EA-FEE7-4B52-AFE6-8EA2EC53F681")>]
[<InterfaceTypeAttribute()>]
type IVsExpansionManager =  interface end
public interface IVsExpansionManager

IVsExpansionManager 类型公开以下成员。

方法

  名称 说明
公共方法 EnumerateExpansions 检索代码段列表指定的代码的语言。
公共方法 GetExpansionByShortcut 检索前缀和路径。命名的代码段的快捷方式名称。
公共方法 GetSnippetShortCutKeybindingState 基础结构。 确定键是否必须为 “调用从快捷的代码段”命令。
公共方法 GetTokenPath 返回路径到指定的位置。
公共方法 InvokeInsertionUI 显示 IntelliSense 可插入到源通过提供的 IVsExpansionClient 对象的列表代码段。

页首

备注

扩展管理器是提供对有关代码段的信息的帮助器接口。 此接口也可以提供要插入的代码段的列表以特殊的封送处理在文档。

对实现者的说明

此接口由 Visual Studio实现。

对调用者的说明

此接口通过调用 IVsTextManager2 接口的 GetExpansionManager 方法获取。

示例

此示例演示如何检索给定的 IVsExpansionManager 接口服务提供程序。

using System;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.TextManager.Interop;
using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider;

namespace MyPackage
{
    public class MyClass
    {
        public object GetService(IOleServiceProvider serviceProvider,
                                 Guid serviceGuid,
                                 Guid interfaceGuid)
        {
            IntPtr pUnknown = IntPtr.Zero;
            object unknown = null;
            int hr = serviceProvider.QueryService(ref serviceGuid,
                                    ref interfaceGuid,
                                    out pUnknown);
            if (ErrorHandler.Succeeded(hr))
            {
                unknown = Marshal.GetObjectForIUnknown(pUnknown);
            }
            return unknown;
        }


        private IVsExpansionManager GetExpansionManager(IOleServiceProvider serviceProvider)
        {
            IVsExpansionManager expansionManager = null;
            IVsTextManager textManager;
            textmanager = (IVsTextManager)this.GetService(serviceProvider,
                                                          typeof(SVsTextManager).GUID,
                                                          typeof(IVsTextManager).GUID);
            if (textManager != null)
            {
                IVsTextManager2 textManager2 = (IVsTextManager2)textManager;
                if (textManager2 != null)
                {
                    textManager2.GetExpansionManager(out expansionManager);
                }
            }
        }
        return expansionManager;
    }
}

请参阅

参考

Microsoft.VisualStudio.TextManager.Interop 命名空间