提交 220e7650 编写于 作者: B Basoundr_ms

Bugfix 1094427. Fix flaky Testcase.

Call WithDocumentText when fed with the same text sometimes doesn't return the same instance of the Document because TextSource, a WeakReference, sometimes loses the reference and the perf optimization to return the same instance of the Document is not possbile. (changeset 1387876)
上级 23262d1a
......@@ -22,7 +22,13 @@ public async Task<Document> CleanupAsync(Document document, IEnumerable<TextSpan
if (document.TryGetText(out oldText))
{
var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var newText = oldText.WithChanges(Formatter.GetFormattedTextChanges(root, spans, document.Project.Solution.Workspace, cancellationToken: cancellationToken));
var textChanges = Formatter.GetFormattedTextChanges(root, spans, document.Project.Solution.Workspace, cancellationToken: cancellationToken);
if (textChanges.Count == 0)
{
return document;
}
var newText = oldText.WithChanges(textChanges);
return document.WithText(newText);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册