private static void SplitMapDownToFirstMatchNoTrack(FrugalList <SnapshotSpan> unmappedSpans, Predicate <ITextBuffer> match, IList <SnapshotSpan> mappedSpans, bool mapByContentType) { ITextSnapshot matchingSnapshot = null; while (unmappedSpans.Count > 0) { SnapshotSpan span = unmappedSpans[unmappedSpans.Count - 1]; unmappedSpans.RemoveAt(unmappedSpans.Count - 1); if (span.Snapshot == matchingSnapshot) { mappedSpans.Add(span); } else if (match(span.Snapshot.TextBuffer)) { mappedSpans.Add(span); matchingSnapshot = span.Snapshot; } else { IProjectionSnapshot spanSnapshotAsProjection = span.Snapshot as IProjectionSnapshot; if (spanSnapshotAsProjection != null && (!mapByContentType || span.Snapshot.TextBuffer.ContentType.IsOfType("projection"))) { unmappedSpans.AddRange(spanSnapshotAsProjection.MapToSourceSnapshots(span)); } } } }
private static void SplitMapDownToBufferNoTrack(FrugalList <SnapshotSpan> unmappedSpans, ITextBuffer targetBuffer, IList <SnapshotSpan> mappedSpans, bool mapByContentType) { while (unmappedSpans.Count > 0) { SnapshotSpan span = unmappedSpans[unmappedSpans.Count - 1]; unmappedSpans.RemoveAt(unmappedSpans.Count - 1); if (span.Snapshot.TextBuffer == targetBuffer) { mappedSpans.Add(span); } else { IProjectionSnapshot spanSnapshotAsProjection = span.Snapshot as IProjectionSnapshot; if (spanSnapshotAsProjection != null && (!mapByContentType || span.Snapshot.TextBuffer.ContentType.IsOfType("projection"))) { unmappedSpans.AddRange(spanSnapshotAsProjection.MapToSourceSnapshots(span)); } } } }