Microsoft.R.Editor.Tree.EditorTree.GetCommentBlockContainingRange C# (CSharp) Method

GetCommentBlockContainingRange() public method

Determines if a given range is inside a comment and returns range of the comment block.
public GetCommentBlockContainingRange ( ITextRange range ) : ITextRange
range ITextRange Text range to check
return ITextRange
        public ITextRange GetCommentBlockContainingRange(ITextRange range) {
            TextRangeCollection<RToken> comments = this.AstRoot.Comments;

            var commentsInRange = comments.ItemsInRange(range);
            if (commentsInRange.Count == 1)
                return commentsInRange[0];

            return TextRange.EmptyRange;
        }