Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
40c096b3
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,发现更多精彩内容 >>
提交
40c096b3
编写于
10月 17, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'removeUnnecessarySuggestedAction' into suggestedActionCleanup
上级
1ffe63ff
16180119
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
27 addition
and
117 deletion
+27
-117
src/EditorFeatures/Core/EditorFeatures.csproj
src/EditorFeatures/Core/EditorFeatures.csproj
+0
-1
src/EditorFeatures/Core/Implementation/Suggestions/FixMultipleOccurrencesService.cs
...plementation/Suggestions/FixMultipleOccurrencesService.cs
+25
-10
src/EditorFeatures/Core/Implementation/Suggestions/FixMultipleSuggestedAction.cs
.../Implementation/Suggestions/FixMultipleSuggestedAction.cs
+0
-103
src/Features/Core/Portable/CodeFixes/FixAllOccurrences/FixMultipleCodeAction.cs
...able/CodeFixes/FixAllOccurrences/FixMultipleCodeAction.cs
+2
-3
未找到文件。
src/EditorFeatures/Core/EditorFeatures.csproj
浏览文件 @
40c096b3
...
...
@@ -279,7 +279,6 @@
<Compile
Include=
"Implementation\Preview\DifferenceViewerPreview.cs"
/>
<Compile
Include=
"Implementation\Preview\PreviewReferenceHighlightingTaggerProvider.cs"
/>
<Compile
Include=
"Implementation\Suggestions\FixMultipleOccurrencesService.cs"
/>
<Compile
Include=
"Implementation\Suggestions\FixMultipleSuggestedAction.cs"
/>
<Compile
Include=
"Implementation\GoToImplementation\GoToImplementationCommandHandler.cs"
/>
<Compile
Include=
"Implementation\TodoComment\ITodoListProvider.cs"
/>
<Compile
Include=
"Implementation\TodoComment\TodoItem.cs"
/>
...
...
src/EditorFeatures/Core/Implementation/Suggestions/FixMultipleOccurrencesService.cs
浏览文件 @
40c096b3
...
...
@@ -8,9 +8,11 @@
using
System.Threading
;
using
Microsoft.CodeAnalysis.CodeFixes
;
using
Microsoft.CodeAnalysis.Editor.Host
;
using
Microsoft.CodeAnalysis.Extensions
;
using
Microsoft.CodeAnalysis.Host
;
using
Microsoft.CodeAnalysis.Host.Mef
;
using
Microsoft.CodeAnalysis.Shared.TestHooks
;
using
Roslyn.Utilities
;
namespace
Microsoft.CodeAnalysis.Editor.Implementation.Suggestions
{
...
...
@@ -53,8 +55,10 @@ public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
var
fixMultipleState
=
FixAllState
.
Create
(
fixAllProvider
,
diagnosticsToFix
,
fixProvider
,
equivalenceKey
);
var
triggerDiagnostic
=
diagnosticsToFix
.
First
().
Value
.
First
();
var
suggestedAction
=
GetSuggestedAction
(
fixMultipleState
,
triggerDiagnostic
,
workspace
,
waitDialogTitle
,
waitDialogMessage
,
showPreviewChangesDialog
:
false
,
cancellationToken
:
cancellationToken
);
return
suggestedAction
.
GetChangedSolution
(
cancellationToken
);
var
result
=
GetFixedSolution
(
fixMultipleState
,
triggerDiagnostic
,
workspace
,
waitDialogTitle
,
waitDialogMessage
,
cancellationToken
);
return
result
;
}
public
Solution
GetFix
(
...
...
@@ -70,23 +74,34 @@ public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
var
fixMultipleState
=
FixAllState
.
Create
(
fixAllProvider
,
diagnosticsToFix
,
fixProvider
,
equivalenceKey
);
var
triggerDiagnostic
=
diagnosticsToFix
.
First
().
Value
.
First
();
var
suggestedAction
=
GetSuggestedAction
(
fixMultipleState
,
triggerDiagnostic
,
workspace
,
waitDialogTitle
,
waitDialogMessage
,
showPreviewChangesDialog
:
false
,
cancellationToken
:
cancellationToken
);
return
suggestedAction
.
GetChangedSolution
(
cancellationToken
);
var
result
=
GetFixedSolution
(
fixMultipleState
,
triggerDiagnostic
,
workspace
,
waitDialogTitle
,
waitDialogMessage
,
cancellationToken
);
return
result
;
}
private
FixMultipleSuggestedAction
GetSuggestedAc
tion
(
private
Solution
GetFixedSolu
tion
(
FixAllState
fixAllState
,
Diagnostic
triggerDiagnostic
,
Workspace
workspace
,
string
title
,
string
waitDialogMessage
,
bool
showPreviewChangesDialog
,
CancellationToken
cancellationToken
)
{
var
fixMultipleCodeAction
=
new
FixMultipleCodeAction
(
fixAllState
,
triggerDiagnostic
,
title
,
waitDialogMessage
,
showPreviewChangesDialog
);
return
new
FixMultipleSuggestedAction
(
_listener
,
workspace
,
_editHandler
,
_waitIndicator
,
fixMultipleCodeAction
,
fixAllState
.
FixAllProvider
);
var
fixMultipleCodeAction
=
new
FixMultipleCodeAction
(
fixAllState
,
triggerDiagnostic
,
title
,
waitDialogMessage
);
Solution
newSolution
=
null
;
var
extensionManager
=
workspace
.
Services
.
GetService
<
IExtensionManager
>();
extensionManager
.
PerformAction
(
fixAllState
.
FixAllProvider
,
()
=>
{
// We don't need to post process changes here as the inner code action created for Fix multiple code fix already executes.
newSolution
=
fixMultipleCodeAction
.
GetChangedSolutionInternalAsync
(
postProcessChanges
:
false
,
cancellationToken
:
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
});
return
newSolution
;
}
}
}
src/EditorFeatures/Core/Implementation/Suggestions/FixMultipleSuggestedAction.cs
已删除
100644 → 0
浏览文件 @
1ffe63ff
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using
System
;
using
System.Collections.Generic
;
using
System.Globalization
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
Microsoft.CodeAnalysis.CodeFixes
;
using
Microsoft.CodeAnalysis.Internal.Log
;
using
Microsoft.VisualStudio.Text
;
using
Roslyn.Utilities
;
using
Microsoft.CodeAnalysis.Extensions
;
using
Microsoft.CodeAnalysis.Editor.Host
;
using
Microsoft.CodeAnalysis.Shared.TestHooks
;
using
Microsoft.CodeAnalysis.Shared.Utilities
;
namespace
Microsoft.CodeAnalysis.Editor.Implementation.Suggestions
{
/// <summary>
/// Suggested action for fix multiple occurrences code fix.
/// </summary>
internal
class
FixMultipleSuggestedAction
:
FixAllSuggestedAction
{
private
readonly
Document
_triggerDocumentOpt
;
private
readonly
string
_telemetryId
;
internal
FixMultipleSuggestedAction
(
IAsynchronousOperationListener
operationListener
,
Workspace
workspace
,
ICodeActionEditHandlerService
editHandler
,
IWaitIndicator
waitIndicator
,
FixMultipleCodeAction
codeAction
,
FixAllProvider
provider
,
ITextBuffer
subjectBufferOpt
=
null
)
:
base
(
workspace
,
subjectBufferOpt
,
editHandler
,
waitIndicator
,
codeAction
,
provider
,
originalFixedDiagnostic
:
codeAction
.
GetTriggerDiagnostic
(),
operationListener
:
operationListener
)
{
_triggerDocumentOpt
=
codeAction
.
FixAllState
.
Document
;
_telemetryId
=
GetTelemetryId
(
codeAction
.
FixAllState
.
DiagnosticIds
);
}
private
static
string
GetTelemetryId
(
IEnumerable
<
string
>
diagnosticIds
)
{
// hash all the diagnostic IDs
var
hash
=
0
;
foreach
(
var
diagnosticId
in
diagnosticIds
.
Order
())
{
hash
=
Hash
.
Combine
(
diagnosticId
.
GetHashCode
(),
hash
);
}
return
hash
.
ToString
(
CultureInfo
.
InvariantCulture
);
}
public
override
string
GetDiagnosticID
()
{
return
_telemetryId
;
}
public
override
bool
HasPreview
{
get
{
return
false
;
}
}
public
override
Task
<
object
>
GetPreviewAsync
(
CancellationToken
cancellationToken
)
{
return
SpecializedTasks
.
Default
<
object
>();
}
public
Solution
GetChangedSolution
(
CancellationToken
cancellationToken
)
{
Solution
newSolution
=
null
;
var
extensionManager
=
this
.
Workspace
.
Services
.
GetService
<
IExtensionManager
>();
extensionManager
.
PerformAction
(
Provider
,
()
=>
{
// We don't need to post process changes here as the inner code action created for Fix multiple code fix already executes.
newSolution
=
CodeAction
.
GetChangedSolutionInternalAsync
(
postProcessChanges
:
false
,
cancellationToken
:
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
});
return
newSolution
;
}
protected
override
async
Task
InvokeAsync
(
IProgressTracker
progressTracker
,
CancellationToken
cancellationToken
)
{
using
(
Logger
.
LogBlock
(
FunctionId
.
CodeFixes_FixAllOccurrencesSession
,
cancellationToken
))
{
// We might not have an origin subject buffer, for example if we are fixing selected diagnostics in the error list.
if
(
this
.
SubjectBuffer
!=
null
)
{
await
base
.
InvokeAsync
(
progressTracker
,
cancellationToken
).
ConfigureAwait
(
true
);
}
else
{
Func
<
Document
>
getDocument
=
()
=>
_triggerDocumentOpt
;
await
InvokeCoreAsync
(
getDocument
,
progressTracker
,
cancellationToken
).
ConfigureAwait
(
true
);
}
}
}
}
}
src/Features/Core/Portable/CodeFixes/FixAllOccurrences/FixMultipleCodeAction.cs
浏览文件 @
40c096b3
...
...
@@ -15,9 +15,8 @@ internal partial class FixMultipleCodeAction : FixAllCodeAction
FixAllState
fixAllState
,
Diagnostic
triggerDiagnostic
,
string
title
,
string
computingFixWaitDialogMessage
,
bool
showPreviewChangesDialog
)
:
base
(
fixAllState
,
showPreviewChangesDialog
)
string
computingFixWaitDialogMessage
)
:
base
(
fixAllState
,
showPreviewChangesDialog
:
false
)
{
_triggerDiagnostic
=
triggerDiagnostic
;
_title
=
title
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录