未验证 提交 f6e1d3c7 编写于 作者: Y Youssef Victor 提交者: GitHub

Call GetSyntaxRootAsync once outside loop

上级 7647f552
......@@ -45,10 +45,9 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context)
CancellationToken cancellationToken)
{
var declarators = new List<TSymbolSyntax>();
var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
foreach (var diagnostic in diagnostics)
{
var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
var diagnosticSpan = diagnostic.Location.SourceSpan;
declarators.Add(root.FindNode(diagnosticSpan, getInnermostNodeForTie: true).FirstAncestorOrSelf<TSymbolSyntax>());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册