Пример #1
0
        // returns true if brace is actually a brace.
        private bool FindOtherBrace(SnapshotPoint possibleBrace, out SnapshotPoint?otherBrace)
        {
            otherBrace = null;
            var rainbow = this.textBuffer.Get <RainbowProvider>();

            if (rainbow == null)
            {
                return(false);
            }
            if (!possibleBrace.IsValid())
            {
                return(false);
            }

            if (!rainbow.BufferBraces.BraceChars.Contains(possibleBrace.GetChar()))
            {
                return(false);
            }
            var bracePair = rainbow.BufferBraces.GetBracePair(possibleBrace);

            if (bracePair == null)
            {
                return(true);
            }
            if (possibleBrace.Position == bracePair.Item1.Position)
            {
                otherBrace = bracePair.Item2.ToPoint(possibleBrace.Snapshot);
            }
            else
            {
                otherBrace = bracePair.Item1.ToPoint(possibleBrace.Snapshot);
            }
            return(true);
        }
Пример #2
0
        // returns true if brace is actually a brace.
        private bool FindOtherBrace(SnapshotPoint possibleBrace, out SnapshotPoint? otherBrace)
        {
            otherBrace = null;
              var rainbow = this.textBuffer.Get<RainbowProvider>();
              if ( rainbow == null ) {
            return false;
              }
              if ( !possibleBrace.IsValid() ) {
            return false;
              }

              if ( !rainbow.BufferBraces.BraceChars.Contains(possibleBrace.GetChar()) ) {
            return false;
              }
              var bracePair = rainbow.BufferBraces.GetBracePair(possibleBrace);
              if ( bracePair == null ) {
            return true;
              }
              if ( possibleBrace.Position == bracePair.Item1.Position ) {
            otherBrace = bracePair.Item2.ToPoint(possibleBrace.Snapshot);
              } else {
            otherBrace = bracePair.Item1.ToPoint(possibleBrace.Snapshot);
              }
              return true;
        }