public static async Task ComputeRefactoringsAsync(RefactoringContext context, QualifiedNameSyntax qualifiedName)
 {
     if (context.IsRefactoringEnabled(RefactoringIdentifiers.AddUsingDirective) &&
         context.Span.IsEmpty &&
         qualifiedName.DotToken.SpanStart == context.Span.Start &&
         qualifiedName.Left?.Kind() == SyntaxKind.IdentifierName)
     {
         await AddUsingDirectiveRefactoring.ComputeRefactoringsAsync(context, (IdentifierNameSyntax)qualifiedName.Left).ConfigureAwait(false);
     }
 }
示例#2
0
        public static async Task ComputeRefactoringsAsync(RefactoringContext context, IdentifierNameSyntax identifierName)
        {
            if (context.IsRefactoringEnabled(RefactoringIdentifiers.RenameBackingFieldAccordingToPropertyName))
            {
                await RenameFieldAccordingToPropertyNameAsync(context, identifierName).ConfigureAwait(false);
            }

            if (context.IsRefactoringEnabled(RefactoringIdentifiers.AddUsingDirective) &&
                context.Span.IsEmpty)
            {
                await AddUsingDirectiveRefactoring.ComputeRefactoringsAsync(context, identifierName).ConfigureAwait(false);
            }
        }
        public static async Task ComputeRefactoringsAsync(RefactoringContext context, IdentifierNameSyntax identifierName)
        {
            if (context.IsRefactoringEnabled(RefactoringDescriptors.SyncPropertyNameAndBackingFieldName))
            {
                await SyncPropertyNameAndBackingFieldNameAsync(context, identifierName).ConfigureAwait(false);
            }

            if (context.IsRefactoringEnabled(RefactoringDescriptors.AddUsingDirective) &&
                context.Span.IsEmpty)
            {
                await AddUsingDirectiveRefactoring.ComputeRefactoringsAsync(context, identifierName).ConfigureAwait(false);
            }

            if (context.IsRefactoringEnabled(RefactoringDescriptors.InlineProperty))
            {
                await InlinePropertyRefactoring.ComputeRefactoringsAsync(context, identifierName).ConfigureAwait(false);
            }

            if (context.IsRefactoringEnabled(RefactoringDescriptors.ConvertMethodGroupToLambda))
            {
                await ConvertMethodGroupToLambdaRefactoring.ComputeRefactoringAsync(context, identifierName).ConfigureAwait(false);
            }
        }