Beispiel #1
0
        private static bool IsFollowedByComment(SnapshotPoint point, ISplitCommentService splitCommentService)
        {
            var line = point.GetContainingLine();

            // skip past following whitespace.
            while (point < line.End && char.IsWhiteSpace(point.GetChar()))
            {
                point += 1;
            }

            return(MatchesCommentStart(splitCommentService.CommentStart, point));
        }
Beispiel #2
0
        private static bool LineProbablyContainsComment(ISplitCommentService service, SnapshotPoint position)
        {
            var commentStart = service.CommentStart;
            var line         = position.GetContainingLine();

            for (var p = line.Start.Position; p < position; p++)
            {
                if (MatchesCommentStart(commentStart, line, p))
                {
                    return(true);
                }
            }

            return(false);
        }
        private static bool LineProbablyContainsComment(ISplitCommentService service, ITextSnapshotLine line, int caretPosition)
        {
            var commentStart = service.CommentStart;

            var end = Math.Max(caretPosition, line.Length);

            for (var i = 0; i < end; i++)
            {
                if (MatchesCommentStart(line, commentStart, i))
                {
                    return(true);
                }
            }

            return(false);
        }