protected override CommentType GetCommentType(SnapshotSpan span) { var fullSpan = span.GetText().Contains("//") ? ParseHelper.CompleteSingleLineCommentSpan(span, "//") : ParseHelper.CompleteDelimitedCommentSpan(span, "/*", "*/").First(); if (Settings.StrikethroughDoubleComments && fullSpan.GetText().StartsWith("////", OrdinalIgnoreCase)) { return(CommentType.Crossed); } return(base.GetCommentType(fullSpan)); }
protected override Comment SpecificParse(SnapshotSpan span, CommentType commentType) { var spanText = span.GetText().ToLower(); if (spanText.StartsWith("//", OrdinalIgnoreCase)) //! The comment span consists of a single line. { var fullSpan = ParseHelper.CompleteSingleLineCommentSpan(span, "//"); spanText = fullSpan.GetText().ToLower(); var startOffset = ParseHelper.SingleLineCommentStartIndex(spanText, "////", commentType); var spanLength = spanText.Length - startOffset; if (spanLength > 0) { return(new Comment( new SnapshotSpan(fullSpan.Snapshot, fullSpan.Start + startOffset, spanLength), commentType)); } } else if (spanText.Contains("/*")) { var fullSpans = ParseHelper.CompleteDelimitedCommentSpan(span, "/*", "*/"); if (fullSpans.Count == 1) { spanText = fullSpans[0].GetText().ToLower(); var startOffset = ParseHelper.DelimitedCommentStartIndex(spanText, commentType); var closerIndex = spanText.IndexOf("*/", OrdinalIgnoreCase); var spanLength = spanText.IndexOfFirstCharReverse(closerIndex - 1) - (startOffset - 1); if (spanLength > 0) { return(new Comment( new SnapshotSpan(fullSpans[0].Snapshot, fullSpans[0].Start + startOffset, spanLength), commentType)); } } } return(new Comment(new List <SnapshotSpan>(), commentType)); }