Exemplo n.º 1
0
        static List <XSharpToken> getLineFromBuffer(XSharpSearchLocation location)
        {
            var result = new List <XSharpToken>();

            ClassifyBuffer(location);
            var xdocument = location.GetDocument();
            var lastLine  = location.Snapshot.LineCount;

            if (xdocument != null)
            {
                var lines      = xdocument.Lines;
                var lineNumber = location.LineNumber;
                while (result.Count == 0 || result.Last().Type != XSharpLexer.EOS)
                {
                    if (lines.ContainsKey(lineNumber))
                    {
                        result.AddRange(lines[lineNumber]);
                    }
                    lineNumber += 1;
                    if (lineNumber >= lastLine)
                    {
                        break;
                    }
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        private static XSharpSearchLocation AdjustStartLineNumber(XSharpSearchLocation location)
        {
            ClassifyBuffer(location);
            var line      = location.LineNumber;
            var doc       = location.GetDocument();
            var lineFlags = doc.LineState;

            while (line >= 0 && lineFlags.GetFlags(line).HasFlag(LineFlags.Continued))
            {
                line--;
            }
            return(location.With(line, location.Position));
        }