private async Task <Document> UseLocalVariablesAsParameters(Document document, IInvocation invocation, bool generateNamedParameters, CancellationToken cancellationToken)
        {
            var semanticModel = await document.GetSemanticModelAsync(cancellationToken);

            var mappingSourceFinder = LocalScopeMappingSourceFinder.FromScope(semanticModel, invocation.SourceNode);

            return(await CodeFixHelper.FixInvocationWithParameters(document, invocation, generateNamedParameters, semanticModel, mappingSourceFinder, cancellationToken));
        }
示例#2
0
        private async Task <Document> ScaffoldInvocation(Document document, IInvocation invocation, bool namedArguments,
                                                         CancellationToken cancellationToken)
        {
            var syntaxGenerator = SyntaxGenerator.GetGenerator(document);
            var semanticModel   = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false);

            var mappingSourceFinder = new ScaffoldingSourceFinder(syntaxGenerator, document);

            return(await CodeFixHelper.FixInvocationWithParameters(document, invocation, namedArguments, semanticModel, mappingSourceFinder, cancellationToken).ConfigureAwait(false));
        }