Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
3f1aa6e3
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,发现更多精彩内容 >>
提交
3f1aa6e3
编写于
5月 20, 2016
作者:
B
Balaji Krishnan
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11318 from lorcanmooney/issue11213
Correct intellisense and indentation for fixed statements
上级
bd4bc054
3bd960b9
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
164 addition
and
3 deletion
+164
-3
src/EditorFeatures/CSharpTest/Formatting/Indentation/SmartTokenFormatterFormatRangeTests.cs
...atting/Indentation/SmartTokenFormatterFormatRangeTests.cs
+141
-0
src/Workspaces/CSharp/Portable/Extensions/ContextQuery/SyntaxTokenExtensions.cs
...Portable/Extensions/ContextQuery/SyntaxTokenExtensions.cs
+5
-1
src/Workspaces/CSharp/Portable/Formatting/FormattingHelpers.cs
...orkspaces/CSharp/Portable/Formatting/FormattingHelpers.cs
+7
-0
src/Workspaces/CSharp/Portable/Formatting/Rules/IndentBlockFormattingRule.cs
...rp/Portable/Formatting/Rules/IndentBlockFormattingRule.cs
+7
-0
src/Workspaces/CSharp/Portable/Formatting/Rules/NewLineUserSettingFormattingRule.cs
...able/Formatting/Rules/NewLineUserSettingFormattingRule.cs
+2
-1
src/Workspaces/CSharp/Portable/Utilities/FormattingRangeHelper.cs
...spaces/CSharp/Portable/Utilities/FormattingRangeHelper.cs
+2
-1
未找到文件。
src/EditorFeatures/CSharpTest/Formatting/Indentation/SmartTokenFormatterFormatRangeTests.cs
浏览文件 @
3f1aa6e3
...
...
@@ -2921,6 +2921,147 @@ public void M()
await
AutoFormatTokenAsync
(
code
,
expected
);
}
[
WpfFact
]
[
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
SmartTokenFormatting
)]
public
async
Task
UsingStatementWithNestedFixedStatement
()
{
var
code
=
@"class C
{
public void M()
{
using (null)
fixed (void* ptr = &i)
{
}$$
}
}"
;
var
expected
=
@"class C
{
public void M()
{
using (null)
fixed (void* ptr = &i)
{
}
}
}"
;
await
AutoFormatTokenAsync
(
code
,
expected
);
}
[
WpfFact
]
[
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
SmartTokenFormatting
)]
public
async
Task
FixedStatementWithNestedUsingStatement
()
{
var
code
=
@"class C
{
public void M()
{
fixed (void* ptr = &i)
using (null)$$
}
}"
;
var
expected
=
@"class C
{
public void M()
{
fixed (void* ptr = &i)
using (null)
}
}"
;
await
AutoFormatTokenAsync
(
code
,
expected
);
}
[
WpfFact
]
[
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
SmartTokenFormatting
)]
public
async
Task
FixedStatementWithNestedFixedStatement
()
{
var
code
=
@"class C
{
public void M()
{
fixed (void* ptr1 = &i)
fixed (void* ptr2 = &i)
{
}$$
}
}"
;
var
expected
=
@"class C
{
public void M()
{
fixed (void* ptr1 = &i)
fixed (void* ptr2 = &i)
{
}
}
}"
;
await
AutoFormatTokenAsync
(
code
,
expected
);
}
[
WpfFact
]
[
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
SmartTokenFormatting
)]
public
async
Task
FixedStatementWithNestedNotFixedStatement
()
{
var
code
=
@"class C
{
public void M()
{
fixed (void* ptr = &i)
if (false)
{
}$$
}
}"
;
var
expected
=
@"class C
{
public void M()
{
fixed (void* ptr = &i)
if (false)
{
}
}
}"
;
await
AutoFormatTokenAsync
(
code
,
expected
);
}
[
WpfFact
]
[
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
SmartTokenFormatting
)]
public
async
Task
NotFixedStatementWithNestedFixedStatement
()
{
var
code
=
@"class C
{
public void M()
{
if (false)
fixed (void* ptr = &i)
{
}$$
}
}"
;
var
expected
=
@"class C
{
public void M()
{
if (false)
fixed (void* ptr = &i)
{
}
}
}"
;
await
AutoFormatTokenAsync
(
code
,
expected
);
}
[
WpfFact
]
[
WorkItem
(
954386
,
"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/954386"
)]
[
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
SmartTokenFormatting
)]
...
...
src/Workspaces/CSharp/Portable/Extensions/ContextQuery/SyntaxTokenExtensions.cs
浏览文件 @
3f1aa6e3
...
...
@@ -93,6 +93,9 @@ public static bool IsBeginningOfStatementContext(this SyntaxToken token)
// using (expr)
// |
// fixed (void* v = &expr)
// |
// lock (expr)
// |
...
...
@@ -170,7 +173,8 @@ public static bool IsBeginningOfStatementContext(this SyntaxToken token)
parent
.
IsKind
(
SyntaxKind
.
WhileStatement
)
||
parent
.
IsKind
(
SyntaxKind
.
IfStatement
)
||
parent
.
IsKind
(
SyntaxKind
.
LockStatement
)
||
parent
.
IsKind
(
SyntaxKind
.
UsingStatement
))
parent
.
IsKind
(
SyntaxKind
.
UsingStatement
)
||
parent
.
IsKind
(
SyntaxKind
.
FixedStatement
))
{
return
true
;
}
...
...
src/Workspaces/CSharp/Portable/Formatting/FormattingHelpers.cs
浏览文件 @
3f1aa6e3
...
...
@@ -321,6 +321,12 @@ public static bool IsCloseParenInStatement(this SyntaxToken token)
return
usingStatement
.
CloseParenToken
.
Equals
(
token
);
}
var
fixedStatement
=
statement
as
FixedStatementSyntax
;
if
(
fixedStatement
!=
null
)
{
return
fixedStatement
.
CloseParenToken
.
Equals
(
token
);
}
return
false
;
}
...
...
@@ -386,6 +392,7 @@ public static bool IsEmbeddedStatementOwnerWithCloseParen(this SyntaxNode node)
node
is
ForStatementSyntax
||
node
is
ForEachStatementSyntax
||
node
is
UsingStatementSyntax
||
node
is
FixedStatementSyntax
||
node
is
LockStatementSyntax
;
}
...
...
src/Workspaces/CSharp/Portable/Formatting/Rules/IndentBlockFormattingRule.cs
浏览文件 @
3f1aa6e3
...
...
@@ -259,6 +259,13 @@ private void AddEmbeddedStatementsIndentationOperation(List<IndentBlockOperation
return
;
}
var
fixedStatement
=
node
as
FixedStatementSyntax
;
if
(
fixedStatement
!=
null
&&
fixedStatement
.
Statement
!=
null
&&
!(
fixedStatement
.
Statement
is
BlockSyntax
||
fixedStatement
.
Statement
is
FixedStatementSyntax
))
{
AddEmbeddedStatementsIndentationOperation
(
list
,
fixedStatement
.
Statement
);
return
;
}
var
doStatement
=
node
as
DoStatementSyntax
;
if
(
doStatement
!=
null
&&
doStatement
.
Statement
!=
null
&&
!(
doStatement
.
Statement
is
BlockSyntax
))
{
...
...
src/Workspaces/CSharp/Portable/Formatting/Rules/NewLineUserSettingFormattingRule.cs
浏览文件 @
3f1aa6e3
...
...
@@ -21,7 +21,8 @@ private bool IsControlBlock(SyntaxNode node)
parent
.
Kind
()
==
SyntaxKind
.
ForStatement
||
parent
.
Kind
()
==
SyntaxKind
.
TryStatement
||
parent
.
Kind
()
==
SyntaxKind
.
CatchClause
||
parent
.
Kind
()
==
SyntaxKind
.
FinallyClause
||
parent
.
Kind
()
==
SyntaxKind
.
LockStatement
||
parent
.
Kind
()
==
SyntaxKind
.
CheckedStatement
||
parent
.
Kind
()
==
SyntaxKind
.
UncheckedStatement
||
parent
.
Kind
()
==
SyntaxKind
.
SwitchSection
));
parent
.
Kind
()
==
SyntaxKind
.
UncheckedStatement
||
parent
.
Kind
()
==
SyntaxKind
.
SwitchSection
||
parent
.
Kind
()
==
SyntaxKind
.
FixedStatement
));
}
public
override
AdjustSpacesOperation
GetAdjustSpacesOperation
(
SyntaxToken
previousToken
,
SyntaxToken
currentToken
,
OptionSet
optionSet
,
NextOperation
<
AdjustSpacesOperation
>
nextOperation
)
...
...
src/Workspaces/CSharp/Portable/Utilities/FormattingRangeHelper.cs
浏览文件 @
3f1aa6e3
...
...
@@ -359,7 +359,8 @@ private static bool IsSpecialContainingNode(SyntaxNode node)
node
.
Kind
()
==
SyntaxKind
.
CatchClause
||
node
.
Kind
()
==
SyntaxKind
.
FinallyClause
||
node
.
Kind
()
==
SyntaxKind
.
LabeledStatement
||
node
.
Kind
()
==
SyntaxKind
.
LockStatement
;
node
.
Kind
()
==
SyntaxKind
.
LockStatement
||
node
.
Kind
()
==
SyntaxKind
.
FixedStatement
;
}
private
static
SyntaxNode
GetTopContainingNode
(
SyntaxNode
node
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录