共用方式為


IBufferGraph.MapUpToFirstMatch Method

Definition

Overloads

MapUpToFirstMatch(SnapshotSpan, SpanTrackingMode, Predicate<ITextSnapshot>)

Maps a span in the current snapshot of some buffer that is a member of the buffer graph up to a sequence of spans in a snapshot of some buffer that is selected by a predicate.

MapUpToFirstMatch(SnapshotPoint, PointTrackingMode, Predicate<ITextSnapshot>, PositionAffinity)

Maps a position in the current snapshot of some buffer that is a member of the buffer graph to a snapshot of some buffer that is selected by a predicate.

MapUpToFirstMatch(SnapshotSpan, SpanTrackingMode, Predicate<ITextSnapshot>)

Maps a span in the current snapshot of some buffer that is a member of the buffer graph up to a sequence of spans in a snapshot of some buffer that is selected by a predicate.

public:
 Microsoft::VisualStudio::Text::NormalizedSnapshotSpanCollection ^ MapUpToFirstMatch(Microsoft::VisualStudio::Text::SnapshotSpan span, Microsoft::VisualStudio::Text::SpanTrackingMode trackingMode, Predicate<Microsoft::VisualStudio::Text::ITextSnapshot ^> ^ match);
public Microsoft.VisualStudio.Text.NormalizedSnapshotSpanCollection MapUpToFirstMatch (Microsoft.VisualStudio.Text.SnapshotSpan span, Microsoft.VisualStudio.Text.SpanTrackingMode trackingMode, Predicate<Microsoft.VisualStudio.Text.ITextSnapshot> match);
abstract member MapUpToFirstMatch : Microsoft.VisualStudio.Text.SnapshotSpan * Microsoft.VisualStudio.Text.SpanTrackingMode * Predicate<Microsoft.VisualStudio.Text.ITextSnapshot> -> Microsoft.VisualStudio.Text.NormalizedSnapshotSpanCollection
Public Function MapUpToFirstMatch (span As SnapshotSpan, trackingMode As SpanTrackingMode, match As Predicate(Of ITextSnapshot)) As NormalizedSnapshotSpanCollection

Parameters

span
SnapshotSpan

A span in some buffer in the IBufferGraph.

trackingMode
SpanTrackingMode

How span is tracked to the current snapshot if necessary.

match
Predicate<ITextSnapshot>

The predicate that identifies the target buffer.

Returns

A collection of zero or more snapshot spans in the buffer selected by match.

Exceptions

span.Snapshot or match is null.

trackingMode is not a valid SpanTrackingMode.

Remarks

match is called on each text buffer in the graph until it returns true. The predicate will not be called again.

Applies to

MapUpToFirstMatch(SnapshotPoint, PointTrackingMode, Predicate<ITextSnapshot>, PositionAffinity)

Maps a position in the current snapshot of some buffer that is a member of the buffer graph to a snapshot of some buffer that is selected by a predicate.

public:
 Nullable<Microsoft::VisualStudio::Text::SnapshotPoint> MapUpToFirstMatch(Microsoft::VisualStudio::Text::SnapshotPoint point, Microsoft::VisualStudio::Text::PointTrackingMode trackingMode, Predicate<Microsoft::VisualStudio::Text::ITextSnapshot ^> ^ match, Microsoft::VisualStudio::Text::PositionAffinity affinity);
public Microsoft.VisualStudio.Text.SnapshotPoint? MapUpToFirstMatch (Microsoft.VisualStudio.Text.SnapshotPoint point, Microsoft.VisualStudio.Text.PointTrackingMode trackingMode, Predicate<Microsoft.VisualStudio.Text.ITextSnapshot> match, Microsoft.VisualStudio.Text.PositionAffinity affinity);
abstract member MapUpToFirstMatch : Microsoft.VisualStudio.Text.SnapshotPoint * Microsoft.VisualStudio.Text.PointTrackingMode * Predicate<Microsoft.VisualStudio.Text.ITextSnapshot> * Microsoft.VisualStudio.Text.PositionAffinity -> Nullable<Microsoft.VisualStudio.Text.SnapshotPoint>
Public Function MapUpToFirstMatch (point As SnapshotPoint, trackingMode As PointTrackingMode, match As Predicate(Of ITextSnapshot), affinity As PositionAffinity) As Nullable(Of SnapshotPoint)

Parameters

point
SnapshotPoint

A point in some buffer in the IBufferGraph.

trackingMode
PointTrackingMode

How point is tracked to the current snapshot if necessary.

match
Predicate<ITextSnapshot>

The predicate that identifies the target buffer.

affinity
PositionAffinity

If the mapping is ambiguous (the position is on a source span seam), determines whether the mapping should target the position immediately after the preceding character or immediately before the following character in the top buffer. This setting has no effect if the mapping is unambiguous.

Returns

The corresponding position in a snapshot of the matching buffer, or null if does not map to the matching buffer using this graph.

Exceptions

point.Snapshot or match is null.

trackingMode is not a valid PointTrackingMode, or affinity is not a valid PositionAffinity.

Remarks

match is called for each text buffer in the buffer graph until it returns true. The predicate will not be called again.

Applies to