Skip to content

Commit

Permalink
Merge pull request OmniSharp#2053 from 333fred/remove-newline-format
Browse files Browse the repository at this point in the history
Remove format on newline
  • Loading branch information
filipw authored Jan 4, 2021
2 parents 8f3b6ea + 9d0985d commit 35f7b29
Showing 1 changed file with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,7 @@ public static async Task<IEnumerable<LinePositionSpanTextChange>> GetFormattingC
return new[] { change };
}

if (character == '\n')
{
// format previous line on new line
var text = await document.GetTextAsync();
var lines = text.Lines;
var targetLine = lines[lines.GetLineFromPosition(position).LineNumber - 1];
Debug.Assert(targetLine.Text != null);
if (!string.IsNullOrWhiteSpace(targetLine.Text!.ToString(targetLine.Span)))
{
return await GetFormattingChanges(document, targetLine.Start, targetLine.End, omnisharpOptions, loggerFactory);
}
}
else if (character == '}' || character == ';')
if (character == '}' || character == ';')
{
// format after ; and }
var root = await document.GetSyntaxRootAsync();
Expand Down

0 comments on commit 35f7b29

Please sign in to comment.