public override void IndentLine(TextDocument textDocument, DocumentLine line) { TextDocumentAccessor documentAccessor = new TextDocumentAccessor(textDocument, line.LineNumber, line.LineNumber); Indent(documentAccessor, false); if (documentAccessor.Text.Length == 0) { base.IndentLine(textDocument, line); } }
public override void IndentLine(TextDocument document, DocumentLine line) { var lineNumber = line.LineNumber; var textDocumentAccessor = new TextDocumentAccessor(document, lineNumber, lineNumber); Indent(textDocumentAccessor, false); var text = textDocumentAccessor.Text; if (text.Length == 0) { base.IndentLine(document, line); } }
public override void IndentLine(TextDocument document, DocumentLine line) { if (document == null) { throw new ArgumentNullException("document"); } var lineNumber = line.LineNumber; var accessor = new TextDocumentAccessor(document, lineNumber, lineNumber); this.Indent(accessor, false); var text = accessor.Text; if (text.Length == 0) { base.IndentLine(document, line); } }
/// <inheritdoc cref="IIndentationStrategy.IndentLine" /> public override int IndentLine(TextDocument document, DocumentLine line, int caretIndex) { if (line == null) { return(caretIndex); } var lineNr = line.LineNumber; var acc = new TextDocumentAccessor(document, lineNr, lineNr); var leadingWhiteSpaceBefore = TextUtilities.GetLeadingWhitespace(document, line).Length; var result = Indent(acc, false, caretIndex); var t = acc.Text; result = caretIndex + TextUtilities.GetLeadingWhitespace(document, line).Length - leadingWhiteSpaceBefore; if (t.Length == 0) { // use AutoIndentation for new lines in comments / verbatim strings. return(base.IndentLine(document, line, caretIndex)); } return(result); }
private void TrimStartLine(TextDocumentAccessor accessor) { accessor.Text = accessor.Text.TrimStart(); }