Esempio n. 1
0
        public static async Task ComputeRefactoringsForTokenAsync(this RefactoringContext context)
        {
            SyntaxToken token = context.FindToken();

            SyntaxKind kind = token.Kind();

            if (kind != SyntaxKind.None &&
                token.Span.Contains(context.Span))
            {
                Debug.WriteLine(kind.ToString());

                switch (kind)
                {
                case SyntaxKind.CloseParenToken:
                {
                    await CloseParenTokenRefactoring.ComputeRefactoringsAsync(context, token).ConfigureAwait(false);

                    break;
                }

                case SyntaxKind.CommaToken:
                {
                    await CommaTokenRefactoring.ComputeRefactoringsAsync(context, token).ConfigureAwait(false);

                    break;
                }
                }
            }
        }
        public async Task ComputeRefactoringsForTokenAsync()
        {
            SyntaxToken token = Root.FindToken(Span.Start);

            SyntaxKind kind = token.Kind();

            if (kind != SyntaxKind.None &&
                token.Span.Contains(Span))
            {
                Debug.WriteLine(kind.ToString());

                switch (kind)
                {
                case SyntaxKind.CloseParenToken:
                {
                    await CloseParenTokenRefactoring.ComputeRefactoringsAsync(this, token).ConfigureAwait(false);

                    break;
                }

                case SyntaxKind.CommaToken:
                {
                    await CommaTokenRefactoring.ComputeRefactoringsAsync(this, token).ConfigureAwait(false);

                    break;
                }

                case SyntaxKind.SemicolonToken:
                {
                    SemicolonTokenRefactoring.ComputeRefactorings(this, token);
                    break;
                }
                }
            }
        }
        public async Task ComputeRefactoringsForTokenAsync()
        {
            SyntaxToken token = Root.FindToken(Span.Start);

            SyntaxKind kind = token.Kind();

            if (kind != SyntaxKind.None &&
                token.Span.Contains(Span))
            {
                Debug.WriteLine(kind.ToString());

                switch (kind)
                {
                case SyntaxKind.CloseParenToken:
                {
                    await CloseParenTokenRefactoring.ComputeRefactoringsAsync(this, token).ConfigureAwait(false);

                    break;
                }

                case SyntaxKind.CommaToken:
                {
                    await CommaTokenRefactoring.ComputeRefactoringsAsync(this, token).ConfigureAwait(false);

                    break;
                }

                case SyntaxKind.SemicolonToken:
                {
                    SemicolonTokenRefactoring.ComputeRefactorings(this, token);
                    break;
                }

                case SyntaxKind.PlusToken:
                {
                    await PlusTokenRefactoring.ComputeRefactoringsAsync(this, token).ConfigureAwait(false);

                    break;
                }

                case SyntaxKind.PublicKeyword:
                case SyntaxKind.InternalKeyword:
                case SyntaxKind.ProtectedKeyword:
                case SyntaxKind.PrivateKeyword:
                {
                    {
                        if (IsRefactoringEnabled(RefactoringIdentifiers.ChangeAccessibility))
                        {
                            await AccessModifierRefactoring.ComputeRefactoringsAsync(this, token).ConfigureAwait(false);
                        }

                        break;
                    }
                }
                }
            }
        }
Esempio n. 4
0
        public async Task ComputeRefactoringsForTokenAsync()
        {
            SyntaxToken token = Root.FindToken(Span.Start);

            if (!token.Span.Contains(Span))
            {
                return;
            }

            switch (token.Kind())
            {
            case SyntaxKind.CloseParenToken:
            {
                await CloseParenTokenRefactoring.ComputeRefactoringsAsync(this, token).ConfigureAwait(false);

                break;
            }

            case SyntaxKind.CommaToken:
            {
                await CommaTokenRefactoring.ComputeRefactoringsAsync(this, token).ConfigureAwait(false);

                break;
            }

            case SyntaxKind.SemicolonToken:
            {
                SemicolonTokenRefactoring.ComputeRefactorings(this, token);
                break;
            }

            case SyntaxKind.PlusToken:
            {
                await PlusTokenRefactoring.ComputeRefactoringsAsync(this, token).ConfigureAwait(false);

                break;
            }

            case SyntaxKind.PublicKeyword:
            case SyntaxKind.InternalKeyword:
            case SyntaxKind.ProtectedKeyword:
            case SyntaxKind.PrivateKeyword:
            {
                if (IsRefactoringEnabled(RefactoringIdentifiers.ChangeAccessibility))
                {
                    await AccessModifierRefactoring.ComputeRefactoringsAsync(this, token).ConfigureAwait(false);
                }

                break;
            }

            case SyntaxKind.AsyncKeyword:
            {
                if (IsRefactoringEnabled(RefactoringIdentifiers.RemoveAsyncAwait) &&
                    Span.IsEmptyAndContainedInSpan(token))
                {
                    await RemoveAsyncAwaitRefactoring.ComputeRefactoringsAsync(this, token).ConfigureAwait(false);
                }

                break;
            }
            }
        }