Ejemplo n.º 1
0
        protected override void RemoveSensitiveTokens(int position, TextRangeCollection <JadeToken> tokens)
        {
            if (tokens.Count > 0)
            {
                var line  = this.TextBuffer.CurrentSnapshot.GetLineFromPosition(position);
                var index = tokens.GetFirstItemAfterPosition(line.Start);
                if (index >= 0)
                {
                    for (var i = index; i >= 0; i--)
                    {
                        if (IsAnchorToken(tokens[i].TokenType))
                        {
                            line = this.TextBuffer.CurrentSnapshot.GetLineFromPosition(tokens[i].Start);
                            break;
                        }
                    }
                }

                int start = line.Start;
                var end   = tokens[tokens.Count - 1].End;

                if (start < end)
                {
                    tokens.RemoveInRange(TextRange.FromBounds(start, end), true);
                }
            }

            base.RemoveSensitiveTokens(position, tokens);
        }
 public virtual int GetFirstItemAfterPosition(int position)
 {
     return(_collection.GetFirstItemAfterPosition(position));
 }