internal static ITextSnapshot FindCorrespondingSnapshot(ITextSnapshot sourceSnapshot, Predicate <ITextBuffer> match) { if (match(sourceSnapshot.TextBuffer)) { // simple case: single buffer return(sourceSnapshot); } else { IProjectionSnapshot2 projSnap = sourceSnapshot as IProjectionSnapshot2; if (projSnap != null) { return(projSnap.GetMatchingSnapshotInClosure(match)); } else { return(null); } } }
public override ITextSnapshot GetMatchingSnapshotInClosure(ITextBuffer textBuffer) { if (textBuffer == null) { throw new ArgumentNullException("textBuffer"); } if (this.sourceSnapshot.TextBuffer == textBuffer) { return(this.sourceSnapshot); } IProjectionSnapshot2 projSnap = this.sourceSnapshot as IProjectionSnapshot2; if (projSnap != null) { return(projSnap.GetMatchingSnapshotInClosure(textBuffer)); } return(null); }
public override ITextSnapshot GetMatchingSnapshotInClosure(Predicate <ITextBuffer> match) { if (match == null) { throw new ArgumentNullException("match"); } if (match(this.sourceSnapshot.TextBuffer)) { return(this.sourceSnapshot); } IProjectionSnapshot2 projSnap = this.sourceSnapshot as IProjectionSnapshot2; if (projSnap != null) { return(projSnap.GetMatchingSnapshotInClosure(match)); } return(null); }
public override ITextSnapshot GetMatchingSnapshotInClosure(Predicate <ITextBuffer> match) { if (match == null) { throw new ArgumentNullException("match"); } foreach (ITextSnapshot snappy in this.sourceSnapshotMap.Keys) { if (match(snappy.TextBuffer)) { return(snappy); } IProjectionSnapshot2 projSnappy = snappy as IProjectionSnapshot2; if (projSnappy is IProjectionSnapshot2) { ITextSnapshot maybe = projSnappy.GetMatchingSnapshotInClosure(match); if (maybe != null) { return(maybe); } } } return(null); }