提交 58b6764f 编写于 作者: K Kevin Pilch-Bisson

Merge pull request #9268 from Pilchie/Port150343

Dont add IndentOperation for Broken BracketedArgumentList
......@@ -116,7 +116,9 @@ public override void AddIndentBlockOperations(List<IndentBlockOperation> list, S
}
var argument = node as BaseArgumentListSyntax;
if (argument != null && argument.Parent.Kind() != SyntaxKind.ThisConstructorInitializer)
if (argument != null &&
argument.Parent.Kind() != SyntaxKind.ThisConstructorInitializer &&
!IsBracketedArgumentListMissingBrackets(argument as BracketedArgumentListSyntax))
{
AddIndentBlockOperations(list, argument);
return;
......@@ -153,6 +155,11 @@ public override void AddIndentBlockOperations(List<IndentBlockOperation> list, S
}
}
private bool IsBracketedArgumentListMissingBrackets(BracketedArgumentListSyntax node)
{
return node != null && node.OpenBracketToken.IsMissing && node.CloseBracketToken.IsMissing;
}
private void ReplaceCaseIndentationRules(List<IndentBlockOperation> list, SyntaxNode node)
{
var section = node as SwitchSectionSyntax;
......
......@@ -2570,6 +2570,26 @@ class C
expectedIndentation: 8);
}
[Fact, Trait(Traits.Feature, Traits.Features.SmartIndent)]
public async Task DontCreateIndentOperationForBrokenBracketedArgumentList()
{
var code = @"
class Program
{
static void M()
{
string (userInput == ""Y"")
}
}
";
await AssertSmartIndentAsync(
code,
indentationLine: 6,
expectedIndentation: 12);
}
private static async Task AssertSmartIndentInProjectionAsync(string markup, int expectedIndentation, CSharpParseOptions options = null)
{
var optionsSet = options != null
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册