Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
fdd7abd1
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,发现更多精彩内容 >>
提交
fdd7abd1
编写于
11月 12, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add use visible options.
上级
14cc80cd
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
52 addition
and
0 deletion
+52
-0
src/VisualStudio/CSharp/Impl/Options/Formatting/StyleViewModel.cs
...alStudio/CSharp/Impl/Options/Formatting/StyleViewModel.cs
+21
-0
src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs
src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs
+9
-0
src/VisualStudio/Core/Def/ServicesVSResources.resx
src/VisualStudio/Core/Def/ServicesVSResources.resx
+3
-0
src/VisualStudio/VisualBasic/Impl/Options/StyleViewModel.vb
src/VisualStudio/VisualBasic/Impl/Options/StyleViewModel.vb
+19
-0
未找到文件。
src/VisualStudio/CSharp/Impl/Options/Formatting/StyleViewModel.cs
浏览文件 @
fdd7abd1
...
...
@@ -406,6 +406,26 @@ public Customer()
//]
}
}
"
;
private
static
readonly
string
s_preferExplicitTupleName
=
@"
class Customer
{
public Customer()
{
//[
// Prefer:
(string name, int age) customer = GetCustomer();
var name = customer.name;
var age = customer.age;
// Over:
(string name, int age) customer = GetCustomer();
var name = customer.Item1;
var age = customer.Item2;
//]
}
}
"
;
private
static
readonly
string
s_preferInlinedVariableDeclaration
=
@"
...
...
@@ -660,6 +680,7 @@ internal StyleViewModel(OptionSet optionSet, IServiceProvider serviceProvider) :
CodeStyleItems
.
Add
(
new
SimpleCodeStyleOptionViewModel
(
CodeStyleOptions
.
PreferCollectionInitializer
,
ServicesVSResources
.
Prefer_collection_initializer
,
s_preferCollectionInitializer
,
s_preferCollectionInitializer
,
this
,
optionSet
,
expressionPreferencesGroupTitle
));
CodeStyleItems
.
Add
(
new
SimpleCodeStyleOptionViewModel
(
CSharpCodeStyleOptions
.
PreferPatternMatchingOverIsWithCastCheck
,
CSharpVSResources
.
Prefer_pattern_matching_over_is_with_cast_check
,
s_preferPatternMatchingOverIsWithCastCheck
,
s_preferPatternMatchingOverIsWithCastCheck
,
this
,
optionSet
,
expressionPreferencesGroupTitle
));
CodeStyleItems
.
Add
(
new
SimpleCodeStyleOptionViewModel
(
CSharpCodeStyleOptions
.
PreferPatternMatchingOverAsWithNullCheck
,
CSharpVSResources
.
Prefer_pattern_matching_over_as_with_null_check
,
s_preferPatternMatchingOverAsWithNullCheck
,
s_preferPatternMatchingOverAsWithNullCheck
,
this
,
optionSet
,
expressionPreferencesGroupTitle
));
CodeStyleItems
.
Add
(
new
SimpleCodeStyleOptionViewModel
(
CodeStyleOptions
.
PreferExplicitTupleNames
,
ServicesVSResources
.
Prefer_explicit_tuple_name
,
s_preferExplicitTupleName
,
s_preferExplicitTupleName
,
this
,
optionSet
,
expressionPreferencesGroupTitle
));
// Variable preferences
CodeStyleItems
.
Add
(
new
SimpleCodeStyleOptionViewModel
(
CodeStyleOptions
.
PreferInlinedVariableDeclaration
,
ServicesVSResources
.
Prefer_inlined_variable_declaration
,
s_preferInlinedVariableDeclaration
,
s_preferInlinedVariableDeclaration
,
this
,
optionSet
,
variablePreferencesGroupTitle
));
...
...
src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs
浏览文件 @
fdd7abd1
...
...
@@ -1392,6 +1392,15 @@ internal class ServicesVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to Prefer explicit tuple name.
/// </summary>
internal
static
string
Prefer_explicit_tuple_name
{
get
{
return
ResourceManager
.
GetString
(
"Prefer_explicit_tuple_name"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to Prefer framework type.
/// </summary>
...
...
src/VisualStudio/Core/Def/ServicesVSResources.resx
浏览文件 @
fdd7abd1
...
...
@@ -816,4 +816,7 @@ Additional information: {1}</value>
<data
name=
"Prefer_null_propagation"
xml:space=
"preserve"
>
<value>
Prefer null propagation
</value>
</data>
<data
name=
"Prefer_explicit_tuple_name"
xml:space=
"preserve"
>
<value>
Prefer explicit tuple name
</value>
</data>
</root>
\ No newline at end of file
src/VisualStudio/VisualBasic/Impl/Options/StyleViewModel.vb
浏览文件 @
fdd7abd1
...
...
@@ -188,6 +188,24 @@ Class Customer
End Sub
End Class"
Private
Shared
ReadOnly
s_preferExplicitTupleName
As
String
=
"
Class Customer
Public Sub New()
//[
' Prefer:
Dim customer As (name As String, age As Integer)
Dim name = customer.name
Dim age = customer.age
' Over
Dim customer As (name As String, age As Integer)
Dim name = customer.Item1
Dim age = customer.Item2
//]
End Sub
end class
"
Private
Shared
ReadOnly
s_preferCoalesceExpression
As
String
=
"
Imports System
...
...
@@ -262,6 +280,7 @@ End Class"
' expression preferences
Me
.
CodeStyleItems
.
Add
(
New
SimpleCodeStyleOptionViewModel
(
CodeStyleOptions
.
PreferObjectInitializer
,
ServicesVSResources
.
Prefer_object_initializer
,
s_preferObjectInitializer
,
s_preferObjectInitializer
,
Me
,
optionSet
,
expressionPreferencesGroupTitle
))
Me
.
CodeStyleItems
.
Add
(
New
SimpleCodeStyleOptionViewModel
(
CodeStyleOptions
.
PreferCollectionInitializer
,
ServicesVSResources
.
Prefer_collection_initializer
,
s_preferCollectionInitializer
,
s_preferCollectionInitializer
,
Me
,
optionSet
,
expressionPreferencesGroupTitle
))
Me
.
CodeStyleItems
.
Add
(
New
SimpleCodeStyleOptionViewModel
(
CodeStyleOptions
.
PreferExplicitTupleNames
,
ServicesVSResources
.
Prefer_explicit_tuple_name
,
s_preferExplicitTupleName
,
s_preferExplicitTupleName
,
Me
,
optionSet
,
expressionPreferencesGroupTitle
))
' nothing preferences
Me
.
CodeStyleItems
.
Add
(
New
SimpleCodeStyleOptionViewModel
(
CodeStyleOptions
.
PreferCoalesceExpression
,
ServicesVSResources
.
Prefer_coalesce_expression
,
s_preferCoalesceExpression
,
s_preferCoalesceExpression
,
Me
,
optionSet
,
nothingPreferencesGroupTitle
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录