/// <summary> /// Determines if there is a region under the cursor for the specified text document. /// </summary> /// <param name="textDocument">The text document.</param> /// <returns>True if there is a region under the cursor, otherwise false.</returns> internal bool IsCodeRegionUnderCursor(TextDocument textDocument) { if (textDocument != null && textDocument.Selection != null) { var cursor = textDocument.GetEditPointAtCursor(); var currentLineText = cursor.GetLine(); return(RegexNullSafe.IsMatch(currentLineText, RegionPattern)); } return(false); }