private async Task<Document> InitializeWithDefaults(Document document, InitializerExpressionSyntax objectInitializer, CancellationToken cancellationToken)
 {
     var semanticModel = await document.GetSemanticModelAsync(cancellationToken);
     var syntaxGenerator = SyntaxGenerator.GetGenerator(document);
     var mappingSourceFinder = new ScaffoldingSourceFinder(syntaxGenerator, document);
     return await ReplaceEmptyInitializationBlock(document, objectInitializer, semanticModel, new SingleSourceMatcher(mappingSourceFinder), cancellationToken);
 }
Example #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));
        }