IProjectionSnapshot.MapFromSourceSnapshot Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
MapFromSourceSnapshot(SnapshotSpan) |
Maps a snapshot span of a source buffer to a list of spans of the projection snapshot. The resulting ordered list may be empty, contain a single element, or contain multiple elements. |
MapFromSourceSnapshot(SnapshotPoint, PositionAffinity) |
Maps from a snapshot point in one of the source snapshots to the corresponding position in the projection snapshot. |
MapFromSourceSnapshot(SnapshotSpan)
Maps a snapshot span of a source buffer to a list of spans of the projection snapshot. The resulting ordered list may be empty, contain a single element, or contain multiple elements.
public:
System::Collections::ObjectModel::ReadOnlyCollection<Microsoft::VisualStudio::Text::Span> ^ MapFromSourceSnapshot(Microsoft::VisualStudio::Text::SnapshotSpan span);
public System.Collections.ObjectModel.ReadOnlyCollection<Microsoft.VisualStudio.Text.Span> MapFromSourceSnapshot (Microsoft.VisualStudio.Text.SnapshotSpan span);
abstract member MapFromSourceSnapshot : Microsoft.VisualStudio.Text.SnapshotSpan -> System.Collections.ObjectModel.ReadOnlyCollection<Microsoft.VisualStudio.Text.Span>
Public Function MapFromSourceSnapshot (span As SnapshotSpan) As ReadOnlyCollection(Of Span)
Parameters
- span
- SnapshotSpan
The snapshot span in a source buffer to map.
Returns
A non-null list of spans. The list will be empty if none of the positions in span
are projected by a source span
of the projection snapshot. This list is not normalized; the spans will be ordered by their original position in the
source snapshot, not their position in the projection snapshot. Adjacent spans are not coalesced.
Exceptions
span
does not belong to a source buffer of this projection buffer.
Remarks
The resulting ordered list may be empty, contain a single element, or contain multiple elements.
Applies to
MapFromSourceSnapshot(SnapshotPoint, PositionAffinity)
Maps from a snapshot point in one of the source snapshots to the corresponding position in the projection snapshot.
public:
Nullable<Microsoft::VisualStudio::Text::SnapshotPoint> MapFromSourceSnapshot(Microsoft::VisualStudio::Text::SnapshotPoint point, Microsoft::VisualStudio::Text::PositionAffinity affinity);
public Microsoft.VisualStudio.Text.SnapshotPoint? MapFromSourceSnapshot (Microsoft.VisualStudio.Text.SnapshotPoint point, Microsoft.VisualStudio.Text.PositionAffinity affinity);
abstract member MapFromSourceSnapshot : Microsoft.VisualStudio.Text.SnapshotPoint * Microsoft.VisualStudio.Text.PositionAffinity -> Nullable<Microsoft.VisualStudio.Text.SnapshotPoint>
Public Function MapFromSourceSnapshot (point As SnapshotPoint, affinity As PositionAffinity) As Nullable(Of SnapshotPoint)
Parameters
- point
- SnapshotPoint
The snapshot point in a source buffer.
- affinity
- PositionAffinity
If the mapping is ambiguous (the position lies between two source spans), this parameter affects the mapping as follows:
if affinity
is Predecessor, the mapping targets
the position immediately after the preceding character in the projection buffer; if affinity
is
Successor, the mapping targets the position immediately before the following character
in the projection buffer. This parameter has no effect if the mapping is unambiguous.
Returns
A position in the projection snapshot, or null if the source point does not correspond to text belonging to a span that is a member of the projection snapshot.
Exceptions
point
does not belong to a source snapshot of this projection snapshot.
Remarks
In general, a source span seam occurs at the end of a source span of nonzero length and the beginning of a source span of nonzero length, and coincides with zero or more source spans of zero length. Every span on a seam has a point in the result collection.