未验证 提交 cd309459 编写于 作者: S Sam Harwell 提交者: GitHub

Merge pull request #32908 from sharwell/hands-off

Avoid touching files that didn't actually change
......@@ -159,7 +159,14 @@ private static async Task<Solution> FormatFilesInProjectAsync(ILogger logger, Pr
}
var formattedDocument = await Formatter.FormatAsync(document, documentOptions, cancellationToken).ConfigureAwait(false);
return await formattedDocument.GetTextAsync(cancellationToken).ConfigureAwait(false);
var formattedSourceText = await formattedDocument.GetTextAsync(cancellationToken).ConfigureAwait(false);
if (formattedSourceText.ContentEquals(await document.GetTextAsync(cancellationToken).ConfigureAwait(false)))
{
// Avoid touching files that didn't actually change
return null;
}
return formattedSourceText;
}, cancellationToken);
formattedDocuments.Add((documentId, formatTask));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册