Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
ee24f8e9
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ee24f8e9
编写于
9月 26, 2019
作者:
S
Sam Harwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Only align trailing line comments
Fixes #16681 Fixes #38224
上级
bf47f1ee
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
159 addition
and
61 deletion
+159
-61
src/EditorFeatures/CSharpTest/CodeActions/ConvertLinq/ConvertForEachToLinqQueryTests.cs
...CodeActions/ConvertLinq/ConvertForEachToLinqQueryTests.cs
+47
-47
src/EditorFeatures/CSharpTest/Diagnostics/Suppression/SuppressionTests.cs
...es/CSharpTest/Diagnostics/Suppression/SuppressionTests.cs
+4
-3
src/EditorFeatures/CSharpTest/InvertIf/InvertIfTests.cs
src/EditorFeatures/CSharpTest/InvertIf/InvertIfTests.cs
+4
-4
src/EditorFeatures/CSharpTest/RemoveUnusedParametersAndValues/RemoveUnusedValueExpressionStatementTests.cs
...ersAndValues/RemoveUnusedValueExpressionStatementTests.cs
+3
-3
src/Workspaces/CSharp/Portable/Formatting/Engine/Trivia/CSharpTriviaFormatter.cs
...ortable/Formatting/Engine/Trivia/CSharpTriviaFormatter.cs
+5
-2
src/Workspaces/CSharpTest/Formatting/FormattingTests.cs
src/Workspaces/CSharpTest/Formatting/FormattingTests.cs
+96
-2
未找到文件。
src/EditorFeatures/CSharpTest/CodeActions/ConvertLinq/ConvertForEachToLinqQueryTests.cs
浏览文件 @
ee24f8e9
...
...
@@ -3920,16 +3920,16 @@ IEnumerable<int> M(IEnumerable<int> nums)
// 1
from/* 3 *//* 2 *//* 4 */x /* 5 */ in/* 6 */nums/* 7 */// 8
// 9
/* 10 */
/* 10 */
from/* 12 *//* 11 */int /* 13 */ y /* 14 */ in/* 15 */nums/* 16 *//* 17 */// 18
// 19
/*20 */
/*20 */
where/* 21 *//* 22 */x > 2/* 23 */// 24
/* 26 *//* 27 *//* 28 */
/* 26 *//* 27 *//* 28 */
select x * y/* 29 *//* 31 */// 32
/* 33 */// 34
/* 35 *//* 36 */// 30
/* 37 *//* 38 *//* 39*/// 40
/* 33 */// 34
/* 35 *//* 36 */// 30
/* 37 *//* 38 *//* 39*/// 40
;
}
}"
;
...
...
@@ -3944,21 +3944,21 @@ class C
IEnumerable<int> M(IEnumerable<int> nums)
{
return nums /* 7 */.SelectMany(
// 1
/* 2 */// 25
/* 4 */x /* 5 */ => nums /* 16 */.Where(
/*20 *//* 21 */// 19
y =>
// 1
/* 2 */// 25
/* 4 */x /* 5 */ => nums /* 16 */.Where(
/*20 *//* 21 */// 19
y =>
/* 22 */x > 2/* 23 */// 24
).Select(
// 9
/* 10 *//* 11 *//* 13 */y /* 14 */ =>
).Select(
// 9
/* 10 *//* 11 *//* 13 */y /* 14 */ =>
/* 26 *//* 27 *//* 28 */x * y/* 29 *//* 31 */// 32
/* 33 */// 34
/* 35 *//* 36 */// 30
/* 37 *//* 38 *//* 39*/// 40
/* 12 *//* 15 *//* 17 */// 18
)/* 3 *//* 6 */// 8
/* 33 */// 34
/* 35 *//* 36 */// 30
/* 37 *//* 38 *//* 39*/// 40
/* 12 *//* 15 *//* 17 */// 18
)/* 3 *//* 6 */// 8
);
}
}"
;
...
...
@@ -3995,11 +3995,11 @@ List<int> M(IEnumerable<int> nums)
{
/*29*/
return /*30*/ /* 1 *//* 2 *//* 3 *//* 4 */// 5
/*31*/
/*31*/
(
/* 6 */from/* 8 *//* 7 *//* 9 */x /* 10 */ in/* 11 */nums/* 12 */// 13
/* 14 */// 15
/* 16 *//* 17 */
/* 14 */// 15
/* 16 *//* 17 */
let y /* 18 */ = /* 19 */ x + 1/* 20 *///21
select y/* 24 *//*27*///28
).ToList()/* 22 *//* 23 *//* 25 *///26
...
...
@@ -4042,10 +4042,10 @@ List<int> M(IEnumerable<int> nums)
{
/*23*/
return /*24*/ /* 1 *//* 2 *//* 3 *//* 4 */// 5
/*25*/
/*25*/
(
/* 14 */// 15
/* 6 */from/* 8 *//* 7 *//* 9 */x /* 10 */ in/* 11 */nums/* 12 */// 13
/* 14 */// 15
/* 6 */from/* 8 *//* 7 *//* 9 */x /* 10 */ in/* 11 */nums/* 12 */// 13
select x + 1/* 18 *//*21*///22
).ToList()/* 16 *//* 17 *//* 19 *///20
; //26
...
...
@@ -4063,11 +4063,11 @@ List<int> M(IEnumerable<int> nums)
{
/*23*/
return /*24*/ /* 1 *//* 2 *//* 3 *//* 4 */// 5
/*25*/
/*25*/
(nums /* 12 */.Select(
/* 6 *//* 7 *//* 14 */// 15
/* 9 */x /* 10 */ => x + 1/* 18 *//*21*///22
/* 8 *//* 11 */// 13
/* 6 *//* 7 *//* 14 */// 15
/* 9 */x /* 10 */ => x + 1/* 18 *//*21*///22
/* 8 *//* 11 */// 13
)).ToList()/* 16 *//* 17 *//* 19 *///20
; //26
}
...
...
@@ -4104,10 +4104,10 @@ int M(IEnumerable<int> nums)
{
/*21*/
return /*22*/ /* 1 *//* 2 *//* 3 *//* 4 */// 5
/*23*/
/*23*/
(
/* 14 */// 15
/* 6 */from/* 8 *//* 7 *//* 9 */x /* 10 */ in/* 11 */nums/* 12 */// 13
/* 14 */// 15
/* 6 */from/* 8 *//* 7 *//* 9 */x /* 10 */ in/* 11 */nums/* 12 */// 13
select x/* 10 *//*19*///20
).Count()/* 16 *//* 17 *///18
; //24
...
...
@@ -4125,11 +4125,11 @@ int M(IEnumerable<int> nums)
{
/*21*/
return /*22*/ /* 1 *//* 2 *//* 3 *//* 4 */// 5
/*23*/
/*23*/
(nums /* 12 */.Select(
/* 6 *//* 7 *//* 14 */// 15
/* 9 */x /* 10 */ => x/* 10 *//*19*///20
/* 8 *//* 11 */// 13
/* 6 *//* 7 *//* 14 */// 15
/* 9 */x /* 10 */ => x/* 10 *//*19*///20
/* 8 *//* 11 */// 13
)).Count()/* 16 *//* 17 *///18
; //24
}
...
...
@@ -4167,8 +4167,8 @@ void M(IEnumerable<int> nums)
{
foreach (var (a /* 12 */ , b /*16*/ ) in
/* 1 */from/* 2 */int /* 3 */ n1 /* 4 */in/* 5 */nums/* 6 */// 7
/* 8*/// 9
/* 10 *//* 11 */
/* 8*/// 9
/* 10 *//* 11 */
let a /* 12 */ = /* 13 */ n1 + n1/* 14*//* 15 */
let b /*16*/ = /*17*/ n1 * n1/*18*///19
select (a /* 12 */ , b /*16*/ )/*22*//*23*/)
...
...
@@ -4215,13 +4215,13 @@ class C
void M(IEnumerable<int> nums)
{
foreach (var n1 /* 4 */in
/* 17 */// 18
/* 1 */from/* 2 */int /* 3 */ n1 /* 4 */in/* 5 */nums/* 6 */// 7
/* 8*/// 9
/* 10 */
where/* 11 *//* 12 */n1 /* 13 */ > /* 14 */ 0/* 15 */// 16
/* 17 */// 18
/* 1 */from/* 2 */int /* 3 */ n1 /* 4 */in/* 5 */nums/* 6 */// 7
/* 8*/// 9
/* 10 */
where/* 11 *//* 12 */n1 /* 13 */ > /* 14 */ 0/* 15 */// 16
select n1/* 4 *//* 21 */// 22
/*23*//*24*/
/*23*//*24*/
)
{
/*19*/
...
...
@@ -4245,9 +4245,9 @@ void M(IEnumerable<int> nums)
n1 =>
/* 12 */n1 /* 13 */ > /* 14 */ 0/* 15 */// 16
).Select(
/* 1 *//* 2 *//* 17 */// 18
/* 3 */n1 /* 4 */=> n1/* 4 *//* 21 */// 22
/*23*//*24*//* 5 */// 7
/* 1 *//* 2 *//* 17 */// 18
/* 3 */n1 /* 4 */=> n1/* 4 *//* 21 */// 22
/*23*//*24*//* 5 */// 7
))
{
/*19*/
...
...
src/EditorFeatures/CSharpTest/Diagnostics/Suppression/SuppressionTests.cs
浏览文件 @
ee24f8e9
...
...
@@ -148,15 +148,16 @@ void Method()
{{
// Start comment previous line
#pragma warning disable CS0219 // {CSharpResources.WRN_UnreferencedVarAssg_Title}
/* Start comment same line */
/* Start comment same line */
int
x
=
0
;
// End comment same line
#pragma warning restore CS0219 // {CSharpResources.WRN_UnreferencedVarAssg_Title}
/* End comment next line */
/* End comment next line */
}}
}}
"
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
CodeActionsSuppression
)]
[
WorkItem
(
16681
,
"https://github.com/dotnet/roslyn/issues/16681"
)]
public
async
Task
TestPragmaWarningDirectiveWithDocumentationComment
()
{
await
TestAsync
(
...
...
@@ -172,7 +173,7 @@ sealed class Class
sealed class Class
{{
#pragma warning disable CS0628 // {CSharpResources.WRN_ProtectedInSealed_Title}
/// <summary>Text</summary>
/// <summary>Text</summary>
protected
void
Method
()
#pragma warning restore CS0628 // {CSharpResources.WRN_ProtectedInSealed_Title}
{{
...
...
src/EditorFeatures/CSharpTest/InvertIf/InvertIfTests.cs
浏览文件 @
ee24f8e9
...
...
@@ -697,15 +697,15 @@ void Goo()
{
if (b) /*8*/
{ /*9*/
/*10*/
/*10*/
goo(); /*11*/
/*12*/
/*12*/
} /*13*/
else /*14*/
{ /*15*/
/*16*/
/*16*/
goo(); /*17*/
/*18*/
/*18*/
} /*19*/
}
else
...
...
src/EditorFeatures/CSharpTest/RemoveUnusedParametersAndValues/RemoveUnusedValueExpressionStatementTests.cs
浏览文件 @
ee24f8e9
...
...
@@ -501,7 +501,7 @@ void M()
{
void M()
{/*C0*/
/*C1*/
/*C1*/
_ = M2()/*C2*/;/*C3*/
/*C4*/
}
...
...
@@ -556,9 +556,9 @@ void M()
{
void M()
{/*C0*/
/*C1*/
/*C1*/
var unused = M2()/*C2*/;/*C3*/
/*C4*/
/*C4*/
}
int M2() => 0;
...
...
src/Workspaces/CSharp/Portable/Formatting/Engine/Trivia/CSharpTriviaFormatter.cs
浏览文件 @
ee24f8e9
...
...
@@ -126,8 +126,11 @@ protected override LineColumnRule GetLineColumnRuleBetween(SyntaxTrivia trivia1,
// comments case
if
(
trivia2
.
IsRegularOrDocComment
())
{
// start of new comments group
if
(!
trivia1
.
IsRegularComment
()
||
existingWhitespaceBetween
.
Lines
>
1
)
// Start of new comments group.
//
// 1. Comment groups must contain the same kind of comments
// 2. Every block comment is a group of its own
if
(!
trivia1
.
IsKind
(
trivia2
.
Kind
())
||
trivia2
.
IsMultiLineComment
()
||
trivia2
.
IsMultiLineDocComment
()
||
existingWhitespaceBetween
.
Lines
>
1
)
{
if
(
this
.
FormattingRules
.
GetAdjustNewLinesOperation
(
this
.
Token1
,
this
.
Token2
)
!=
null
)
{
...
...
src/Workspaces/CSharpTest/Formatting/FormattingTests.cs
浏览文件 @
ee24f8e9
...
...
@@ -6549,7 +6549,44 @@ void Method()
[
Fact
]
[
WorkItem
(
772311
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/772311"
)]
[
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Formatting
)]
public
async
Task
CommentAtTheEndOfLine
()
public
async
Task
LineCommentAtTheEndOfLine
()
{
var
code
=
@"
using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine(); // this is a comment
// that I would like to keep
// properly indented
}
}
"
;
var
expected
=
@"
using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine(); // this is a comment
// that I would like to keep
// properly indented
}
}
"
;
await
AssertFormatAsync
(
expected
,
code
);
}
[
Fact
]
[
WorkItem
(
38224
,
"https://github.com/dotnet/roslyn/issues/38224"
)]
[
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Formatting
)]
public
async
Task
BlockCommentAtTheEndOfLine1
()
{
var
code
=
@"
using System;
...
...
@@ -6574,7 +6611,44 @@ class Program
static void Main(string[] args)
{
Console.WriteLine(); /* this is a comment */
// that I would like to keep
// that I would like to keep
// properly indented
}
}
"
;
await
AssertFormatAsync
(
expected
,
code
);
}
[
Fact
]
[
WorkItem
(
38224
,
"https://github.com/dotnet/roslyn/issues/38224"
)]
[
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Formatting
)]
public
async
Task
BlockCommentAtTheEndOfLine2
()
{
var
code
=
@"
using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine(); // this is a comment
/* that I would like to keep */
// properly indented
}
}
"
;
var
expected
=
@"
using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine(); // this is a comment
/* that I would like to keep */
// properly indented
}
...
...
@@ -6583,6 +6657,26 @@ static void Main(string[] args)
await
AssertFormatAsync
(
expected
,
code
);
}
[
Fact
]
[
WorkItem
(
38224
,
"https://github.com/dotnet/roslyn/issues/38224"
)]
[
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Formatting
)]
public
async
Task
BlockCommentAtBeginningOfLine
()
{
var
code
=
@"
using System;
class Program
{
static void Main(
int x, // Some comment
/*A*/ int y)
{
}
}
"
;
await
AssertFormatAsync
(
code
,
code
);
}
[
Fact
]
[
WorkItem
(
772311
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/772311"
)]
[
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Formatting
)]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录