/// <summary> /// Default implementation for multiline comments. /// </summary> protected void SurroundSelectionWithBlockComment(ITextEditor editor, string blockStart, string blockEnd) { using (editor.Document.OpenUndoGroup()) { int startOffset = editor.SelectionStart; int endOffset = editor.SelectionStart + editor.SelectionLength; if (editor.SelectionLength == 0) { IDocumentLine line = editor.Document.GetLineForOffset(editor.SelectionStart); startOffset = line.Offset; endOffset = line.Offset + line.Length; } BlockCommentRegion region = FindSelectedCommentRegion(editor, blockStart, blockEnd); if (region != null) { editor.Document.Remove(region.EndOffset, region.CommentEnd.Length); editor.Document.Remove(region.StartOffset, region.CommentStart.Length); } else { editor.Document.Insert(endOffset, blockEnd); editor.Document.Insert(startOffset, blockStart); } } }
public override bool Equals(object obj) { BlockCommentRegion other = obj as BlockCommentRegion; if (other == null) { return(false); } return(this.CommentStart == other.CommentStart && this.CommentEnd == other.CommentEnd && this.StartOffset == other.StartOffset && this.EndOffset == other.EndOffset); }