예제 #1
0
        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;
                    }
                }
                }
            }
        }
예제 #2
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;
            }
            }
        }