Exemple #1
0
 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);
         }
     }
 }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
 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);
 }