public static async Task ComputeRefactoringsAsync(RefactoringContext context, UsingStatementSyntax usingStatement) { if (context.IsRefactoringEnabled(RefactoringIdentifiers.ExtractDeclarationFromUsingStatement)) { await ExtractDeclarationFromUsingStatementRefactoring.ComputeRefactoringAsync(context, usingStatement).ConfigureAwait(false); } }
public static void ComputeRefactorings(RefactoringContext context, UsingStatementSyntax usingStatement) { if (context.IsRefactoringEnabled(RefactoringIdentifiers.ExtractDeclarationFromUsingStatement)) { VariableDeclarationSyntax declaration = usingStatement.Declaration; if (declaration != null && context.Span.IsBetweenSpans(declaration) && usingStatement.IsParentKind(SyntaxKind.Block)) { context.RegisterRefactoring( "Extract local declaration", cancellationToken => { return(ExtractDeclarationFromUsingStatementRefactoring.RefactorAsync( context.Document, usingStatement, cancellationToken)); }); } } }