共用方式為


IVsTextMarkerContextProvider Interface

Provides context for text markers in the core editor.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)

Syntax

'宣告
<GuidAttribute("F1671B6B-1090-4DFF-BBFD-133EB428BB6C")> _
<InterfaceTypeAttribute()> _
Public Interface IVsTextMarkerContextProvider
'用途
Dim instance As IVsTextMarkerContextProvider
[GuidAttribute("F1671B6B-1090-4DFF-BBFD-133EB428BB6C")]
[InterfaceTypeAttribute()]
public interface IVsTextMarkerContextProvider
[GuidAttribute(L"F1671B6B-1090-4DFF-BBFD-133EB428BB6C")]
[InterfaceTypeAttribute()]
public interface class IVsTextMarkerContextProvider
[<GuidAttribute("F1671B6B-1090-4DFF-BBFD-133EB428BB6C")>]
[<InterfaceTypeAttribute()>]
type IVsTextMarkerContextProvider =  interface end
public interface IVsTextMarkerContextProvider

Remarks

For each text marker type in the core editor, the environment creates a separate IVsTextMarkerContextProvider object (text marker). Whenever the cursor in an editor is over a text marker, the environment queries to see if the IVsTextMarkerContextProvider interface is implemented. If this interface is implemented, then the environment calls UpdateContextForMarker and passes a pointer to the context bag for the editor. Write your implementation of this method so that when called by the environment, you update the context for the text marker in the editor's context bag. For more information, see IVsUserContext::AddAttribute.

When the editor's cursor moves off of the text marker, the environment calls UpdateContextForMarker and passes you a pointer to the editor's context bag to allow you to remove the context for the last text marker. For more information, see RemoveAttribute.

注意

The Visual Studio core editor provides the text marker in addition to the keyword at the cursor during updates.

Use the following steps to add context for text markers to the Dynamic Help window:

Your IVsTextMarkerContextProvider implementation is called twice every time context is to be added, once when the context is added and once more when the context is to be removed.

Notes to Implementers

Implemented by the language service to provide context for text markers (for example, compiler errors) in the Visual Studio core editor. The core editor calls QueryInterface on IVsTextLayerMarker to return a pointer to IVsTextMarkerContextProvider.

Notes to Callers

Called by the Visual Studio core editor to indicate that context is updating.

See Also

Reference

IVsTextMarkerContextProvider Members

Microsoft.VisualStudio.TextManager.Interop Namespace