Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
923fffcd
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,发现更多精彩内容 >>
提交
923fffcd
编写于
4月 08, 2016
作者:
B
Brett V. Forsgren
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename `SimpleCodeStyleOption` to `CodeStyleOption<bool>` and serialize C# preferences
上级
330ecc80
变更
26
隐藏空白更改
内联
并排
Showing
26 changed file
with
222 addition
and
160 deletion
+222
-160
src/EditorFeatures/CSharpTest/CodeActions/IntroduceVariable/IntroduceVariableTests.cs
...t/CodeActions/IntroduceVariable/IntroduceVariableTests.cs
+1
-1
src/EditorFeatures/CSharpTest/Diagnostics/GenerateVariable/GenerateVariableTests.cs
...est/Diagnostics/GenerateVariable/GenerateVariableTests.cs
+1
-1
src/EditorFeatures/CSharpTest/Diagnostics/QualifyMemberAccess/QualifyMemberAccessTests.cs
...agnostics/QualifyMemberAccess/QualifyMemberAccessTests.cs
+2
-2
src/EditorFeatures/CSharpTest/Diagnostics/UseImplicitOrExplicitType/UseExplicitTypeTests.cs
...nostics/UseImplicitOrExplicitType/UseExplicitTypeTests.cs
+8
-8
src/EditorFeatures/CSharpTest/Diagnostics/UseImplicitOrExplicitType/UseImplicitTypeTests.cs
...nostics/UseImplicitOrExplicitType/UseImplicitTypeTests.cs
+8
-8
src/EditorFeatures/CSharpTest/EventHookup/EventHookupCommandHandlerTests.cs
.../CSharpTest/EventHookup/EventHookupCommandHandlerTests.cs
+1
-1
src/EditorFeatures/Test/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
...est/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
+2
-2
src/EditorFeatures/Test2/Simplification/TypeNameSimplifierTest.vb
...orFeatures/Test2/Simplification/TypeNameSimplifierTest.vb
+5
-5
src/EditorFeatures/VisualBasicTest/Diagnostics/QualifyMemberAccess/QualifyMemberAccessTests.vb
...agnostics/QualifyMemberAccess/QualifyMemberAccessTests.vb
+2
-2
src/Features/CSharp/Portable/Diagnostics/Analyzers/CSharpTypeStyleDiagnosticAnalyzerBase.State.cs
.../Analyzers/CSharpTypeStyleDiagnosticAnalyzerBase.State.cs
+3
-3
src/VisualStudio/CSharp/Impl/Options/AutomationObject.cs
src/VisualStudio/CSharp/Impl/Options/AutomationObject.cs
+30
-49
src/VisualStudio/CSharp/Impl/Options/CSharpSettingsManagerOptionSerializer.cs
...arp/Impl/Options/CSharpSettingsManagerOptionSerializer.cs
+60
-15
src/VisualStudio/CSharp/Impl/Options/Formatting/StyleViewModel.cs
...alStudio/CSharp/Impl/Options/Formatting/StyleViewModel.cs
+3
-1
src/VisualStudio/Core/Impl/Options/AbstractOptionPreviewViewModel.cs
...tudio/Core/Impl/Options/AbstractOptionPreviewViewModel.cs
+19
-2
src/VisualStudio/Core/Impl/Options/BooleanCodeStyleOptionViewModel.cs
...udio/Core/Impl/Options/BooleanCodeStyleOptionViewModel.cs
+1
-1
src/VisualStudio/Core/Impl/Options/CheckBoxWithComboViewModel.cs
...ualStudio/Core/Impl/Options/CheckBoxWithComboViewModel.cs
+5
-5
src/VisualStudio/Core/Impl/Options/SimpleCodeStyleOptionViewModel.cs
...tudio/Core/Impl/Options/SimpleCodeStyleOptionViewModel.cs
+5
-5
src/VisualStudio/VisualBasic/Impl/Options/AutomationObject.vb
...VisualStudio/VisualBasic/Impl/Options/AutomationObject.vb
+4
-4
src/Workspaces/CSharp/Portable/CodeStyle/CSharpCodeStyleOptions.cs
...paces/CSharp/Portable/CodeStyle/CSharpCodeStyleOptions.cs
+3
-3
src/Workspaces/CSharp/Portable/CodeStyle/CSharpCodeStyleOptionsProvider.cs
...harp/Portable/CodeStyle/CSharpCodeStyleOptionsProvider.cs
+5
-0
src/Workspaces/CSharp/Portable/CodeStyle/TypeStyle/TypeStyleHelper.cs
...es/CSharp/Portable/CodeStyle/TypeStyle/TypeStyleHelper.cs
+3
-3
src/Workspaces/Core/Portable/CodeStyle/CodeStyleOption.cs
src/Workspaces/Core/Portable/CodeStyle/CodeStyleOption.cs
+28
-16
src/Workspaces/Core/Portable/CodeStyle/CodeStyleOptions.cs
src/Workspaces/Core/Portable/CodeStyle/CodeStyleOptions.cs
+4
-4
src/Workspaces/Core/Portable/PublicAPI.Unshipped.txt
src/Workspaces/Core/Portable/PublicAPI.Unshipped.txt
+14
-14
src/Workspaces/Core/Portable/Simplification/SimplificationHelpers.cs
...ces/Core/Portable/Simplification/SimplificationHelpers.cs
+4
-4
src/Workspaces/Core/Portable/Workspaces.csproj
src/Workspaces/Core/Portable/Workspaces.csproj
+1
-1
未找到文件。
src/EditorFeatures/CSharpTest/CodeActions/IntroduceVariable/IntroduceVariableTests.cs
浏览文件 @
923fffcd
...
...
@@ -20,7 +20,7 @@ protected override object CreateCodeRefactoringProvider(Workspace workspace)
return
new
IntroduceVariableCodeRefactoringProvider
();
}
private
readonly
SimpleCodeStyleOption
onWithInfo
=
new
SimpleCodeStyleOption
(
true
,
NotificationOption
.
Info
);
private
readonly
CodeStyleOption
<
bool
>
onWithInfo
=
new
CodeStyleOption
<
bool
>
(
true
,
NotificationOption
.
Info
);
// specify all options explicitly to override defaults.
private
IDictionary
<
OptionKey
,
object
>
ImplicitTypingEverywhere
()
=>
...
...
src/EditorFeatures/CSharpTest/Diagnostics/GenerateVariable/GenerateVariableTests.cs
浏览文件 @
923fffcd
...
...
@@ -24,7 +24,7 @@ public class GenerateVariableTests : AbstractCSharpDiagnosticProviderBasedUserDi
null
,
new
GenerateVariableCodeFixProvider
());
}
private
readonly
SimpleCodeStyleOption
onWithInfo
=
new
SimpleCodeStyleOption
(
true
,
NotificationOption
.
Info
);
private
readonly
CodeStyleOption
<
bool
>
onWithInfo
=
new
CodeStyleOption
<
bool
>
(
true
,
NotificationOption
.
Info
);
// specify all options explicitly to override defaults.
private
IDictionary
<
OptionKey
,
object
>
ImplicitTypingEverywhere
()
=>
...
...
src/EditorFeatures/CSharpTest/Diagnostics/QualifyMemberAccess/QualifyMemberAccessTests.cs
浏览文件 @
923fffcd
...
...
@@ -20,12 +20,12 @@ public class QualifyMemberAccessTests : AbstractCSharpDiagnosticProviderBasedUse
return
Tuple
.
Create
<
DiagnosticAnalyzer
,
CodeFixProvider
>(
new
CSharpQualifyMemberAccessDiagnosticAnalyzer
(),
new
CSharpQualifyMemberAccessCodeFixProvider
());
}
private
Task
TestAsyncWithOption
(
string
code
,
string
expected
,
PerLanguageOption
<
SimpleCodeStyleOption
>
option
)
private
Task
TestAsyncWithOption
(
string
code
,
string
expected
,
PerLanguageOption
<
CodeStyleOption
<
bool
>
>
option
)
{
return
TestAsync
(
code
,
expected
,
options
:
Option
(
option
,
true
,
NotificationOption
.
Error
));
}
private
Task
TestMissingAsyncWithOption
(
string
code
,
PerLanguageOption
<
SimpleCodeStyleOption
>
option
)
private
Task
TestMissingAsyncWithOption
(
string
code
,
PerLanguageOption
<
CodeStyleOption
<
bool
>
>
option
)
{
return
TestMissingAsync
(
code
,
options
:
Option
(
option
,
true
,
NotificationOption
.
Error
));
}
...
...
src/EditorFeatures/CSharpTest/Diagnostics/UseImplicitOrExplicitType/UseExplicitTypeTests.cs
浏览文件 @
923fffcd
...
...
@@ -22,14 +22,14 @@ public partial class UseExplicitTypeTests : AbstractCSharpDiagnosticProviderBase
new
Tuple
<
DiagnosticAnalyzer
,
CodeFixProvider
>(
new
CSharpUseExplicitTypeDiagnosticAnalyzer
(),
new
UseExplicitTypeCodeFixProvider
());
private
readonly
SimpleCodeStyleOption
onWithNone
=
new
SimpleCodeStyleOption
(
true
,
NotificationOption
.
None
);
private
readonly
SimpleCodeStyleOption
offWithNone
=
new
SimpleCodeStyleOption
(
false
,
NotificationOption
.
None
);
private
readonly
SimpleCodeStyleOption
onWithInfo
=
new
SimpleCodeStyleOption
(
true
,
NotificationOption
.
Info
);
private
readonly
SimpleCodeStyleOption
offWithInfo
=
new
SimpleCodeStyleOption
(
false
,
NotificationOption
.
Info
);
private
readonly
SimpleCodeStyleOption
onWithWarning
=
new
SimpleCodeStyleOption
(
true
,
NotificationOption
.
Warning
);
private
readonly
SimpleCodeStyleOption
offWithWarning
=
new
SimpleCodeStyleOption
(
false
,
NotificationOption
.
Warning
);
private
readonly
SimpleCodeStyleOption
onWithError
=
new
SimpleCodeStyleOption
(
true
,
NotificationOption
.
Error
);
private
readonly
SimpleCodeStyleOption
offWithError
=
new
SimpleCodeStyleOption
(
false
,
NotificationOption
.
Error
);
private
readonly
CodeStyleOption
<
bool
>
onWithNone
=
new
CodeStyleOption
<
bool
>
(
true
,
NotificationOption
.
None
);
private
readonly
CodeStyleOption
<
bool
>
offWithNone
=
new
CodeStyleOption
<
bool
>
(
false
,
NotificationOption
.
None
);
private
readonly
CodeStyleOption
<
bool
>
onWithInfo
=
new
CodeStyleOption
<
bool
>
(
true
,
NotificationOption
.
Info
);
private
readonly
CodeStyleOption
<
bool
>
offWithInfo
=
new
CodeStyleOption
<
bool
>
(
false
,
NotificationOption
.
Info
);
private
readonly
CodeStyleOption
<
bool
>
onWithWarning
=
new
CodeStyleOption
<
bool
>
(
true
,
NotificationOption
.
Warning
);
private
readonly
CodeStyleOption
<
bool
>
offWithWarning
=
new
CodeStyleOption
<
bool
>
(
false
,
NotificationOption
.
Warning
);
private
readonly
CodeStyleOption
<
bool
>
onWithError
=
new
CodeStyleOption
<
bool
>
(
true
,
NotificationOption
.
Error
);
private
readonly
CodeStyleOption
<
bool
>
offWithError
=
new
CodeStyleOption
<
bool
>
(
false
,
NotificationOption
.
Error
);
// specify all options explicitly to override defaults.
private
IDictionary
<
OptionKey
,
object
>
ExplicitTypeEverywhere
()
=>
...
...
src/EditorFeatures/CSharpTest/Diagnostics/UseImplicitOrExplicitType/UseImplicitTypeTests.cs
浏览文件 @
923fffcd
...
...
@@ -23,14 +23,14 @@ public partial class UseImplicitTypeTests : AbstractCSharpDiagnosticProviderBase
new
Tuple
<
DiagnosticAnalyzer
,
CodeFixProvider
>(
new
CSharpUseImplicitTypeDiagnosticAnalyzer
(),
new
UseImplicitTypeCodeFixProvider
());
private
readonly
SimpleCodeStyleOption
onWithNone
=
new
SimpleCodeStyleOption
(
true
,
NotificationOption
.
None
);
private
readonly
SimpleCodeStyleOption
offWithNone
=
new
SimpleCodeStyleOption
(
false
,
NotificationOption
.
None
);
private
readonly
SimpleCodeStyleOption
onWithInfo
=
new
SimpleCodeStyleOption
(
true
,
NotificationOption
.
Info
);
private
readonly
SimpleCodeStyleOption
offWithInfo
=
new
SimpleCodeStyleOption
(
false
,
NotificationOption
.
Info
);
private
readonly
SimpleCodeStyleOption
onWithWarning
=
new
SimpleCodeStyleOption
(
true
,
NotificationOption
.
Warning
);
private
readonly
SimpleCodeStyleOption
offWithWarning
=
new
SimpleCodeStyleOption
(
false
,
NotificationOption
.
Warning
);
private
readonly
SimpleCodeStyleOption
onWithError
=
new
SimpleCodeStyleOption
(
true
,
NotificationOption
.
Error
);
private
readonly
SimpleCodeStyleOption
offWithError
=
new
SimpleCodeStyleOption
(
false
,
NotificationOption
.
Error
);
private
readonly
CodeStyleOption
<
bool
>
onWithNone
=
new
CodeStyleOption
<
bool
>
(
true
,
NotificationOption
.
None
);
private
readonly
CodeStyleOption
<
bool
>
offWithNone
=
new
CodeStyleOption
<
bool
>
(
false
,
NotificationOption
.
None
);
private
readonly
CodeStyleOption
<
bool
>
onWithInfo
=
new
CodeStyleOption
<
bool
>
(
true
,
NotificationOption
.
Info
);
private
readonly
CodeStyleOption
<
bool
>
offWithInfo
=
new
CodeStyleOption
<
bool
>
(
false
,
NotificationOption
.
Info
);
private
readonly
CodeStyleOption
<
bool
>
onWithWarning
=
new
CodeStyleOption
<
bool
>
(
true
,
NotificationOption
.
Warning
);
private
readonly
CodeStyleOption
<
bool
>
offWithWarning
=
new
CodeStyleOption
<
bool
>
(
false
,
NotificationOption
.
Warning
);
private
readonly
CodeStyleOption
<
bool
>
onWithError
=
new
CodeStyleOption
<
bool
>
(
true
,
NotificationOption
.
Error
);
private
readonly
CodeStyleOption
<
bool
>
offWithError
=
new
CodeStyleOption
<
bool
>
(
false
,
NotificationOption
.
Error
);
// specify all options explicitly to override defaults.
private
IDictionary
<
OptionKey
,
object
>
ImplicitTypeEverywhere
()
=>
...
...
src/EditorFeatures/CSharpTest/EventHookup/EventHookupCommandHandlerTests.cs
浏览文件 @
923fffcd
...
...
@@ -962,6 +962,6 @@ private void C_MyEvent()
}
}
private
IDictionary
<
OptionKey
,
object
>
QualifyMethodAccess
=>
new
Dictionary
<
OptionKey
,
object
>()
{
{
new
OptionKey
(
CodeStyleOptions
.
QualifyMethodAccess
,
LanguageNames
.
CSharp
),
new
SimpleCodeStyleOption
(
true
,
NotificationOption
.
Error
)
}
};
private
IDictionary
<
OptionKey
,
object
>
QualifyMethodAccess
=>
new
Dictionary
<
OptionKey
,
object
>()
{
{
new
OptionKey
(
CodeStyleOptions
.
QualifyMethodAccess
,
LanguageNames
.
CSharp
),
new
CodeStyleOption
<
bool
>
(
true
,
NotificationOption
.
Error
)
}
};
}
}
src/EditorFeatures/Test/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
浏览文件 @
923fffcd
...
...
@@ -367,9 +367,9 @@ protected static IList<CodeAction> FlattenActions(IEnumerable<CodeAction> codeAc
return
codeActions
?.
SelectMany
(
a
=>
a
.
HasCodeActions
?
a
.
GetCodeActions
().
ToArray
()
:
new
[]
{
a
}).
ToList
();
}
protected
IDictionary
<
OptionKey
,
object
>
Option
(
PerLanguageOption
<
CodeStyle
.
SimpleCodeStyleOption
>
option
,
bool
value
,
CodeStyle
.
NotificationOption
notification
)
protected
IDictionary
<
OptionKey
,
object
>
Option
(
PerLanguageOption
<
CodeStyle
.
CodeStyleOption
<
bool
>
>
option
,
bool
value
,
CodeStyle
.
NotificationOption
notification
)
{
return
new
Dictionary
<
OptionKey
,
object
>()
{
{
new
OptionKey
(
option
,
GetLanguage
()),
new
CodeStyle
.
SimpleCodeStyleOption
(
value
,
notification
)
}
};
return
new
Dictionary
<
OptionKey
,
object
>()
{
{
new
OptionKey
(
option
,
GetLanguage
()),
new
CodeStyle
.
CodeStyleOption
<
bool
>
(
value
,
notification
)
}
};
}
}
}
src/EditorFeatures/Test2/Simplification/TypeNameSimplifierTest.vb
浏览文件 @
923fffcd
...
...
@@ -2437,7 +2437,7 @@ class C
}
]]
>
</
text
>
Dim
simplificationOptionSet
=
New
Dictionary
(
Of
OptionKey
,
Object
)
From
{{
New
OptionKey
(
CodeStyleOptions
.
QualifyFieldAccess
,
LanguageNames
.
CSharp
),
New
SimpleCodeStyleOption
(
True
,
NotificationOption
.
Error
)}}
Dim
simplificationOptionSet
=
New
Dictionary
(
Of
OptionKey
,
Object
)
From
{{
New
OptionKey
(
CodeStyleOptions
.
QualifyFieldAccess
,
LanguageNames
.
CSharp
),
New
CodeStyleOption
(
Of
Boolean
)
(
True
,
NotificationOption
.
Error
)}}
Await
TestAsync
(
input
,
expected
,
simplificationOptionSet
)
End
Function
...
...
@@ -5555,19 +5555,19 @@ End Class
#Region "Helpers"
Protected
Function
QualifyFieldAccessOption
(
languageName
As
String
)
As
Dictionary
(
Of
OptionKey
,
Object
)
Return
New
Dictionary
(
Of
OptionKey
,
Object
)
From
{{
New
OptionKey
(
CodeStyleOptions
.
QualifyFieldAccess
,
languageName
),
New
SimpleCodeStyleOption
(
True
,
NotificationOption
.
Error
)}}
Return
New
Dictionary
(
Of
OptionKey
,
Object
)
From
{{
New
OptionKey
(
CodeStyleOptions
.
QualifyFieldAccess
,
languageName
),
New
CodeStyleOption
(
Of
Boolean
)
(
True
,
NotificationOption
.
Error
)}}
End
Function
Protected
Function
QualifyPropertyAccessOption
(
languageName
As
String
)
As
Dictionary
(
Of
OptionKey
,
Object
)
Return
New
Dictionary
(
Of
OptionKey
,
Object
)
From
{{
New
OptionKey
(
CodeStyleOptions
.
QualifyPropertyAccess
,
languageName
),
New
SimpleCodeStyleOption
(
True
,
NotificationOption
.
Error
)}}
Return
New
Dictionary
(
Of
OptionKey
,
Object
)
From
{{
New
OptionKey
(
CodeStyleOptions
.
QualifyPropertyAccess
,
languageName
),
New
CodeStyleOption
(
Of
Boolean
)
(
True
,
NotificationOption
.
Error
)}}
End
Function
Protected
Function
QualifyMethodAccessOption
(
languageName
As
String
)
As
Dictionary
(
Of
OptionKey
,
Object
)
Return
New
Dictionary
(
Of
OptionKey
,
Object
)
From
{{
New
OptionKey
(
CodeStyleOptions
.
QualifyMethodAccess
,
languageName
),
New
SimpleCodeStyleOption
(
True
,
NotificationOption
.
Error
)}}
Return
New
Dictionary
(
Of
OptionKey
,
Object
)
From
{{
New
OptionKey
(
CodeStyleOptions
.
QualifyMethodAccess
,
languageName
),
New
CodeStyleOption
(
Of
Boolean
)
(
True
,
NotificationOption
.
Error
)}}
End
Function
Protected
Function
QualifyEventAccessOption
(
languageName
As
String
)
As
Dictionary
(
Of
OptionKey
,
Object
)
Return
New
Dictionary
(
Of
OptionKey
,
Object
)
From
{{
New
OptionKey
(
CodeStyleOptions
.
QualifyEventAccess
,
languageName
),
New
SimpleCodeStyleOption
(
True
,
NotificationOption
.
Error
)}}
Return
New
Dictionary
(
Of
OptionKey
,
Object
)
From
{{
New
OptionKey
(
CodeStyleOptions
.
QualifyEventAccess
,
languageName
),
New
CodeStyleOption
(
Of
Boolean
)
(
True
,
NotificationOption
.
Error
)}}
End
Function
Shared
DontPreferIntrinsicPredefinedTypeKeywordInDeclaration
As
Dictionary
(
Of
OptionKey
,
Object
)
=
New
Dictionary
(
Of
OptionKey
,
Object
)
From
{{
New
OptionKey
(
SimplificationOptions
.
PreferIntrinsicPredefinedTypeKeywordInDeclaration
,
LanguageNames
.
VisualBasic
),
False
}}
...
...
src/EditorFeatures/VisualBasicTest/Diagnostics/QualifyMemberAccess/QualifyMemberAccessTests.vb
浏览文件 @
923fffcd
...
...
@@ -15,11 +15,11 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics.Qualif
Return
Tuple
.
Create
(
Of
DiagnosticAnalyzer
,
CodeFixProvider
)(
New
VisualBasicQualifyMemberAccessDiagnosticAnalyzer
(),
New
VisualBasicQualifyMemberAccessCodeFixProvider
())
End
Function
Private
Function
TestAsyncWithOption
(
code
As
String
,
expected
As
String
,
opt
As
PerLanguageOption
(
Of
SimpleCodeStyleOption
))
As
Task
Private
Function
TestAsyncWithOption
(
code
As
String
,
expected
As
String
,
opt
As
PerLanguageOption
(
Of
CodeStyleOption
(
Of
Boolean
)
))
As
Task
Return
TestAsync
(
code
,
expected
,
options
:
=
[
Option
]
(
opt
,
True
,
NotificationOption
.
Error
))
End
Function
Private
Function
TestMissingAsyncWithOption
(
code
As
String
,
opt
As
PerLanguageOption
(
Of
SimpleCodeStyleOption
))
As
Task
Private
Function
TestMissingAsyncWithOption
(
code
As
String
,
opt
As
PerLanguageOption
(
Of
CodeStyleOption
(
Of
Boolean
)
))
As
Task
Return
TestMissingAsync
(
code
,
options
:
=
[
Option
]
(
opt
,
True
,
NotificationOption
.
Error
))
End
Function
...
...
src/Features/CSharp/Portable/Diagnostics/Analyzers/CSharpTypeStyleDiagnosticAnalyzerBase.State.cs
浏览文件 @
923fffcd
...
...
@@ -136,17 +136,17 @@ private TypeStylePreference GetCurrentTypeStylePreferences(OptionSet optionSet)
_styleToSeverityMap
.
Add
(
TypeStylePreference
.
ImplicitTypeWhereApparent
,
styleForApparent
.
Notification
.
Value
);
_styleToSeverityMap
.
Add
(
TypeStylePreference
.
ImplicitTypeWherePossible
,
styleForElsewhere
.
Notification
.
Value
);
if
(
styleForIntrinsicTypes
.
IsChecked
)
if
(
styleForIntrinsicTypes
.
Value
)
{
stylePreferences
|=
TypeStylePreference
.
ImplicitTypeForIntrinsicTypes
;
}
if
(
styleForApparent
.
IsChecked
)
if
(
styleForApparent
.
Value
)
{
stylePreferences
|=
TypeStylePreference
.
ImplicitTypeWhereApparent
;
}
if
(
styleForElsewhere
.
IsChecked
)
if
(
styleForElsewhere
.
Value
)
{
stylePreferences
|=
TypeStylePreference
.
ImplicitTypeWherePossible
;
}
...
...
src/VisualStudio/CSharp/Impl/Options/AutomationObject.cs
浏览文件 @
923fffcd
...
...
@@ -487,28 +487,28 @@ public string Style_NamingPreferences
}
}
public
int
Style_QualifyFieldAccess
public
string
Style_QualifyFieldAccess
{
get
{
return
Get
Boolean
Option
(
CodeStyleOptions
.
QualifyFieldAccess
);
}
set
{
Set
Boolean
Option
(
CodeStyleOptions
.
QualifyFieldAccess
,
value
);
}
get
{
return
Get
Xml
Option
(
CodeStyleOptions
.
QualifyFieldAccess
);
}
set
{
Set
Xml
Option
(
CodeStyleOptions
.
QualifyFieldAccess
,
value
);
}
}
public
int
Style_QualifyPropertyAccess
public
string
Style_QualifyPropertyAccess
{
get
{
return
Get
Boolean
Option
(
CodeStyleOptions
.
QualifyPropertyAccess
);
}
set
{
Set
Boolean
Option
(
CodeStyleOptions
.
QualifyPropertyAccess
,
value
);
}
get
{
return
Get
Xml
Option
(
CodeStyleOptions
.
QualifyPropertyAccess
);
}
set
{
Set
Xml
Option
(
CodeStyleOptions
.
QualifyPropertyAccess
,
value
);
}
}
public
int
Style_QualifyMethodAccess
public
string
Style_QualifyMethodAccess
{
get
{
return
Get
Boolean
Option
(
CodeStyleOptions
.
QualifyMethodAccess
);
}
set
{
Set
Boolean
Option
(
CodeStyleOptions
.
QualifyMethodAccess
,
value
);
}
get
{
return
Get
Xml
Option
(
CodeStyleOptions
.
QualifyMethodAccess
);
}
set
{
Set
Xml
Option
(
CodeStyleOptions
.
QualifyMethodAccess
,
value
);
}
}
public
int
Style_QualifyEventAccess
public
string
Style_QualifyEventAccess
{
get
{
return
Get
Boolean
Option
(
CodeStyleOptions
.
QualifyEventAccess
);
}
set
{
Set
Boolean
Option
(
CodeStyleOptions
.
QualifyEventAccess
,
value
);
}
get
{
return
Get
Xml
Option
(
CodeStyleOptions
.
QualifyEventAccess
);
}
set
{
Set
Xml
Option
(
CodeStyleOptions
.
QualifyEventAccess
,
value
);
}
}
public
int
Style_UseVarWhenDeclaringLocals
...
...
@@ -519,38 +519,20 @@ public int Style_UseVarWhenDeclaringLocals
public
string
Style_UseImplicitTypeWherePossible
{
get
{
return
GetUseVarOption
(
CSharpCodeStyleOptions
.
UseImplicitTypeWherePossible
);
}
set
{
SetUseVarOption
(
CSharpCodeStyleOptions
.
UseImplicitTypeWherePossible
,
value
);
}
get
{
return
GetXmlOption
(
CSharpCodeStyleOptions
.
UseImplicitTypeWherePossible
);
}
set
{
SetXmlOption
(
CSharpCodeStyleOptions
.
UseImplicitTypeWherePossible
,
value
);
}
}
public
string
Style_UseImplicitTypeWhereApparent
{
get
{
return
GetUseVarOption
(
CSharpCodeStyleOptions
.
UseImplicitTypeWhereApparent
);
}
set
{
SetUseVarOption
(
CSharpCodeStyleOptions
.
UseImplicitTypeWhereApparent
,
value
);
}
get
{
return
GetXmlOption
(
CSharpCodeStyleOptions
.
UseImplicitTypeWhereApparent
);
}
set
{
SetXmlOption
(
CSharpCodeStyleOptions
.
UseImplicitTypeWhereApparent
,
value
);
}
}
public
string
Style_UseImplicitTypeForIntrinsicTypes
{
get
{
return
GetUseVarOption
(
CSharpCodeStyleOptions
.
UseImplicitTypeForIntrinsicTypes
);
}
set
{
SetUseVarOption
(
CSharpCodeStyleOptions
.
UseImplicitTypeForIntrinsicTypes
,
value
);
}
get
{
return
GetXmlOption
(
CSharpCodeStyleOptions
.
UseImplicitTypeForIntrinsicTypes
);
}
set
{
SetXmlOption
(
CSharpCodeStyleOptions
.
UseImplicitTypeForIntrinsicTypes
,
value
);
}
}
public
int
Wrapping_IgnoreSpacesAroundBinaryOperators
...
...
@@ -594,11 +576,6 @@ private int GetBooleanOption(PerLanguageOption<bool> key)
return
_workspace
.
Options
.
GetOption
(
key
,
LanguageNames
.
CSharp
)
?
1
:
0
;
}
private
int
GetBooleanOption
(
PerLanguageOption
<
SimpleCodeStyleOption
>
key
)
{
return
_workspace
.
Options
.
GetOption
(
key
,
LanguageNames
.
CSharp
).
IsChecked
?
1
:
0
;
}
private
void
SetBooleanOption
(
Option
<
bool
>
key
,
int
value
)
{
_workspace
.
Options
=
_workspace
.
Options
.
WithChangedOption
(
key
,
value
!=
0
);
...
...
@@ -620,11 +597,9 @@ private int GetBooleanOption(PerLanguageOption<bool?> key)
return
option
.
Value
?
1
:
0
;
}
private
void
SetBooleanOption
(
PerLanguageOption
<
SimpleCodeStyleOption
>
key
,
int
value
)
private
string
GetXmlOption
(
Option
<
CodeStyleOption
<
bool
>>
option
)
{
var
opt
=
_workspace
.
Options
.
GetOption
(
key
,
LanguageNames
.
CSharp
);
opt
.
IsChecked
=
value
!=
0
;
_workspace
.
Options
=
_workspace
.
Options
.
WithChangedOption
(
key
,
LanguageNames
.
CSharp
,
opt
);
return
_workspace
.
Options
.
GetOption
(
option
).
ToXElement
().
ToString
();
}
private
void
SetBooleanOption
(
PerLanguageOption
<
bool
?>
key
,
int
value
)
...
...
@@ -633,15 +608,21 @@ private void SetBooleanOption(PerLanguageOption<bool?> key, int value)
_workspace
.
Options
=
_workspace
.
Options
.
WithChangedOption
(
key
,
LanguageNames
.
CSharp
,
boolValue
);
}
private
string
Get
UseVarOption
(
Option
<
SimpleCodeStyleOption
>
option
)
private
string
Get
XmlOption
(
PerLanguageOption
<
CodeStyleOption
<
bool
>
>
option
)
{
return
_workspace
.
Options
.
GetOption
(
option
).
ToXElement
().
ToString
();
return
_workspace
.
Options
.
GetOption
(
option
,
LanguageNames
.
CSharp
).
ToXElement
().
ToString
();
}
private
void
Set
UseVarOption
(
Option
<
SimpleCodeStyleOption
>
option
,
string
value
)
private
void
Set
XmlOption
(
Option
<
CodeStyleOption
<
bool
>
>
option
,
string
value
)
{
var
convertedValue
=
SimpleCodeStyleOption
.
FromXElement
(
XElement
.
Parse
(
value
));
var
convertedValue
=
CodeStyleOption
<
bool
>
.
FromXElement
(
XElement
.
Parse
(
value
));
_workspace
.
Options
=
_workspace
.
Options
.
WithChangedOption
(
option
,
convertedValue
);
}
private
void
SetXmlOption
(
PerLanguageOption
<
CodeStyleOption
<
bool
>>
option
,
string
value
)
{
var
convertedValue
=
CodeStyleOption
<
bool
>.
FromXElement
(
XElement
.
Parse
(
value
));
_workspace
.
Options
=
_workspace
.
Options
.
WithChangedOption
(
option
,
LanguageNames
.
CSharp
,
convertedValue
);
}
}
}
src/VisualStudio/CSharp/Impl/Options/CSharpSettingsManagerOptionSerializer.cs
浏览文件 @
923fffcd
...
...
@@ -33,6 +33,7 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.Options
CompletionOptions
.
FeatureName
,
CSharpCompletionOptions
.
FeatureName
,
CSharpCodeStyleOptions
.
FeatureName
,
CodeStyleOptions
.
PerLanguageCodeStyleOption
,
SimplificationOptions
.
PerLanguageFeatureName
,
ExtractMethodOptions
.
FeatureName
,
CSharpFormattingOptions
.
IndentFeatureName
,
...
...
@@ -54,6 +55,10 @@ public CSharpSettingsManagerOptionSerializer(SVsServiceProvider serviceProvider,
private
const
string
SpaceAroundBinaryOperator
=
nameof
(
AutomationObject
.
Space_AroundBinaryOperator
);
private
const
string
UnindentLabels
=
nameof
(
AutomationObject
.
Indent_UnindentLabels
);
private
const
string
FlushLabelsLeft
=
nameof
(
AutomationObject
.
Indent_FlushLabelsLeft
);
private
const
string
Style_QualifyFieldAccess
=
nameof
(
AutomationObject
.
Style_QualifyFieldAccess
);
private
const
string
Style_QualifyPropertyAccess
=
nameof
(
AutomationObject
.
Style_QualifyPropertyAccess
);
private
const
string
Style_QualifyMethodAccess
=
nameof
(
AutomationObject
.
Style_QualifyMethodAccess
);
private
const
string
Style_QualifyEventAccess
=
nameof
(
AutomationObject
.
Style_QualifyEventAccess
);
private
const
string
Style_UseImplicitTypeForIntrinsicTypes
=
nameof
(
AutomationObject
.
Style_UseImplicitTypeForIntrinsicTypes
);
private
const
string
Style_UseImplicitTypeWhereApparent
=
nameof
(
AutomationObject
.
Style_UseImplicitTypeWhereApparent
);
private
const
string
Style_UseImplicitTypeWherePossible
=
nameof
(
AutomationObject
.
Style_UseImplicitTypeWherePossible
);
...
...
@@ -89,7 +94,8 @@ private bool ShouldIncludeOnOffOption(FieldInfo fieldInfo)
typeof
(
CSharpCodeStyleOptions
),
typeof
(
ExtractMethodOptions
),
typeof
(
ServiceFeatureOnOffOptions
),
typeof
(
CSharpFormattingOptions
)
typeof
(
CSharpFormattingOptions
),
typeof
(
CodeStyleOptions
)
};
var
bindingFlags
=
BindingFlags
.
Public
|
BindingFlags
.
Static
;
...
...
@@ -126,6 +132,7 @@ protected override bool SupportsOption(IOption option, string languageName)
option
==
AddImportOptions
.
SuggestForTypesInNuGetPackages
||
option
==
CSharpCompletionOptions
.
AddNewLineOnEnterAfterFullyTypedWord
||
option
==
CSharpCompletionOptions
.
IncludeSnippets
||
option
.
Feature
==
CodeStyleOptions
.
PerLanguageCodeStyleOption
||
option
.
Feature
==
CSharpCodeStyleOptions
.
FeatureName
||
option
.
Feature
==
CSharpFormattingOptions
.
WrappingFeatureName
||
option
.
Feature
==
CSharpFormattingOptions
.
IndentFeatureName
||
...
...
@@ -224,26 +231,46 @@ public override bool TryFetch(OptionKey optionKey, out object value)
return
true
;
}
// code style: use this.
if
(
optionKey
.
Option
==
CodeStyleOptions
.
QualifyFieldAccess
)
{
return
FetchStyleBool
(
Style_QualifyFieldAccess
,
out
value
);
}
else
if
(
optionKey
.
Option
==
CodeStyleOptions
.
QualifyPropertyAccess
)
{
return
FetchStyleBool
(
Style_QualifyPropertyAccess
,
out
value
);
}
else
if
(
optionKey
.
Option
==
CodeStyleOptions
.
QualifyMethodAccess
)
{
return
FetchStyleBool
(
Style_QualifyMethodAccess
,
out
value
);
}
else
if
(
optionKey
.
Option
==
CodeStyleOptions
.
QualifyEventAccess
)
{
return
FetchStyleBool
(
Style_QualifyEventAccess
,
out
value
);
}
// code style: use var options.
if
(
optionKey
.
Option
==
CSharpCodeStyleOptions
.
UseImplicitTypeForIntrinsicTypes
)
{
var
typeStyleValue
=
this
.
Manager
.
GetValueOrDefault
<
string
>(
Style_UseImplicitTypeForIntrinsicTypes
);
return
FetchTypeStyleOption
(
typeStyleValue
,
out
value
);
return
FetchStyleBool
(
Style_UseImplicitTypeForIntrinsicTypes
,
out
value
);
}
else
if
(
optionKey
.
Option
==
CSharpCodeStyleOptions
.
UseImplicitTypeWhereApparent
)
{
var
typeStyleValue
=
this
.
Manager
.
GetValueOrDefault
<
string
>(
Style_UseImplicitTypeWhereApparent
);
return
FetchTypeStyleOption
(
typeStyleValue
,
out
value
);
return
FetchStyleBool
(
Style_UseImplicitTypeWhereApparent
,
out
value
);
}
else
if
(
optionKey
.
Option
==
CSharpCodeStyleOptions
.
UseImplicitTypeWherePossible
)
{
var
typeStyleValue
=
this
.
Manager
.
GetValueOrDefault
<
string
>(
Style_UseImplicitTypeWherePossible
);
return
FetchTypeStyleOption
(
typeStyleValue
,
out
value
);
return
FetchStyleBool
(
Style_UseImplicitTypeWherePossible
,
out
value
);
}
return
base
.
TryFetch
(
optionKey
,
out
value
);
}
private
bool
FetchStyleBool
(
string
settingName
,
out
object
value
)
{
var
typeStyleValue
=
Manager
.
GetValueOrDefault
<
string
>(
settingName
);
return
FetchStyleOption
<
bool
>(
typeStyleValue
,
out
value
);
}
public
override
bool
TryPersist
(
OptionKey
optionKey
,
object
value
)
{
...
...
@@ -310,39 +337,57 @@ public override bool TryPersist(OptionKey optionKey, object value)
}
}
// code style: use this.
if
(
optionKey
.
Option
==
CodeStyleOptions
.
QualifyFieldAccess
)
{
return
PersistStyleOption
<
bool
>(
Style_QualifyFieldAccess
,
value
);
}
else
if
(
optionKey
.
Option
==
CodeStyleOptions
.
QualifyPropertyAccess
)
{
return
PersistStyleOption
<
bool
>(
Style_QualifyPropertyAccess
,
value
);
}
else
if
(
optionKey
.
Option
==
CodeStyleOptions
.
QualifyMethodAccess
)
{
return
PersistStyleOption
<
bool
>(
Style_QualifyMethodAccess
,
value
);
}
else
if
(
optionKey
.
Option
==
CodeStyleOptions
.
QualifyEventAccess
)
{
return
PersistStyleOption
<
bool
>(
Style_QualifyEventAccess
,
value
);
}
// code style: use var options.
if
(
optionKey
.
Option
==
CSharpCodeStyleOptions
.
UseImplicitTypeForIntrinsicTypes
)
{
return
Persist
TypeStyleOption
(
Style_UseImplicitTypeForIntrinsicTypes
,
value
);
return
Persist
StyleOption
<
bool
>
(
Style_UseImplicitTypeForIntrinsicTypes
,
value
);
}
else
if
(
optionKey
.
Option
==
CSharpCodeStyleOptions
.
UseImplicitTypeWhereApparent
)
{
return
Persist
TypeStyleOption
(
Style_UseImplicitTypeWhereApparent
,
value
);
return
Persist
StyleOption
<
bool
>
(
Style_UseImplicitTypeWhereApparent
,
value
);
}
else
if
(
optionKey
.
Option
==
CSharpCodeStyleOptions
.
UseImplicitTypeWherePossible
)
{
return
Persist
TypeStyleOption
(
Style_UseImplicitTypeWherePossible
,
value
);
return
Persist
StyleOption
<
bool
>
(
Style_UseImplicitTypeWherePossible
,
value
);
}
return
base
.
TryPersist
(
optionKey
,
value
);
}
private
bool
Persist
TypeStyleOption
(
string
option
,
object
value
)
private
bool
Persist
StyleOption
<
T
>
(
string
option
,
object
value
)
{
var
serializedValue
=
((
SimpleCodeStyleOption
)
value
).
ToXElement
().
ToString
();
var
serializedValue
=
((
CodeStyleOption
<
T
>
)
value
).
ToXElement
().
ToString
();
this
.
Manager
.
SetValueAsync
(
option
,
value
:
serializedValue
,
isMachineLocal
:
false
);
return
true
;
}
private
static
bool
Fetch
TypeStyleOption
(
string
typeStyleOptionValue
,
out
object
value
)
private
static
bool
Fetch
StyleOption
<
T
>
(
string
typeStyleOptionValue
,
out
object
value
)
{
if
(
string
.
IsNullOrEmpty
(
typeStyleOptionValue
))
{
value
=
SimpleCodeStyleOption
.
Default
;
value
=
CodeStyleOption
<
T
>
.
Default
;
}
else
{
value
=
SimpleCodeStyleOption
.
FromXElement
(
XElement
.
Parse
(
typeStyleOptionValue
));
value
=
CodeStyleOption
<
T
>
.
FromXElement
(
XElement
.
Parse
(
typeStyleOptionValue
));
}
return
true
;
...
...
src/VisualStudio/CSharp/Impl/Options/Formatting/StyleViewModel.cs
浏览文件 @
923fffcd
...
...
@@ -22,7 +22,9 @@ internal class StyleViewModel : AbstractOptionPreviewViewModel
{
internal
override
bool
ShouldPersistOption
(
OptionKey
key
)
{
return
key
.
Option
.
Feature
==
CSharpCodeStyleOptions
.
FeatureName
||
key
.
Option
.
Feature
==
SimplificationOptions
.
PerLanguageFeatureName
;
return
key
.
Option
.
Feature
==
CSharpCodeStyleOptions
.
FeatureName
||
key
.
Option
.
Feature
==
CodeStyleOptions
.
PerLanguageCodeStyleOption
||
key
.
Option
.
Feature
==
SimplificationOptions
.
PerLanguageFeatureName
;
}
#
region
"Preview Text"
...
...
src/VisualStudio/Core/Impl/Options/AbstractOptionPreviewViewModel.cs
浏览文件 @
923fffcd
...
...
@@ -8,6 +8,7 @@
using
System.Threading
;
using
System.Windows.Data
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.CodeAnalysis.CodeStyle
;
using
Microsoft.CodeAnalysis.Editor
;
using
Microsoft.CodeAnalysis.Editor.Shared.Extensions
;
using
Microsoft.CodeAnalysis.Editor.Shared.Preview
;
...
...
@@ -79,13 +80,29 @@ internal OptionSet ApplyChangedOptions(OptionSet optionSet)
public
void
SetOptionAndUpdatePreview
<
T
>(
T
value
,
IOption
option
,
string
preview
)
{
if
(
option
is
PerLanguageOption
<
T
>)
if
(
option
is
Option
<
CodeStyleOption
<
T
>>)
{
var
opt
=
Options
.
GetOption
((
Option
<
CodeStyleOption
<
T
>>)
option
);
opt
.
Value
=
value
;
Options
=
Options
.
WithChangedOption
((
Option
<
CodeStyleOption
<
T
>>)
option
,
opt
);
}
else
if
(
option
is
PerLanguageOption
<
CodeStyleOption
<
T
>>)
{
var
opt
=
Options
.
GetOption
((
PerLanguageOption
<
CodeStyleOption
<
T
>>)
option
,
Language
);
opt
.
Value
=
value
;
Options
=
Options
.
WithChangedOption
((
PerLanguageOption
<
CodeStyleOption
<
T
>>)
option
,
Language
,
opt
);
}
else
if
(
option
is
Option
<
T
>)
{
Options
=
Options
.
WithChangedOption
((
Option
<
T
>)
option
,
value
);
}
else
if
(
option
is
PerLanguageOption
<
T
>)
{
Options
=
Options
.
WithChangedOption
((
PerLanguageOption
<
T
>)
option
,
Language
,
value
);
}
else
{
Options
=
Options
.
WithChangedOption
((
Option
<
T
>)
option
,
value
);
throw
new
InvalidOperationException
(
"Unexpected option type"
);
}
UpdateDocument
(
preview
);
...
...
src/VisualStudio/Core/Impl/Options/BooleanCodeStyleOptionViewModel.cs
浏览文件 @
923fffcd
...
...
@@ -15,7 +15,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.Options
/// <remarks>
/// This exists to support options that are implemented as boolean
/// options in the non UI layers, <see cref="Option{Boolean}"/>.
/// In future, if such options are moved to use <see cref="
SimpleCodeStyleOption
"/>,
/// In future, if such options are moved to use <see cref="
CodeStyleOption{T}
"/>,
/// this class can be completely deleted.
/// </remarks>
internal
class
BooleanCodeStyleOptionViewModel
:
AbstractCodeStyleOptionViewModel
...
...
src/VisualStudio/Core/Impl/Options/CheckBoxWithComboViewModel.cs
浏览文件 @
923fffcd
...
...
@@ -12,7 +12,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.Options
/// has a checkbox for selection and a combobox for notification levels.
/// </summary>
/// <remarks>
/// At the features level, this maps to <see cref="
SimpleCodeStyleOption
"/>
/// At the features level, this maps to <see cref="
CodeStyleOption{T}
"/>
/// </remarks>
internal
class
CheckBoxWithComboOptionViewModel
:
AbstractCheckBoxViewModel
{
...
...
@@ -30,8 +30,8 @@ public CheckBoxWithComboOptionViewModel(IOption option, string description, stri
{
NotificationOptions
=
items
;
var
codeStyleOption
=
((
SimpleCodeStyleOption
)
options
.
GetOption
(
new
OptionKey
(
option
,
option
.
IsPerLanguage
?
info
.
Language
:
null
)));
SetProperty
(
ref
_isChecked
,
codeStyleOption
.
IsChecked
);
var
codeStyleOption
=
((
CodeStyleOption
<
bool
>
)
options
.
GetOption
(
new
OptionKey
(
option
,
option
.
IsPerLanguage
?
info
.
Language
:
null
)));
SetProperty
(
ref
_isChecked
,
codeStyleOption
.
Value
);
var
notificationViewModel
=
items
.
Where
(
i
=>
i
.
Notification
.
Value
==
codeStyleOption
.
Notification
.
Value
).
Single
();
SetProperty
(
ref
_selectedNotificationOption
,
notificationViewModel
);
...
...
@@ -47,7 +47,7 @@ public override bool IsChecked
set
{
SetProperty
(
ref
_isChecked
,
value
);
Info
.
SetOptionAndUpdatePreview
(
new
SimpleCodeStyleOption
(
_isChecked
,
_selectedNotificationOption
.
Notification
),
Option
,
GetPreview
());
Info
.
SetOptionAndUpdatePreview
(
new
CodeStyleOption
<
bool
>
(
_isChecked
,
_selectedNotificationOption
.
Notification
),
Option
,
GetPreview
());
}
}
...
...
@@ -60,7 +60,7 @@ public NotificationOptionViewModel SelectedNotificationOption
set
{
SetProperty
(
ref
_selectedNotificationOption
,
value
);
Info
.
SetOptionAndUpdatePreview
(
new
SimpleCodeStyleOption
(
_isChecked
,
_selectedNotificationOption
.
Notification
),
Option
,
GetPreview
());
Info
.
SetOptionAndUpdatePreview
(
new
CodeStyleOption
<
bool
>
(
_isChecked
,
_selectedNotificationOption
.
Notification
),
Option
,
GetPreview
());
}
}
}
...
...
src/VisualStudio/Core/Impl/Options/SimpleCodeStyleOptionViewModel.cs
浏览文件 @
923fffcd
...
...
@@ -8,7 +8,7 @@
namespace
Microsoft.VisualStudio.LanguageServices.Implementation.Options
{
/// <summary>
/// This class represents the view model for a <see cref="
SimpleCodeStyleOption
"/>
/// This class represents the view model for a <see cref="
CodeStyleOption{T}
"/>
/// that binds to the codestyle options UI.
/// </summary>
internal
class
SimpleCodeStyleOptionViewModel
:
AbstractCodeStyleOptionViewModel
...
...
@@ -24,7 +24,7 @@ public override CodeStylePreference SelectedPreference
{
if
(
SetProperty
(
ref
_selectedPreference
,
value
))
{
Info
.
SetOptionAndUpdatePreview
(
new
SimpleCodeStyleOption
(
_selectedPreference
.
IsChecked
,
_selectedNotificationPreference
.
Notification
),
Option
,
GetPreview
());
Info
.
SetOptionAndUpdatePreview
(
new
CodeStyleOption
<
bool
>
(
_selectedPreference
.
IsChecked
,
_selectedNotificationPreference
.
Notification
),
Option
,
GetPreview
());
}
}
}
...
...
@@ -41,7 +41,7 @@ public override NotificationOptionViewModel SelectedNotificationPreference
{
if
(
SetProperty
(
ref
_selectedNotificationPreference
,
value
))
{
Info
.
SetOptionAndUpdatePreview
(
new
SimpleCodeStyleOption
(
_selectedPreference
.
IsChecked
,
_selectedNotificationPreference
.
Notification
),
Option
,
GetPreview
());
Info
.
SetOptionAndUpdatePreview
(
new
CodeStyleOption
<
bool
>
(
_selectedPreference
.
IsChecked
,
_selectedNotificationPreference
.
Notification
),
Option
,
GetPreview
());
}
}
}
...
...
@@ -60,8 +60,8 @@ public override NotificationOptionViewModel SelectedNotificationPreference
List
<
NotificationOptionViewModel
>
notificationPreferences
=
null
)
:
base
(
option
,
description
,
truePreview
,
falsePreview
,
info
,
options
,
groupName
,
preferences
,
notificationPreferences
)
{
var
codeStyleOption
=
((
SimpleCodeStyleOption
)
options
.
GetOption
(
new
OptionKey
(
option
,
option
.
IsPerLanguage
?
info
.
Language
:
null
)));
_selectedPreference
=
Preferences
.
Single
(
c
=>
c
.
IsChecked
==
codeStyleOption
.
IsChecked
);
var
codeStyleOption
=
((
CodeStyleOption
<
bool
>
)
options
.
GetOption
(
new
OptionKey
(
option
,
option
.
IsPerLanguage
?
info
.
Language
:
null
)));
_selectedPreference
=
Preferences
.
Single
(
c
=>
c
.
IsChecked
==
codeStyleOption
.
Value
);
var
notificationViewModel
=
NotificationPreferences
.
Single
(
i
=>
i
.
Notification
.
Value
==
codeStyleOption
.
Notification
.
Value
);
_selectedNotificationPreference
=
NotificationPreferences
.
Single
(
p
=>
p
.
Notification
.
Value
==
notificationViewModel
.
Notification
.
Value
);
...
...
src/VisualStudio/VisualBasic/Impl/Options/AutomationObject.vb
浏览文件 @
923fffcd
...
...
@@ -243,13 +243,13 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options
_workspace
.
Options
=
_workspace
.
Options
.
WithChangedOption
(
key
,
LanguageNames
.
VisualBasic
,
boolValue
)
End
Sub
Private
Function
GetBooleanOption
(
key
As
[
PerLanguageOption
]
(
Of
SimpleCodeStyleOption
))
As
Boolean
Return
_workspace
.
Options
.
GetOption
(
key
,
LanguageNames
.
VisualBasic
).
IsChecked
Private
Function
GetBooleanOption
(
key
As
[
PerLanguageOption
]
(
Of
CodeStyleOption
(
Of
Boolean
)
))
As
Boolean
Return
_workspace
.
Options
.
GetOption
(
key
,
LanguageNames
.
VisualBasic
).
Value
End
Function
Private
Sub
SetBooleanOption
(
key
As
[
PerLanguageOption
]
(
Of
SimpleCodeStyleOption
),
value
As
Boolean
)
Private
Sub
SetBooleanOption
(
key
As
[
PerLanguageOption
]
(
Of
CodeStyleOption
(
Of
Boolean
)
),
value
As
Boolean
)
Dim
opt
=
_workspace
.
Options
.
GetOption
(
key
,
LanguageNames
.
VisualBasic
)
opt
.
IsChecked
=
value
opt
.
Value
=
value
_workspace
.
Options
=
_workspace
.
Options
.
WithChangedOption
(
key
,
LanguageNames
.
VisualBasic
,
opt
)
End
Sub
End
Class
...
...
src/Workspaces/CSharp/Portable/CodeStyle/CSharpCodeStyleOptions.cs
浏览文件 @
923fffcd
...
...
@@ -12,8 +12,8 @@ internal static class CSharpCodeStyleOptions
// TODO: get sign off on public api changes.
public
static
readonly
Option
<
bool
>
UseVarWhenDeclaringLocals
=
new
Option
<
bool
>(
FeatureName
,
"UseVarWhenDeclaringLocals"
,
defaultValue
:
true
);
public
static
readonly
Option
<
SimpleCodeStyleOption
>
UseImplicitTypeForIntrinsicTypes
=
new
Option
<
SimpleCodeStyleOption
>(
FeatureName
,
nameof
(
UseImplicitTypeForIntrinsicTypes
),
defaultValue
:
SimpleCodeStyleOption
.
Default
);
public
static
readonly
Option
<
SimpleCodeStyleOption
>
UseImplicitTypeWhereApparent
=
new
Option
<
SimpleCodeStyleOption
>(
FeatureName
,
nameof
(
UseImplicitTypeWhereApparent
),
defaultValue
:
SimpleCodeStyleOption
.
Default
);
public
static
readonly
Option
<
SimpleCodeStyleOption
>
UseImplicitTypeWherePossible
=
new
Option
<
SimpleCodeStyleOption
>(
FeatureName
,
nameof
(
UseImplicitTypeWherePossible
),
defaultValue
:
SimpleCodeStyleOption
.
Default
);
public
static
readonly
Option
<
CodeStyleOption
<
bool
>>
UseImplicitTypeForIntrinsicTypes
=
new
Option
<
CodeStyleOption
<
bool
>>(
FeatureName
,
nameof
(
UseImplicitTypeForIntrinsicTypes
),
defaultValue
:
CodeStyleOption
<
bool
>
.
Default
);
public
static
readonly
Option
<
CodeStyleOption
<
bool
>>
UseImplicitTypeWhereApparent
=
new
Option
<
CodeStyleOption
<
bool
>>(
FeatureName
,
nameof
(
UseImplicitTypeWhereApparent
),
defaultValue
:
CodeStyleOption
<
bool
>
.
Default
);
public
static
readonly
Option
<
CodeStyleOption
<
bool
>>
UseImplicitTypeWherePossible
=
new
Option
<
CodeStyleOption
<
bool
>>(
FeatureName
,
nameof
(
UseImplicitTypeWherePossible
),
defaultValue
:
CodeStyleOption
<
bool
>
.
Default
);
}
}
src/Workspaces/CSharp/Portable/CodeStyle/CSharpCodeStyleOptionsProvider.cs
浏览文件 @
923fffcd
...
...
@@ -3,6 +3,7 @@
using
System.Collections.Generic
;
using
System.Collections.Immutable
;
using
System.Composition
;
using
Microsoft.CodeAnalysis.CodeStyle
;
using
Microsoft.CodeAnalysis.Options
;
using
Microsoft.CodeAnalysis.Options.Providers
;
...
...
@@ -13,6 +14,10 @@ internal class CSharpCodeStyleOptionsProvider : IOptionProvider
{
private
readonly
IEnumerable
<
IOption
>
_options
=
new
List
<
IOption
>
{
CodeStyleOptions
.
QualifyFieldAccess
,
CodeStyleOptions
.
QualifyPropertyAccess
,
CodeStyleOptions
.
QualifyMethodAccess
,
CodeStyleOptions
.
QualifyEventAccess
,
CSharpCodeStyleOptions
.
UseVarWhenDeclaringLocals
,
CSharpCodeStyleOptions
.
UseImplicitTypeWherePossible
,
CSharpCodeStyleOptions
.
UseImplicitTypeWhereApparent
,
...
...
src/Workspaces/CSharp/Portable/CodeStyle/TypeStyle/TypeStyleHelper.cs
浏览文件 @
923fffcd
...
...
@@ -234,17 +234,17 @@ private static TypeStylePreference GetCurrentTypeStylePreferences(OptionSet opti
var
styleForApparent
=
optionSet
.
GetOption
(
CSharpCodeStyleOptions
.
UseImplicitTypeWhereApparent
);
var
styleForElsewhere
=
optionSet
.
GetOption
(
CSharpCodeStyleOptions
.
UseImplicitTypeWherePossible
);
if
(
styleForIntrinsicTypes
.
IsChecked
)
if
(
styleForIntrinsicTypes
.
Value
)
{
stylePreferences
|=
TypeStylePreference
.
ImplicitTypeForIntrinsicTypes
;
}
if
(
styleForApparent
.
IsChecked
)
if
(
styleForApparent
.
Value
)
{
stylePreferences
|=
TypeStylePreference
.
ImplicitTypeWhereApparent
;
}
if
(
styleForElsewhere
.
IsChecked
)
if
(
styleForElsewhere
.
Value
)
{
stylePreferences
|=
TypeStylePreference
.
ImplicitTypeWherePossible
;
}
...
...
src/Workspaces/Core/Portable/CodeStyle/
Simple
CodeStyleOption.cs
→
src/Workspaces/Core/Portable/CodeStyle/CodeStyleOption.cs
浏览文件 @
923fffcd
...
...
@@ -6,44 +6,45 @@
namespace
Microsoft.CodeAnalysis.CodeStyle
{
/// <summary>
/// Represents a code style option that typically
/// offers two choices as preferences and a set of
/// notification styles. the preference is then
/// simply recorded as a boolean.
/// Represents a code style option and an associated notification option.
/// </summary>
public
class
SimpleCodeStyleOption
public
class
CodeStyleOption
<
T
>
{
public
static
CodeStyleOption
<
T
>
Default
=>
new
CodeStyleOption
<
T
>(
default
(
T
),
NotificationOption
.
None
);
private
const
int
SerializationVersion
=
1
;
public
static
readonly
SimpleCodeStyleOption
Default
=
new
SimpleCodeStyleOption
(
false
,
NotificationOption
.
None
);
public
SimpleCodeStyleOption
(
bool
isChecked
,
NotificationOption
notification
)
public
CodeStyleOption
(
T
value
,
NotificationOption
notification
)
{
IsChecked
=
isChecked
;
Value
=
value
;
Notification
=
notification
;
}
public
bool
IsChecked
{
get
;
set
;
}
public
T
Value
{
get
;
set
;
}
public
NotificationOption
Notification
{
get
;
set
;
}
public
XElement
ToXElement
()
=>
new
XElement
(
nameof
(
SimpleCodeStyleOption
),
new
XElement
(
nameof
(
CodeStyleOption
<
T
>),
// `nameof()` returns just "CodeStyleOption"
new
XAttribute
(
nameof
(
SerializationVersion
),
SerializationVersion
),
new
XAttribute
(
nameof
(
IsChecked
),
IsChecked
),
new
XAttribute
(
"Type"
,
typeof
(
T
).
Name
),
new
XAttribute
(
nameof
(
Value
),
Value
),
new
XAttribute
(
nameof
(
DiagnosticSeverity
),
Notification
.
Value
));
public
static
SimpleCodeStyleOption
FromXElement
(
XElement
element
)
public
static
CodeStyleOption
<
T
>
FromXElement
(
XElement
element
)
{
var
isCheckedAttribute
=
element
.
Attribute
(
nameof
(
IsChecked
));
var
typeAttribute
=
element
.
Attribute
(
"Type"
);
var
valueAttribute
=
element
.
Attribute
(
nameof
(
Value
));
var
severityAttribute
=
element
.
Attribute
(
nameof
(
DiagnosticSeverity
));
if
(
isChecked
Attribute
==
null
||
severityAttribute
==
null
)
if
(
typeAttribute
==
null
||
value
Attribute
==
null
||
severityAttribute
==
null
)
{
// data from storage is corrupt, or nothing has been stored yet.
return
Default
;
}
var
isChecked
=
bool
.
Parse
(
isCheckedAttribute
.
Value
);
var
parser
=
GetParser
(
typeAttribute
.
Value
);
var
value
=
(
T
)
parser
(
valueAttribute
.
Value
);
var
severity
=
(
DiagnosticSeverity
)
Enum
.
Parse
(
typeof
(
DiagnosticSeverity
),
severityAttribute
.
Value
);
NotificationOption
notificationOption
;
...
...
@@ -65,7 +66,18 @@ public static SimpleCodeStyleOption FromXElement(XElement element)
throw
new
ArgumentException
(
nameof
(
element
));
}
return
new
SimpleCodeStyleOption
(
isChecked
,
notificationOption
);
return
new
CodeStyleOption
<
T
>(
value
,
notificationOption
);
}
private
static
Func
<
string
,
object
>
GetParser
(
string
type
)
{
switch
(
type
)
{
case
nameof
(
Boolean
):
return
v
=>
bool
.
Parse
(
v
);
default
:
throw
new
ArgumentException
(
nameof
(
type
));
}
}
}
}
src/Workspaces/Core/Portable/CodeStyle/CodeStyleOptions.cs
浏览文件 @
923fffcd
...
...
@@ -11,21 +11,21 @@ public class CodeStyleOptions
/// <summary>
/// This option says if we should simplify away the <see langword="this"/>. or <see langword="Me"/>. in field access expressions.
/// </summary>
public
static
readonly
PerLanguageOption
<
SimpleCodeStyleOption
>
QualifyFieldAccess
=
new
PerLanguageOption
<
SimpleCodeStyleOption
>(
PerLanguageCodeStyleOption
,
nameof
(
QualifyFieldAccess
),
defaultValue
:
SimpleCodeStyleOption
.
Default
);
public
static
readonly
PerLanguageOption
<
CodeStyleOption
<
bool
>>
QualifyFieldAccess
=
new
PerLanguageOption
<
CodeStyleOption
<
bool
>>(
PerLanguageCodeStyleOption
,
nameof
(
QualifyFieldAccess
),
defaultValue
:
CodeStyleOption
<
bool
>
.
Default
);
/// <summary>
/// This option says if we should simplify away the <see langword="this"/>. or <see langword="Me"/>. in property access expressions.
/// </summary>
public
static
readonly
PerLanguageOption
<
SimpleCodeStyleOption
>
QualifyPropertyAccess
=
new
PerLanguageOption
<
SimpleCodeStyleOption
>(
PerLanguageCodeStyleOption
,
nameof
(
QualifyPropertyAccess
),
defaultValue
:
SimpleCodeStyleOption
.
Default
);
public
static
readonly
PerLanguageOption
<
CodeStyleOption
<
bool
>>
QualifyPropertyAccess
=
new
PerLanguageOption
<
CodeStyleOption
<
bool
>>(
PerLanguageCodeStyleOption
,
nameof
(
QualifyPropertyAccess
),
defaultValue
:
CodeStyleOption
<
bool
>
.
Default
);
/// <summary>
/// This option says if we should simplify away the <see langword="this"/>. or <see langword="Me"/>. in method access expressions.
/// </summary>
public
static
readonly
PerLanguageOption
<
SimpleCodeStyleOption
>
QualifyMethodAccess
=
new
PerLanguageOption
<
SimpleCodeStyleOption
>(
PerLanguageCodeStyleOption
,
nameof
(
QualifyMethodAccess
),
defaultValue
:
SimpleCodeStyleOption
.
Default
);
public
static
readonly
PerLanguageOption
<
CodeStyleOption
<
bool
>>
QualifyMethodAccess
=
new
PerLanguageOption
<
CodeStyleOption
<
bool
>>(
PerLanguageCodeStyleOption
,
nameof
(
QualifyMethodAccess
),
defaultValue
:
CodeStyleOption
<
bool
>
.
Default
);
/// <summary>
/// This option says if we should simplify away the <see langword="this"/>. or <see langword="Me"/>. in event access expressions.
/// </summary>
public
static
readonly
PerLanguageOption
<
SimpleCodeStyleOption
>
QualifyEventAccess
=
new
PerLanguageOption
<
SimpleCodeStyleOption
>(
PerLanguageCodeStyleOption
,
nameof
(
QualifyEventAccess
),
defaultValue
:
SimpleCodeStyleOption
.
Default
);
public
static
readonly
PerLanguageOption
<
CodeStyleOption
<
bool
>>
QualifyEventAccess
=
new
PerLanguageOption
<
CodeStyleOption
<
bool
>>(
PerLanguageCodeStyleOption
,
nameof
(
QualifyEventAccess
),
defaultValue
:
CodeStyleOption
<
bool
>
.
Default
);
}
}
src/Workspaces/Core/Portable/PublicAPI.Unshipped.txt
浏览文件 @
923fffcd
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.CodeStyleOption(T value, Microsoft.CodeAnalysis.CodeStyle.NotificationOption notification) -> void
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Notification.get -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Notification.set -> void
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.ToXElement() -> System.Xml.Linq.XElement
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Value.get -> T
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Value.set -> void
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions
Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.CodeStyleOptions() -> void
Microsoft.CodeAnalysis.CodeStyle.NotificationOption
...
...
@@ -5,13 +12,6 @@ Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Name.get -> string
Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Name.set -> void
Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Value.get -> Microsoft.CodeAnalysis.DiagnosticSeverity
Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Value.set -> void
Microsoft.CodeAnalysis.CodeStyle.SimpleCodeStyleOption
Microsoft.CodeAnalysis.CodeStyle.SimpleCodeStyleOption.IsChecked.get -> bool
Microsoft.CodeAnalysis.CodeStyle.SimpleCodeStyleOption.IsChecked.set -> void
Microsoft.CodeAnalysis.CodeStyle.SimpleCodeStyleOption.Notification.get -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
Microsoft.CodeAnalysis.CodeStyle.SimpleCodeStyleOption.Notification.set -> void
Microsoft.CodeAnalysis.CodeStyle.SimpleCodeStyleOption.SimpleCodeStyleOption(bool isChecked, Microsoft.CodeAnalysis.CodeStyle.NotificationOption notification) -> void
Microsoft.CodeAnalysis.CodeStyle.SimpleCodeStyleOption.ToXElement() -> System.Xml.Linq.XElement
Microsoft.CodeAnalysis.Document.Options.get -> Microsoft.CodeAnalysis.Options.DocumentOptionSet
Microsoft.CodeAnalysis.Editing.SyntaxGenerator.AddSwitchSections(Microsoft.CodeAnalysis.SyntaxNode switchStatement, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxNode> switchSections) -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.Options.DocumentOptionSet
...
...
@@ -29,20 +29,20 @@ override Microsoft.CodeAnalysis.Options.DocumentOptionSet.GetOption<T>(Microsoft
override Microsoft.CodeAnalysis.Options.DocumentOptionSet.WithChangedOption(Microsoft.CodeAnalysis.Options.OptionKey optionAndLanguage, object value) -> Microsoft.CodeAnalysis.Options.OptionSet
override Microsoft.CodeAnalysis.Options.DocumentOptionSet.WithChangedOption<T>(Microsoft.CodeAnalysis.Options.Option<T> option, T value) -> Microsoft.CodeAnalysis.Options.OptionSet
override Microsoft.CodeAnalysis.Options.DocumentOptionSet.WithChangedOption<T>(Microsoft.CodeAnalysis.Options.PerLanguageOption<T> option, string language, T value) -> Microsoft.CodeAnalysis.Options.OptionSet
static Microsoft.CodeAnalysis.CodeStyle.SimpleCodeStyleOption.FromXElement(System.Xml.Linq.XElement element) -> Microsoft.CodeAnalysis.CodeStyle.SimpleCodeStyleOption
static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.TryParse(string value, out Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers) -> bool
static Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.Default.get -> Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>
static Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>.FromXElement(System.Xml.Linq.XElement element) -> Microsoft.CodeAnalysis.CodeStyle.CodeStyleOption<T>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.NamingPreferences.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<string>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.QualifyEventAccess.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.QualifyFieldAccess.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.QualifyMethodAccess.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.QualifyPropertyAccess.get -> Microsoft.CodeAnalysis.Options.PerLanguageOption<bool>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.QualifyEventAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.
SimpleCodeStyleOption
>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.QualifyFieldAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.
SimpleCodeStyleOption
>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.QualifyMethodAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.
SimpleCodeStyleOption
>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.QualifyPropertyAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.
SimpleCodeStyleOption
>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.QualifyEventAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.
CodeStyleOption<bool>
>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.QualifyFieldAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.
CodeStyleOption<bool>
>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.QualifyMethodAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.
CodeStyleOption<bool>
>
static readonly Microsoft.CodeAnalysis.CodeStyle.CodeStyleOptions.QualifyPropertyAccess -> Microsoft.CodeAnalysis.Options.PerLanguageOption<Microsoft.CodeAnalysis.CodeStyle.
CodeStyleOption<bool>
>
static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Error -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Info -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.None -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Warning -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption
static readonly Microsoft.CodeAnalysis.CodeStyle.SimpleCodeStyleOption.Default -> Microsoft.CodeAnalysis.CodeStyle.SimpleCodeStyleOption
virtual Microsoft.CodeAnalysis.Workspace.UpdateGeneratedDocuments(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentInfo> documentsRemoved, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentInfo> documentsAdded) -> void
\ No newline at end of file
virtual Microsoft.CodeAnalysis.Workspace.UpdateGeneratedDocuments(Microsoft.CodeAnalysis.ProjectId projectId, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentInfo> documentsRemoved, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DocumentInfo> documentsAdded) -> void
src/Workspaces/Core/Portable/Simplification/SimplificationHelpers.cs
浏览文件 @
923fffcd
...
...
@@ -110,10 +110,10 @@ internal static bool ShouldSimplifyMemberAccessExpression(SemanticModel semantic
internal
static
bool
ShouldSimplifyMemberAccessExpression
(
ISymbol
symbol
,
string
languageName
,
OptionSet
optionSet
)
{
if
(!
symbol
.
IsStatic
&&
(
symbol
.
IsKind
(
SymbolKind
.
Field
)
&&
optionSet
.
GetOption
(
CodeStyleOptions
.
QualifyFieldAccess
,
languageName
).
IsChecked
||
(
symbol
.
IsKind
(
SymbolKind
.
Property
)
&&
optionSet
.
GetOption
(
CodeStyleOptions
.
QualifyPropertyAccess
,
languageName
).
IsChecked
)
||
(
symbol
.
IsKind
(
SymbolKind
.
Method
)
&&
optionSet
.
GetOption
(
CodeStyleOptions
.
QualifyMethodAccess
,
languageName
).
IsChecked
)
||
(
symbol
.
IsKind
(
SymbolKind
.
Event
)
&&
optionSet
.
GetOption
(
CodeStyleOptions
.
QualifyEventAccess
,
languageName
).
IsChecked
)))
(
symbol
.
IsKind
(
SymbolKind
.
Field
)
&&
optionSet
.
GetOption
(
CodeStyleOptions
.
QualifyFieldAccess
,
languageName
).
Value
||
(
symbol
.
IsKind
(
SymbolKind
.
Property
)
&&
optionSet
.
GetOption
(
CodeStyleOptions
.
QualifyPropertyAccess
,
languageName
).
Value
)
||
(
symbol
.
IsKind
(
SymbolKind
.
Method
)
&&
optionSet
.
GetOption
(
CodeStyleOptions
.
QualifyMethodAccess
,
languageName
).
Value
)
||
(
symbol
.
IsKind
(
SymbolKind
.
Event
)
&&
optionSet
.
GetOption
(
CodeStyleOptions
.
QualifyEventAccess
,
languageName
).
Value
)))
{
return
false
;
}
...
...
src/Workspaces/Core/Portable/Workspaces.csproj
浏览文件 @
923fffcd
...
...
@@ -346,7 +346,7 @@
<Compile
Include=
"CodeGeneration\CodeGenerator.cs"
/>
<Compile
Include=
"CodeStyle\CodeStyleOptions.cs"
/>
<Compile
Include=
"CodeStyle\NotificationOption.cs"
/>
<Compile
Include=
"CodeStyle\
Simple
CodeStyleOption.cs"
/>
<Compile
Include=
"CodeStyle\CodeStyleOption.cs"
/>
<Compile
Include=
"Diagnostics\DiagnosticData.cs"
/>
<Compile
Include=
"Diagnostics\DiagnosticProvider.cs"
/>
<Compile
Include=
"Diagnostics\Extensions.cs"
/>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录