GetText() public method

Retrieves the text for a portion of the document.
public GetText ( ISegment segment ) : string
segment ISegment
return string
		/// <inheritdoc />
		public virtual int IndentLine(TextDocument document, DocumentLine line, int caretOffset)
		{
			if (document == null)
				throw new ArgumentNullException("document");
			if (line == null)
				throw new ArgumentNullException("line");

			var previousLine = line.PreviousLine;
			if (previousLine != null)
			{
				var indentationSegment = TextUtilities.GetWhitespaceAfter(document, previousLine.Offset);
				var indentation = document.GetText(indentationSegment);
				// copy indentation to line
				indentationSegment = TextUtilities.GetWhitespaceAfter(document, line.Offset);
				document.Replace(indentationSegment, indentation);
			}

			return caretOffset;
		}
        public int UnComment(TextDocument textDocument, ISegment segment, int caret = -1, bool format = true)
        {
            var result = caret;

            var lines = VisualLineGeometryBuilder.GetLinesForSegmentInDocument(textDocument, segment);

            textDocument.BeginUpdate();

            foreach (var line in lines)
            {
                var index = textDocument.GetText(line).IndexOf("//");

                if (index >= 0)
                {
                    textDocument.Replace(line.Offset + index, 2, string.Empty);
                }
            }

            if (format)
            {
                result = Format(textDocument, (uint)segment.Offset, (uint)segment.Length, caret);
            }

            textDocument.EndUpdate();

            return result;
        }