LanguagePreferences.OnRegisterMarkerType Method
Called when a new marker type is registered with Visual Studio.
Namespace: Microsoft.VisualStudio.Package
Assemblies: 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.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Syntax
'Декларация
Public Overridable Function OnRegisterMarkerType ( _
iMarkerType As Integer _
) As Integer
public virtual int OnRegisterMarkerType(
int iMarkerType
)
Parameters
- iMarkerType
Type: System.Int32
[in] The ID of the marker type.
Return Value
Type: System.Int32
Implements
IVsTextManagerEvents2.OnRegisterMarkerType(Int32)
Remarks
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.
Examples
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.
}
}
}
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.