提交 ec031bbb 编写于 作者: B Balaji Krishnan

Few minor cleanups in MoveTypeEditor.cs

上级 9dc99c9d
......@@ -96,7 +96,7 @@ internal override async Task<IEnumerable<CodeActionOperation>> GetOperationsAsyn
// get the updated document, perform clean up like remove unused usings.
var newDocument = solutionWithNewDocument.GetDocument(newDocumentId);
newDocument = await CleanUpDocumentAsync(newDocument, CancellationToken).ConfigureAwait(false);
newDocument = await CleanUpDocumentAsync(newDocument).ConfigureAwait(false);
return newDocument.Project.Solution;
}
......@@ -116,7 +116,7 @@ private async Task<Solution> RemoveTypeFromSourceDocumentAsync(Document sourceDo
var updatedDocument = documentEditor.GetChangedDocument();
updatedDocument = await CleanUpDocumentAsync(updatedDocument, CancellationToken).ConfigureAwait(false);
updatedDocument = await CleanUpDocumentAsync(updatedDocument).ConfigureAwait(false);
return updatedDocument.Project.Solution;
}
......@@ -133,8 +133,7 @@ private IEnumerable<SyntaxNode> GetMembersToRemove(SyntaxNode root)
var spine = new HashSet<SyntaxNode>();
// collect the parent chain of declarations to keep.
SyntaxNode node = State.TypeNode;
spine.AddRange(node.GetAncestors());
spine.AddRange(State.TypeNode.GetAncestors());
// get potential namespace, types and members to remove.
var removableCandidates = root
......@@ -187,12 +186,11 @@ private void AddPartialModifiersToTypeChain(DocumentEditor documentEditor)
/// <summary>
/// Perform clean ups on a given document.
/// </summary>
private async Task<Document> CleanUpDocumentAsync(Document document, CancellationToken cancellationToken)
private Task<Document> CleanUpDocumentAsync(Document document)
{
return await document
return document
.GetLanguageService<IRemoveUnnecessaryImportsService>()
.RemoveUnnecessaryImportsAsync(document, CancellationToken)
.ConfigureAwait(false);
.RemoveUnnecessaryImportsAsync(document, CancellationToken);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册