LanguageService.GetIVsTextMacroHelperIfRecordingOn Method

Returns an IVsTextMacroHelper object if macro recording is turned on.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)

Syntax

'Declaration
Public Function GetIVsTextMacroHelperIfRecordingOn As IVsTextMacroHelper
public IVsTextMacroHelper GetIVsTextMacroHelperIfRecordingOn()
public:
IVsTextMacroHelper^ GetIVsTextMacroHelperIfRecordingOn()
member GetIVsTextMacroHelperIfRecordingOn : unit -> IVsTextMacroHelper
public function GetIVsTextMacroHelperIfRecordingOn() : IVsTextMacroHelper

Return Value

Type: Microsoft.VisualStudio.TextManager.Interop.IVsTextMacroHelper
If successful, returns an IVsTextMacroHelper object; otherwise, returns a null value.

Remarks

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

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

.NET Framework Security

See Also

Reference

LanguageService Class

Microsoft.VisualStudio.Package Namespace