/// <summary> /// Gets an optional <see cref="FixAllProviderInfo"/> for the given code refactoring provider. /// </summary> private static FixAllProviderInfo?CreateWithCodeRefactoring(CodeRefactoringProvider provider) { var fixAllProvider = provider.GetFixAllProvider(); if (fixAllProvider == null) { return(null); } var scopes = fixAllProvider.GetSupportedFixAllScopes().ToImmutableArrayOrEmpty(); if (scopes.IsEmpty) { return(null); } return(new CodeRefactoringFixAllProviderInfo(fixAllProvider, scopes)); }
private static async Task <CodeAction> GetFixAllFixAsync( CodeAction originalCodeAction, CodeRefactoringProvider provider, CodeActionOptionsProvider optionsProvider, Document document, TextSpan selectionSpan, FixAllScope scope) { var fixAllProvider = provider.GetFixAllProvider(); if (fixAllProvider == null || !fixAllProvider.GetSupportedFixAllScopes().Contains(scope)) { return(null); } var fixAllState = new FixAllState(fixAllProvider, document, selectionSpan, provider, optionsProvider, scope, originalCodeAction); var fixAllContext = new FixAllContext(fixAllState, new ProgressTracker(), CancellationToken.None); return(await fixAllProvider.GetFixAsync(fixAllContext).ConfigureAwait(false)); }