提交 992e4589 编写于 作者: C CyrusNajmabadi

Make FixAllCodeAction a private type inside FixAllSuggestedAction.

上级 2c66b93e
......@@ -278,6 +278,7 @@
<Compile Include="Implementation\Structure\AbstractStructureTaggerProvider.cs" />
<Compile Include="Implementation\Preview\DifferenceViewerPreview.cs" />
<Compile Include="Implementation\Preview\PreviewReferenceHighlightingTaggerProvider.cs" />
<Compile Include="Implementation\Suggestions\FixAllSuggestedAction.FixAllCodeAction.cs" />
<Compile Include="Implementation\Suggestions\FixMultipleOccurrencesService.cs" />
<Compile Include="Implementation\GoToImplementation\GoToImplementationCommandHandler.cs" />
<Compile Include="Implementation\TodoComment\ITodoListProvider.cs" />
......
// 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 Microsoft.CodeAnalysis.CodeFixes;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Suggestions
{
internal partial class FixAllSuggestedAction
{
private sealed partial class FixAllCodeAction : FixSomeCodeAction
{
public FixAllCodeAction(FixAllState fixAllState)
: base(fixAllState, showPreviewChangesDialog: true)
{
}
public override string Title
{
get
{
switch (this.FixAllState.Scope)
{
case FixAllScope.Document:
return FeaturesResources.Document;
case FixAllScope.Project:
return FeaturesResources.Project;
case FixAllScope.Solution:
return FeaturesResources.Solution;
default:
throw new NotSupportedException();
}
}
}
internal override string Message => FeaturesResources.Computing_fix_all_occurrences_code_fix;
}
}
}
\ No newline at end of file
......@@ -18,7 +18,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.Suggestions
/// <summary>
/// Suggested action for fix all occurrences code fix.
/// </summary>
internal sealed class FixAllSuggestedAction : SuggestedAction, ITelemetryDiagnosticID<string>
internal sealed partial class FixAllSuggestedAction : SuggestedAction, ITelemetryDiagnosticID<string>
{
private readonly Diagnostic _fixedDiagnostic;
......@@ -27,11 +27,12 @@ internal sealed class FixAllSuggestedAction : SuggestedAction, ITelemetryDiagnos
ITextBuffer subjectBuffer,
ICodeActionEditHandlerService editHandler,
IWaitIndicator waitIndicator,
FixAllCodeAction codeAction,
FixAllProvider provider,
FixAllState fixAllState,
Diagnostic originalFixedDiagnostic,
IAsynchronousOperationListener operationListener)
: base(workspace, subjectBuffer, editHandler, waitIndicator, codeAction, provider, operationListener)
: base(workspace, subjectBuffer, editHandler, waitIndicator,
new FixAllCodeAction(fixAllState), fixAllState.FixAllProvider,
operationListener)
{
_fixedDiagnostic = originalFixedDiagnostic;
}
......
......@@ -464,10 +464,11 @@ private IEnumerable<SuggestedActionSet> OrganizeFixes(Workspace workspace, IEnum
foreach (var scope in supportedScopes)
{
var fixAllStateForScope = fixAllState.WithScopeAndEquivalenceKey(scope, action.EquivalenceKey);
var fixAllAction = new FixAllCodeAction(fixAllStateForScope);
var fixAllSuggestedAction = new FixAllSuggestedAction(
workspace, subjectBuffer, editHandler, waitIndicator, fixAllAction,
fixAllStateForScope.FixAllProvider, firstDiagnostic, operationListener);
workspace, subjectBuffer, editHandler, waitIndicator,
fixAllStateForScope, firstDiagnostic, operationListener);
fixAllSuggestedActions.Add(fixAllSuggestedAction);
}
......
// 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;
namespace Microsoft.CodeAnalysis.CodeFixes
{
internal sealed partial class FixAllCodeAction : FixSomeCodeAction
{
public FixAllCodeAction(FixAllState fixAllState)
: base(fixAllState, showPreviewChangesDialog: true)
{
}
public override string Title
{
get
{
switch (this.FixAllState.Scope)
{
case FixAllScope.Document:
return FeaturesResources.Document;
case FixAllScope.Project:
return FeaturesResources.Project;
case FixAllScope.Solution:
return FeaturesResources.Solution;
default:
throw new NotSupportedException();
}
}
}
internal override string Message => FeaturesResources.Computing_fix_all_occurrences_code_fix;
}
}
......@@ -159,7 +159,6 @@
<Compile Include="AddImport\SymbolResult.cs" />
<Compile Include="CodeFixes\CodeFixContextExtensions.cs" />
<Compile Include="CodeFixes\FixAllOccurrences\FixMultipleCodeAction.cs" />
<Compile Include="CodeFixes\FixAllOccurrences\FixAllCodeAction.cs" />
<Compile Include="AddImport\AbstractAddImportCodeFixProvider.cs" />
<Compile Include="CodeFixes\Async\AbstractAddAwaitCodeFixProvider.cs" />
<Compile Include="CodeFixes\Async\AbstractChangeToAsyncCodeFixProvider.cs" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册