Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
e06510e9
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,发现更多精彩内容 >>
提交
e06510e9
编写于
1月 13, 2020
作者:
M
Manish Vasani
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix setting options from CodeAction (background thread).
上级
6052cf9d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
46 addition
and
13 deletion
+46
-13
src/Features/Core/Portable/GenerateConstructorFromMembers/AbstractGenerateConstructorFromMembersCodeRefactoringProvider.GenerateConstructorWithDialogCodeAction.cs
...toringProvider.GenerateConstructorWithDialogCodeAction.cs
+18
-5
src/Features/Core/Portable/GenerateEqualsAndGetHashCodeFromMembers/GenerateEqualsAndHashWithDialogCodeAction.cs
...eFromMembers/GenerateEqualsAndHashWithDialogCodeAction.cs
+28
-8
未找到文件。
src/Features/Core/Portable/GenerateConstructorFromMembers/AbstractGenerateConstructorFromMembersCodeRefactoringProvider.GenerateConstructorWithDialogCodeAction.cs
浏览文件 @
e06510e9
...
@@ -23,6 +23,8 @@ private class GenerateConstructorWithDialogCodeAction : CodeActionWithOptions
...
@@ -23,6 +23,8 @@ private class GenerateConstructorWithDialogCodeAction : CodeActionWithOptions
private
readonly
ImmutableArray
<
ISymbol
>
_viableMembers
;
private
readonly
ImmutableArray
<
ISymbol
>
_viableMembers
;
private
readonly
ImmutableArray
<
PickMembersOption
>
_pickMembersOptions
;
private
readonly
ImmutableArray
<
PickMembersOption
>
_pickMembersOptions
;
private
bool
?
_addNullCheckOptionValue
;
public
override
string
Title
=>
FeaturesResources
.
Generate_constructor
;
public
override
string
Title
=>
FeaturesResources
.
Generate_constructor
;
public
GenerateConstructorWithDialogCodeAction
(
public
GenerateConstructorWithDialogCodeAction
(
...
@@ -65,11 +67,7 @@ public override object GetOptions(CancellationToken cancellationToken)
...
@@ -65,11 +67,7 @@ public override object GetOptions(CancellationToken cancellationToken)
// If we presented the 'Add null check' option, then persist whatever value
// If we presented the 'Add null check' option, then persist whatever value
// the user chose. That way we'll keep that as the default for the next time
// the user chose. That way we'll keep that as the default for the next time
// the user opens the dialog.
// the user opens the dialog.
var
workspace
=
_document
.
Project
.
Solution
.
Workspace
;
_addNullCheckOptionValue
=
addNullChecksOption
.
Value
;
workspace
.
TryApplyChanges
(
workspace
.
CurrentSolution
.
WithOptions
(
workspace
.
Options
.
WithChangedOption
(
GenerateConstructorFromMembersOptions
.
AddNullChecks
,
_document
.
Project
.
Language
,
addNullChecksOption
.
Value
)));
}
}
var
addNullChecks
=
(
addNullChecksOption
?.
Value
).
GetValueOrDefault
();
var
addNullChecks
=
(
addNullChecksOption
?.
Value
).
GetValueOrDefault
();
...
@@ -109,6 +107,21 @@ public override object GetOptions(CancellationToken cancellationToken)
...
@@ -109,6 +107,21 @@ public override object GetOptions(CancellationToken cancellationToken)
return
await
codeAction
.
GetOperationsAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
return
await
codeAction
.
GetOperationsAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
}
}
}
}
protected
override
async
Task
<
Solution
>
GetChangedSolutionAsync
(
CancellationToken
cancellationToken
)
{
var
solution
=
await
base
.
GetChangedSolutionAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
if
(
_addNullCheckOptionValue
.
HasValue
)
{
solution
=
solution
.
WithOptions
(
solution
.
Options
.
WithChangedOption
(
GenerateConstructorFromMembersOptions
.
AddNullChecks
,
_document
.
Project
.
Language
,
_addNullCheckOptionValue
.
Value
));
}
return
solution
;
}
}
}
}
}
}
}
src/Features/Core/Portable/GenerateEqualsAndGetHashCodeFromMembers/GenerateEqualsAndHashWithDialogCodeAction.cs
浏览文件 @
e06510e9
...
@@ -25,6 +25,9 @@ private class GenerateEqualsAndGetHashCodeWithDialogCodeAction : CodeActionWithO
...
@@ -25,6 +25,9 @@ private class GenerateEqualsAndGetHashCodeWithDialogCodeAction : CodeActionWithO
private
readonly
ImmutableArray
<
PickMembersOption
>
_pickMembersOptions
;
private
readonly
ImmutableArray
<
PickMembersOption
>
_pickMembersOptions
;
private
readonly
TextSpan
_textSpan
;
private
readonly
TextSpan
_textSpan
;
private
bool
?
_implementIEqutableOptionValue
;
private
bool
?
_generateOperatorsOptionValue
;
public
GenerateEqualsAndGetHashCodeWithDialogCodeAction
(
public
GenerateEqualsAndGetHashCodeWithDialogCodeAction
(
GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider
service
,
GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider
service
,
Document
document
,
Document
document
,
...
@@ -69,19 +72,13 @@ protected override async Task<IEnumerable<CodeActionOperation>> ComputeOperation
...
@@ -69,19 +72,13 @@ protected override async Task<IEnumerable<CodeActionOperation>> ComputeOperation
var
implementIEqutableOption
=
result
.
Options
.
FirstOrDefault
(
o
=>
o
.
Id
==
ImplementIEquatableId
);
var
implementIEqutableOption
=
result
.
Options
.
FirstOrDefault
(
o
=>
o
.
Id
==
ImplementIEquatableId
);
if
(
implementIEqutableOption
!=
null
)
if
(
implementIEqutableOption
!=
null
)
{
{
workspace
.
TryApplyChanges
(
workspace
.
CurrentSolution
.
WithOptions
(
workspace
.
Options
.
WithChangedOption
(
_implementIEqutableOptionValue
=
implementIEqutableOption
.
Value
;
GenerateEqualsAndGetHashCodeFromMembersOptions
.
ImplementIEquatable
,
_document
.
Project
.
Language
,
implementIEqutableOption
.
Value
)));
}
}
var
generateOperatorsOption
=
result
.
Options
.
FirstOrDefault
(
o
=>
o
.
Id
==
GenerateOperatorsId
);
var
generateOperatorsOption
=
result
.
Options
.
FirstOrDefault
(
o
=>
o
.
Id
==
GenerateOperatorsId
);
if
(
generateOperatorsOption
!=
null
)
if
(
generateOperatorsOption
!=
null
)
{
{
workspace
.
TryApplyChanges
(
workspace
.
CurrentSolution
.
WithOptions
(
workspace
.
Options
.
WithChangedOption
(
_generateOperatorsOptionValue
=
generateOperatorsOption
.
Value
;
GenerateEqualsAndGetHashCodeFromMembersOptions
.
GenerateOperators
,
_document
.
Project
.
Language
,
generateOperatorsOption
.
Value
)));
}
}
var
implementIEquatable
=
(
implementIEqutableOption
?.
Value
).
GetValueOrDefault
();
var
implementIEquatable
=
(
implementIEqutableOption
?.
Value
).
GetValueOrDefault
();
...
@@ -95,6 +92,29 @@ protected override async Task<IEnumerable<CodeActionOperation>> ComputeOperation
...
@@ -95,6 +92,29 @@ protected override async Task<IEnumerable<CodeActionOperation>> ComputeOperation
public
override
string
Title
public
override
string
Title
=>
GenerateEqualsAndGetHashCodeAction
.
GetTitle
(
_generateEquals
,
_generateGetHashCode
)
+
"..."
;
=>
GenerateEqualsAndGetHashCodeAction
.
GetTitle
(
_generateEquals
,
_generateGetHashCode
)
+
"..."
;
protected
override
async
Task
<
Solution
>
GetChangedSolutionAsync
(
CancellationToken
cancellationToken
)
{
var
solution
=
await
base
.
GetChangedSolutionAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
if
(
_implementIEqutableOptionValue
.
HasValue
)
{
solution
=
solution
.
WithOptions
(
solution
.
Options
.
WithChangedOption
(
GenerateEqualsAndGetHashCodeFromMembersOptions
.
ImplementIEquatable
,
_document
.
Project
.
Language
,
_implementIEqutableOptionValue
.
Value
));
}
if
(
_generateOperatorsOptionValue
.
HasValue
)
{
solution
=
solution
.
WithOptions
(
solution
.
Options
.
WithChangedOption
(
GenerateEqualsAndGetHashCodeFromMembersOptions
.
GenerateOperators
,
_document
.
Project
.
Language
,
_generateOperatorsOptionValue
.
Value
));
}
return
solution
;
}
}
}
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录