Skip to content

Commit 105f1d0

Browse files
committed
Provide a capacity when initializing the StringBuilder
The chosen capacity exceeds the true requirement in cases where a trivia contains both tabs and other characters, but for the most common case of lines indented with hard tabs is exactly the correct amount.
1 parent 9d9a139 commit 105f1d0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SA1027CodeFixProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private static TextChange FixDiagnostic(IndentationOptions indentationOptions, S
5959

6060
TextLine startLine = sourceText.Lines.GetLineFromPosition(span.Start);
6161
string text = sourceText.ToString(TextSpan.FromBounds(startLine.Start, span.End));
62-
StringBuilder replacement = new StringBuilder();
62+
StringBuilder replacement = new StringBuilder(indentationOptions.TabSize * span.Length);
6363
int column = 0;
6464
for (int i = 0; i < text.Length; i++)
6565
{

0 commit comments

Comments
 (0)