提交 2e043c85 编写于 作者: V Vatsalya Agrawal

Bugfix fix.

上级 66ac3f2b
......@@ -162,6 +162,29 @@ int Goo
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsReplaceMethodWithProperty)]
public async Task TestMethodWithTrailingTrivia()
{
await TestWithAllCodeStyleOff(
@"class C
{
int [||]GetP();
bool M()
{
return GetP() == 0;
}
}",
@"class C
{
int P { get; }
bool M()
{
return P == 0;
}
}");
}
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsReplaceMethodWithProperty)]
public async Task TestIndentation()
{
......
......@@ -376,11 +376,12 @@ public void ReplaceSetReference(SyntaxEditor editor, SyntaxToken nameToken, stri
return;
}
var invocation = nameNode?.FirstAncestorOrSelf<InvocationExpressionSyntax>();
var newName = nameChanged
? SyntaxFactory.IdentifierName(SyntaxFactory.Identifier(propertyName).WithTriviaFrom(nameToken))
? SyntaxFactory.IdentifierName(SyntaxFactory.Identifier(propertyName).WithLeadingTrivia(nameToken.LeadingTrivia).WithTrailingTrivia(invocation?.ArgumentList?.CloseParenToken.TrailingTrivia))
: nameNode;
var invocation = nameNode?.FirstAncestorOrSelf<InvocationExpressionSyntax>();
var invocationExpression = invocation?.Expression;
if (!IsInvocationName(nameNode, invocationExpression))
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册