diff --git a/src/Features/Core/Portable/ReplaceMethodWithProperty/AbstractReplaceMethodWithPropertyService.cs b/src/Features/Core/Portable/ReplaceMethodWithProperty/AbstractReplaceMethodWithPropertyService.cs index 798227e4eb53399bce31988bfb28003d7b926ee7..017d1202051aaab597bc55ba3659a3bf03e30ad8 100644 --- a/src/Features/Core/Portable/ReplaceMethodWithProperty/AbstractReplaceMethodWithPropertyService.cs +++ b/src/Features/Core/Portable/ReplaceMethodWithProperty/AbstractReplaceMethodWithPropertyService.cs @@ -74,16 +74,15 @@ private static bool OverridesMetadataSymbol(IMethodSymbol method) //If there is a comment on the same line as the method it is contained in trailing trivia for the parameter list //If it's there we need to add it to the final comments - private static List AddParamListTriviaIfNeeded(ISyntaxFacts syntaxFacts, SyntaxNode methodDeclaration, List finalLeadingTrivia) + private static void AddParamListTriviaIfNeeded(ISyntaxFacts syntaxFacts, SyntaxNode methodDeclaration, List finalLeadingTrivia) { var paramList = syntaxFacts.GetParameterList(methodDeclaration); - if (paramList.GetTrailingTrivia().Any(t => !syntaxFacts.IsWhitespaceOrEndOfLineTrivia(t))) + var trailingTrivia = paramList.GetTrailingTrivia(); + if (trailingTrivia .Any(t => syntaxFacts.IsRegularComment(t))) { - //we have a meaningful comment on the parameter list so add it to the trivia list - finalLeadingTrivia.AddRange(paramList.GetTrailingTrivia()); + // we have a meaningful comment on the parameter list so add it to the trivia list + finalLeadingTrivia.AddRange(trailingTrivia); } - - return finalLeadingTrivia; } } }