LanguageService.GetIVsTextMacroHelperIfRecordingOn Method

Definition

Returns an IVsTextMacroHelper object if macro recording is turned on.

public:
 Microsoft::VisualStudio::TextManager::Interop::IVsTextMacroHelper ^ GetIVsTextMacroHelperIfRecordingOn();
public:
 Microsoft::VisualStudio::TextManager::Interop::IVsTextMacroHelper ^ GetIVsTextMacroHelperIfRecordingOn();
Microsoft::VisualStudio::TextManager::Interop::IVsTextMacroHelper GetIVsTextMacroHelperIfRecordingOn();
public Microsoft.VisualStudio.TextManager.Interop.IVsTextMacroHelper GetIVsTextMacroHelperIfRecordingOn ();
member this.GetIVsTextMacroHelperIfRecordingOn : unit -> Microsoft.VisualStudio.TextManager.Interop.IVsTextMacroHelper
Public Function GetIVsTextMacroHelperIfRecordingOn () As IVsTextMacroHelper

Returns

If successful, returns an IVsTextMacroHelper object; otherwise, returns a null value.

Examples

The following is an example of how this method is implemented in the base LanguageService class.

namespace Microsoft.VisualStudio.Package  
{  
    [CLSCompliant(false), ComVisible(true)]  
    public abstract class LanguageService  
        : IDisposable  
        , IVsLanguageInfo  
        , IVsLanguageDebugInfo  
        , IVsProvideColorableItems  
        , IVsLanguageContextProvider  
        , IOleServiceProvider  
        , IObjectWithSite  
        , ISynchronizeInvoke  
        , IVsDebuggerEvents  
        , IVsFormatFilterProvider  
    {   
        public IVsTextMacroHelper GetIVsTextMacroHelperIfRecordingOn()  
        {  
            if (IsMacroRecordingOn()) {  
                IVsTextManager textmgr = (IVsTextManager)this.GetService(  
                                             typeof(SVsTextManager));  
                return (IVsTextMacroHelper)textmgr;  
            }  
            return null;  
        }  
    }  
}  

Remarks

The IVsTextMacroHelper object is obtained by calling Microsoft.VisualStudio.Package.LanguageService.GetService with the GUID of the SVsTextManager service and casting the returned object to an IVsTextMacroHelper object.

Applies to