LanguagePreferences::OnRegisterMarkerType Method (Int32)

 

Called when a new marker type is registered with Visual Studio.

Namespace:   Microsoft.VisualStudio.Package
Assembly:  Microsoft.VisualStudio.Package.LanguageService.14.0 (in Microsoft.VisualStudio.Package.LanguageService.14.0.dll)

public:
virtual int OnRegisterMarkerType(
	int iMarkerType
)

Parameters

iMarkerType
Type: System::Int32

[in] The ID of the marker type.

Return Value

Type: System::Int32

This method is called whenever a new marker type is registered. Call the GetMarkerTypeInterface method with the specified marker ID to obtain an IVsTextMarkerType object that can be queried for details on the new marker type. A language service typically does not need to implement this method.

This method is an implementation of IVsTextManagerEvents2::OnRegisterMarkerType.

The base method does nothing.

Here is an example of how to obtain the IVsTextManager2 interface and get the marker type.

using Microsoft.VisualStudio.Package;

namespace MyLanguagePackage
{
    class MyLanguagePreferences : LanguagePreferences
    {
        override public void OnRegisterMarkerType(int iMarkerType)
        {
            IVsTextManager2 pTextManager;
            pTextManager = Site.GetService(typeof(SVsTextManager)) as IVsTextManager2;
            if (pTextManager != null)
            {
                IVsTextMarkerType pMarkerType;
                pTextManager.GetMarkerTypeInterface(iMarkerType,out pMarkerType);
                if (pMarkerType != null)
                {
                    // Examine marker type here.
                }
            }
        }
    }
}
Return to top
Show: