提交 cd3fed9b 编写于 作者: C Cyrus Najmabadi

Fix comments

上级 7cefb7cd
......@@ -44,6 +44,12 @@ public async Task TestWithEnoughChunks()
[||]the.quick.brown().fox.jumped();
}
}",
@"class C {
void Bar() {
the.quick.brown().fox
.jumped();
}
}",
@"class C {
void Bar() {
the.quick.brown().fox
......@@ -61,6 +67,12 @@ public async Task TestGenericNames()
[||]the.quick.brown<int>().fox.jumped<string, bool>();
}
}",
@"class C {
void Bar() {
the.quick.brown<int>().fox
.jumped<string, bool>();
}
}",
@"class C {
void Bar() {
the.quick.brown<int>().fox
......@@ -78,6 +90,12 @@ public async Task TestElementAccess()
[||]the.quick.brown[1, 2, 3].fox.jumped[1][2][3];
}
}",
@"class C {
void Bar() {
the.quick.brown[1, 2, 3].fox
.jumped[1][2][3];
}
}",
@"class C {
void Bar() {
the.quick.brown[1, 2, 3].fox
......@@ -96,6 +114,12 @@ public async Task TestUnwrap()
.jumped[1][2][3];
}
}",
@"class C {
void Bar() {
the.quick.brown[1, 2, 3].fox
.jumped[1][2][3];
}
}",
@"class C {
void Bar() {
the.quick.brown[1, 2, 3].fox.jumped[1][2][3];
......@@ -114,6 +138,12 @@ public async Task TestWrapAndUnwrap()
.fox.jumped[1][2][3];
}
}",
@"class C {
void Bar() {
the.quick.brown[1, 2, 3].fox
.jumped[1][2][3];
}
}",
@"class C {
void Bar() {
the.quick.brown[1, 2, 3].fox
......@@ -136,6 +166,12 @@ public async Task TestChunkMustHaveDottedSection()
[||]the().quick.brown[1, 2, 3].fox.jumped[1][2][3];
}
}",
@"class C {
void Bar() {
the().quick.brown[1, 2, 3].fox
.jumped[1][2][3];
}
}",
@"class C {
void Bar() {
the().quick.brown[1, 2, 3].fox
......@@ -153,6 +189,12 @@ public async Task TrailingNonCallIsNotWrapped()
[||]the.quick.brown().fox.jumped().over;
}
}",
@"class C {
void Bar() {
the.quick.brown().fox
.jumped().over;
}
}",
@"class C {
void Bar() {
the.quick.brown().fox
......@@ -171,6 +213,15 @@ public async Task TrailingLongWrapping1()
}
}",
GetIndentionColumn(35),
@"class C {
void Bar() {
the.quick.brown().fox
.jumped().over
.the()
.lazy()
.dog();
}
}",
@"class C {
void Bar() {
the.quick.brown().fox
......@@ -180,6 +231,13 @@ public async Task TrailingLongWrapping1()
.dog();
}
}",
@"class C {
void Bar() {
the.quick.brown().fox
.jumped().over.the()
.lazy().dog();
}
}",
@"class C {
void Bar() {
the.quick.brown().fox
......@@ -200,6 +258,15 @@ public async Task TrailingLongWrapping2()
}
}",
GetIndentionColumn(40),
@"class C {
void Bar() {
the.quick.brown().fox
.jumped().over
.the()
.lazy()
.dog();
}
}",
@"class C {
void Bar() {
the.quick.brown().fox
......@@ -209,6 +276,13 @@ public async Task TrailingLongWrapping2()
.dog();
}
}",
@"class C {
void Bar() {
the.quick.brown().fox
.jumped().over.the().lazy()
.dog();
}
}",
@"class C {
void Bar() {
the.quick.brown().fox
......@@ -228,6 +302,15 @@ public async Task TrailingLongWrapping3()
}
}",
GetIndentionColumn(60),
@"class C {
void Bar() {
the.quick.brown().fox
.jumped().over
.the()
.lazy()
.dog();
}
}",
@"class C {
void Bar() {
the.quick.brown().fox
......@@ -237,6 +320,12 @@ public async Task TrailingLongWrapping3()
.dog();
}
}",
@"class C {
void Bar() {
the.quick.brown().fox.jumped().over.the().lazy()
.dog();
}
}",
@"class C {
void Bar() {
the.quick.brown().fox.jumped().over.the().lazy()
......@@ -254,6 +343,12 @@ public async Task TestInConditionalAccess()
the?.[||]quick.brown().fox.jumped();
}
}",
@"class C {
void Bar() {
the?.quick.brown().fox
.jumped();
}
}",
@"class C {
void Bar() {
the?.quick.brown().fox
......@@ -271,6 +366,12 @@ public async Task TestInConditionalAccess2()
the?.[||]quick.brown()?.fox.jumped();
}
}",
@"class C {
void Bar() {
the?.quick.brown()?.fox
.jumped();
}
}",
@"class C {
void Bar() {
the?.quick.brown()?.fox
......@@ -288,6 +389,12 @@ public async Task TestInConditionalAccess3()
the?.[||]quick.brown()?.fox().jumped();
}
}",
@"class C {
void Bar() {
the?.quick.brown()?.fox()
.jumped();
}
}",
@"class C {
void Bar() {
the?.quick.brown()?.fox()
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
......@@ -13,22 +12,22 @@ namespace Microsoft.CodeAnalysis.Editor.Wrapping.ChainedExpression
/// Finds and wraps 'chained' expressions. For the purpose of this feature, a chained
/// expression is built out of 'chunks' where each chunk is of the form
///
/// <c>
/// <code>
/// . name (arglist) remainder
/// </c>
/// </code>
///
/// So, if there are two or more of these like:
///
/// <c>
/// <code>
/// . name1 (arglist1) remainder1 . name2 (arglist2) remainder2
/// </c>
/// </code>
///
/// Then this will be wrapped such that the dots align like so:
///
/// <c>
/// <code>
/// . name1 (arglist1) remainder1
/// . name2 (arglist2) remainder2
/// </c>
/// </code>
///
/// Note: for the sake of simplicity, (arglist) is used both for the argument list of
/// an InvocationExpression and an ElementAccessExpression.
......@@ -152,20 +151,20 @@ private ImmutableArray<ImmutableArray<SyntaxNodeOrToken>> GetChainChunks(SyntaxN
// Note: the only way to get the `.Foo().Bar().Baz()` case today is in VB in
// a 'with' statement. if we have that, we don't want to wrap it into:
//
// <c>
// <code>
// with ...
// .Foo()
// .Bar()
// .Baz()
// <c>
// </code>
//
// Instead, we want to create
//
// <c>
// <code>
// with ...
// .Foo().Bar()
// .Baz()
// <c>
// </code>
var currentChunkStart = FindNextChunkStart(pieces, firstChunk: true, index: 1);
if (currentChunkStart < 0)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册