public override async Task ComputeRefactoringsAsync(CodeRefactoringContext context) { SyntaxNode root = await context.Document.GetSyntaxRootAsync(context.CancellationToken); ParameterListSyntax parameterList = root .FindNode(context.Span, getInnermostNodeForTie: true)? .FirstAncestorOrSelf <ParameterListSyntax>(); if (parameterList == null) { return; } if (parameterList.Parameters.Count == 0) { return; } if (parameterList.IsSingleline()) { if (parameterList.Parameters.Count > 1) { context.RegisterRefactoring( "Format each parameter on separate line", cancellationToken => FormatEachParameterOnNewLineAsync(context.Document, parameterList, cancellationToken)); } } else { context.RegisterRefactoring( "Format all parameters on a single line", cancellationToken => FormatAllParametersOnSingleLineAsync(context.Document, parameterList, cancellationToken)); } DuplicateParameterRefactoring.Refactor(context, parameterList); SwapParametersRefactoring.Refactor(context, parameterList); }