private static async Task <Document> ExpandAsync(Document document, ISyntaxExpander expander)
        {
            var semanticModel = await document.GetSemanticModelAsync();

            var workspace = document.Project.Solution.Workspace;
            var root      = await document.GetSyntaxRootAsync();

            try {
                var newRoot = root.ReplaceNodes(root.DescendantNodes(n => expander.ShouldExpandWithinNode(n, root, semanticModel)).Where(n => expander.ShouldExpandNode(n, root, semanticModel)),
                                                (node, rewrittenNode) => TryExpandNode(expander, node, root, semanticModel, workspace)
                                                );
                return(document.WithSyntaxRoot(newRoot));
            } catch (Exception ex) {
                var warningText = "Conversion warning: Qualified name reduction failed for this file. " + ex;
                return(document.WithSyntaxRoot(WithWarningAnnotation(root, warningText)));
            }
        }
    private static async Task <Document> ExpandAsync(Document document, ISyntaxExpander expander, CancellationToken cancellationToken)
    {
        var semanticModel = await document.GetSemanticModelAsync(cancellationToken);

        var workspace = document.Project.Solution.Workspace;
        var root      = await document.GetSyntaxRootAsync(cancellationToken);

        try {
            var filteredNodes = root.DescendantNodes(n => expander.ShouldExpandWithinNode(n, semanticModel))
                                .Where(n => expander.ShouldExpandNode(n, semanticModel));

            var newRoot = root.ReplaceNodes(filteredNodes,
                                            (node, _) => TryExpandNode(expander, node, semanticModel, workspace, cancellationToken)
                                            );

            return(document.WithSyntaxRoot(newRoot));
        } catch (Exception ex) {
            var warningText = "Conversion warning: Name qualification failed for this file. " + ex;
            return(document.WithSyntaxRoot(WithWarningAnnotation(root, warningText)));
        }
    }