Esempio n. 1
0
        public static void ComputeRefactoringsForTrivia(this RefactoringContext context)
        {
            SyntaxTrivia trivia = context.FindTrivia();

            Debug.WriteLine(trivia.Kind().ToString());

            switch (trivia.Kind())
            {
            case SyntaxKind.SingleLineCommentTrivia:
            {
                if (context.IsRefactoringEnabled(RefactoringIdentifiers.Uncomment))
                {
                    context.RegisterRefactoring(
                        "Uncomment",
                        cancellationToken => UncommentRefactoring.RefactorAsync(context.Document, trivia, cancellationToken));
                }

                break;
            }
            }

            if (!trivia.IsCommentTrivia())
            {
                SyntaxTrivia trivia2 = context.FindTriviaInsideTrivia();

                if (trivia.Span != trivia2.Span)
                {
                    trivia = trivia2;
                    Debug.WriteLine(trivia.Kind().ToString());
                }
            }

            CommentTriviaRefactoring.ComputeRefactorings(context, trivia);
        }