Freigeben über


IVsExpansionManager Interface

Definition

Represents the expansion manager, which knows how to find and display lists of code snippets for a particular coding language.

public interface class IVsExpansionManager
public interface class IVsExpansionManager
__interface IVsExpansionManager
[System.Runtime.InteropServices.Guid("CA09E5EA-FEE7-4B52-AFE6-8EA2EC53F681")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IVsExpansionManager
[System.Runtime.InteropServices.Guid("CA09E5EA-FEE7-4B52-AFE6-8EA2EC53F681")]
[System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
public interface IVsExpansionManager
[<System.Runtime.InteropServices.Guid("CA09E5EA-FEE7-4B52-AFE6-8EA2EC53F681")>]
[<System.Runtime.InteropServices.InterfaceType(1)>]
type IVsExpansionManager = interface
[<System.Runtime.InteropServices.Guid("CA09E5EA-FEE7-4B52-AFE6-8EA2EC53F681")>]
[<System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)>]
type IVsExpansionManager = interface
Public Interface IVsExpansionManager
Derived
Attributes

Examples

This example shows how to retrieve the IVsExpansionManager interface given a service provider.

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;  
    }  
}  

Remarks

The expansion manager is a helper interface that provides access to information about code snippets. This interface can also present a list of snippets to be inserted at a particular place in a document.

Notes to Implementers

This interface is implemented by Visual Studio.

Notes to Callers

This interface is obtained by calling the GetExpansionManager(IVsExpansionManager) method in the IVsTextManager2 interface.

Methods

EnumerateExpansions(Guid, Int32, String[], Int32, Int32, Int32, IVsExpansionEnumeration)

Retrieves a list of code snippets for the specified coding language.

GetExpansionByShortcut(IVsExpansionClient, Guid, String, IVsTextView, TextSpan[], Int32, String, String)

Retrieves the title and path to a snippet given its shortcut name.

GetSnippetShortCutKeybindingState(Int32)

Determines if a key has been bound to the "Invoke Snippet From Shortcut" command.

GetTokenPath(UInt32, String)

Returns the path to the specified location.

InvokeInsertionUI(IVsTextView, IVsExpansionClient, Guid, String[], Int32, Int32, String[], Int32, Int32, String, String)

Shows an IntelliSense list of code snippets that can be inserted into the source through the provided IVsExpansionClient object.

Applies to