提交 0721df49 编写于 作者: C CyrusNajmabadi

Remove needless subclassing with refactoring providers.

上级 a8246f6a
......@@ -2,9 +2,9 @@
using System;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.ChangeSignature;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.CodeRefactorings.ChangeSignature;
using Microsoft.CodeAnalysis.Editor.UnitTests.ChangeSignature;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Roslyn.Test.Utilities;
......@@ -15,14 +15,10 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ChangeSignature
public partial class ChangeSignatureTests : AbstractChangeSignatureTests
{
protected override CodeRefactoringProvider CreateCodeRefactoringProvider(Workspace workspace)
{
return new ChangeSignatureCodeRefactoringProvider();
}
=> new ChangeSignatureCodeRefactoringProvider();
protected override string GetLanguage()
{
return LanguageNames.CSharp;
}
=> LanguageNames.CSharp;
protected override Task<TestWorkspace> CreateWorkspaceFromFileAsync(string definition, ParseOptions parseOptions, CompilationOptions compilationOptions)
{
......
......@@ -5,10 +5,9 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.CodeRefactorings.EncapsulateField;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Notification;
using Microsoft.CodeAnalysis.EncapsulateField;
using Microsoft.CodeAnalysis.Options;
using Roslyn.Test.Utilities;
using Xunit;
......@@ -18,9 +17,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeRefactorings.Encaps
public class EncapsulateFieldTests : AbstractCSharpCodeActionTest
{
protected override CodeRefactoringProvider CreateCodeRefactoringProvider(Workspace workspace)
{
return new EncapsulateFieldRefactoringProvider();
}
=> new EncapsulateFieldRefactoringProvider();
private static readonly Dictionary<OptionKey, object> AllOptionsOff =
new Dictionary<OptionKey, object>
......
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.ChangeSignature
Imports Microsoft.CodeAnalysis.CodeRefactorings
Imports Microsoft.CodeAnalysis.Editor.UnitTests.ChangeSignature
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.ChangeSignature
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.ChangeSignature
Partial Public Class ChangeSignatureTests
......
......@@ -2,7 +2,7 @@
Imports Microsoft.CodeAnalysis.CodeRefactorings
Imports Microsoft.CodeAnalysis.CodeStyle
Imports Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.EncapsulateField
Imports Microsoft.CodeAnalysis.EncapsulateField
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeRefactorings.EncapsulateField
Public Class EncapsulateFieldTests
......
......@@ -90,7 +90,6 @@
<Compile Include="UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs" />
<Compile Include="UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs" />
<Compile Include="Structure\Providers\BlockSyntaxStructureProvider.cs" />
<Compile Include="ChangeSignature\ChangeSignatureCodeRefactoringProvider.cs" />
<Compile Include="ChangeSignature\ChangeSignatureFormattingRule.cs" />
<Compile Include="ChangeSignature\CSharpChangeSignatureService.cs" />
<Compile Include="ChangeSignature\UnifiedArgumentSyntax.cs" />
......@@ -123,8 +122,6 @@
<Compile Include="CodeFixes\TypeStyle\UseImplicitTypeCodeFixProvider.cs" />
<Compile Include="CodeLens\CSharpCodeLensDisplayInfoService.cs" />
<Compile Include="ConvertToInterpolatedString\CSharpConvertPlaceholderToInterpolatedStringRefactoringProvider.cs" />
<Compile Include="CodeRefactorings\EncapsulateField\EncapsulateFieldCodeRefactoringProvider.cs" />
<Compile Include="CodeRefactorings\ExtractInterface\ExtractInterfaceCodeRefactoringProvider.cs" />
<Compile Include="CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs" />
<Compile Include="CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.InitializerRewriter.cs" />
<Compile Include="CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.ReferenceRewriter.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.Composition;
using Microsoft.CodeAnalysis.ChangeSignature;
using Microsoft.CodeAnalysis.CodeRefactorings;
namespace Microsoft.CodeAnalysis.CSharp.CodeRefactorings.ChangeSignature
{
[ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = PredefinedCodeRefactoringProviderNames.ChangeSignature), Shared]
internal class ChangeSignatureCodeRefactoringProvider : AbstractChangeSignatureCodeRefactoringProvider
{
}
}
// 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.Composition;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.CodeRefactorings.EncapsulateField;
namespace Microsoft.CodeAnalysis.CSharp.CodeRefactorings.EncapsulateField
{
[ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = PredefinedCodeRefactoringProviderNames.EncapsulateField), Shared]
internal class EncapsulateFieldRefactoringProvider : AbstractEncapsulateFieldRefactoringProvider
{
}
}
// 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.Composition;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.ExtractInterface;
namespace Microsoft.CodeAnalysis.CSharp.CodeRefactorings.ExtractInterface
{
[ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = PredefinedCodeRefactoringProviderNames.ExtractInterface), Shared]
internal class ExtractInterfaceCodeRefactoringProvider : AbstractExtractInterfaceCodeRefactoringProvider
{
}
}
// 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.Composition;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.Shared.Extensions;
namespace Microsoft.CodeAnalysis.ChangeSignature
{
internal class AbstractChangeSignatureCodeRefactoringProvider : CodeRefactoringProvider
[ExportCodeRefactoringProvider(LanguageNames.CSharp, LanguageNames.VisualBasic,
Name = PredefinedCodeRefactoringProviderNames.ChangeSignature), Shared]
internal class ChangeSignatureCodeRefactoringProvider : CodeRefactoringProvider
{
public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContext context)
{
......@@ -15,4 +18,4 @@ public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContex
context.RegisterRefactorings(actions);
}
}
}
}
\ No newline at end of file
......@@ -18,4 +18,4 @@ internal static void RegisterRefactorings(this CodeRefactoringContext context, I
}
}
}
}
}
\ No newline at end of file
// 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.Composition;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.EncapsulateField;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.Shared.Extensions;
namespace Microsoft.CodeAnalysis.CodeRefactorings.EncapsulateField
namespace Microsoft.CodeAnalysis.EncapsulateField
{
internal abstract class AbstractEncapsulateFieldRefactoringProvider : CodeRefactoringProvider
[ExportCodeRefactoringProvider(LanguageNames.CSharp, LanguageNames.VisualBasic,
Name = PredefinedCodeRefactoringProviderNames.EncapsulateField), Shared]
internal class EncapsulateFieldRefactoringProvider : CodeRefactoringProvider
{
public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContext context)
{
......@@ -15,4 +18,4 @@ public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContex
context.RegisterRefactorings(actions);
}
}
}
}
\ No newline at end of file
// 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.Composition;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.Shared.Extensions;
namespace Microsoft.CodeAnalysis.ExtractInterface
{
internal abstract class AbstractExtractInterfaceCodeRefactoringProvider : CodeRefactoringProvider
[ExportCodeRefactoringProvider(LanguageNames.CSharp, LanguageNames.VisualBasic,
Name = PredefinedCodeRefactoringProviderNames.ExtractInterface), Shared]
internal class ExtractInterfaceCodeRefactoringProvider : CodeRefactoringProvider
{
public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContext context)
{
......@@ -15,4 +18,4 @@ public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContex
context.RegisterRefactorings(actions);
}
}
}
}
\ No newline at end of file
......@@ -101,6 +101,8 @@
<Compile Include="AddImport\CodeActions\PackageReference.InstallPackageAndAddImportCodeAction.cs" />
<Compile Include="AddImport\CodeActions\PackageReference.InstallWithPackageManagerCodeAction.cs" />
<Compile Include="ConvertToInterpolatedString\AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.cs" />
<Compile Include="EncapsulateField\EncapsulateFieldRefactoringProvider.cs" />
<Compile Include="ExtractInterface\ExtractInterfaceCodeRefactoringProvider.cs" />
<Compile Include="FeaturesResources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
......@@ -451,11 +453,9 @@
<Compile Include="EditAndContinue\RudeEditKind.cs" />
<Compile Include="EditAndContinue\RudeEditDiagnosticDescriptors.cs" />
<Compile Include="EditAndContinue\SessionReadOnlyReason.cs" />
<Compile Include="EncapsulateField\AbstractEncapsulateFieldCodeRefactoringProvider.cs" />
<Compile Include="EncapsulateField\AbstractEncapsulateFieldService.cs" />
<Compile Include="EncapsulateField\EncapsulateFieldCodeAction.cs" />
<Compile Include="EncapsulateField\EncapsulateFieldResult.cs" />
<Compile Include="ExtractInterface\AbstractExtractInterfaceCodeRefactoringProvider.cs" />
<Compile Include="ExtractInterface\AbstractExtractInterfaceService.cs" />
<Compile Include="ExtractInterface\ExtractInterfaceCodeAction.cs" />
<Compile Include="ExtractInterface\ExtractInterfaceOptionsResult.cs" />
......@@ -706,4 +706,4 @@
<ItemGroup />
<Import Project="..\..\..\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems" Label="Shared" />
<Import Project="..\..\..\..\build\Targets\Imports.targets" />
</Project>
</Project>
\ No newline at end of file
......@@ -78,7 +78,6 @@
<Compile Include="..\..\..\Compilers\VisualBasic\Portable\Syntax\LambdaUtilities.vb">
<Link>InternalUtilities\LambdaUtilities.vb</Link>
</Compile>
<Compile Include="ChangeSignature\ChangeSignatureCodeRefactoringProvider.vb" />
<Compile Include="ChangeSignature\ChangeSignatureFormattingRule.vb" />
<Compile Include="ChangeSignature\UnifiedArgumentSyntax.vb" />
<Compile Include="ChangeSignature\VisualBasicChangeSignatureService.vb" />
......@@ -128,8 +127,6 @@
<Compile Include="CodeLens\VisualBasicDisplayInfoService.vb" />
<Compile Include="ConvertToInterpolatedString\VisualBasicConvertConcatenationToInterpolatedStringRefactoringProvider.vb" />
<Compile Include="ConvertToInterpolatedString\VisualBasicConvertPlaceholderToInterpolatedStringRefactoringProvider.vb" />
<Compile Include="CodeRefactorings\EncapsulateField\EncapsulateFieldRefactoringProvider.vb" />
<Compile Include="CodeRefactorings\ExtractInterface\ExtractInterfaceCodeRefactoringProvider.vb" />
<Compile Include="CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.ReferenceRewriter.vb" />
<Compile Include="CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.vb" />
<Compile Include="CodeRefactorings\InvertIf\InvertIfCodeRefactoringProvider.vb" />
......@@ -474,4 +471,4 @@
</ItemGroup>
<Import Project="..\..\..\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems" Label="Shared" />
<Import Project="..\..\..\..\build\Targets\Imports.targets" />
</Project>
</Project>
\ No newline at end of file
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Composition
Imports Microsoft.CodeAnalysis.ChangeSignature
Imports Microsoft.CodeAnalysis.CodeRefactorings
Namespace Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.ChangeSignature
<ExportCodeRefactoringProvider(LanguageNames.VisualBasic, Name:=PredefinedCodeRefactoringProviderNames.ChangeSignature), [Shared]>
Friend Class ChangeSignatureCodeRefactoringProvider
Inherits AbstractChangeSignatureCodeRefactoringProvider
End Class
End Namespace
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Composition
Imports Microsoft.CodeAnalysis.CodeRefactorings
Imports Microsoft.CodeAnalysis.CodeRefactorings.EncapsulateField
Namespace Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.EncapsulateField
<ExportCodeRefactoringProvider(LanguageNames.VisualBasic, Name:=PredefinedCodeRefactoringProviderNames.EncapsulateField), [Shared]>
Friend Class EncapsulateFieldRefactoringProvider
Inherits AbstractEncapsulateFieldRefactoringProvider
End Class
End Namespace
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Composition
Imports Microsoft.CodeAnalysis.CodeRefactorings
Imports Microsoft.CodeAnalysis.ExtractInterface
Namespace Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.ExtractInterface
<ExportCodeRefactoringProvider(LanguageNames.VisualBasic, Name:=PredefinedCodeRefactoringProviderNames.ExtractInterface), [Shared]>
Friend Class ExtractInterfaceCodeRefactoringProvider
Inherits AbstractExtractInterfaceCodeRefactoringProvider
End Class
End Namespace
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册