From 44d50e278ebf3c6b26376409f535bd21f8a84242 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Thu, 2 Apr 2020 09:00:24 -0700 Subject: [PATCH] Port UseCompoundAssignment to shared layer --- src/Analyzers/CSharp/Analyzers/CSharpAnalyzers.projitems | 3 +++ .../CSharpUseCompoundAssignmentDiagnosticAnalyzer.cs | 0 .../CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs | 2 +- .../CSharp/Analyzers}/UseCompoundAssignment/Utilities.cs | 0 src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems | 2 ++ .../CSharpUseCompoundAssignmentCodeFixProvider.cs | 0 .../CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs | 4 ++-- .../CSharp/Tests/CSharpAnalyzers.UnitTests.projitems | 2 ++ .../UseCompoundAssignment/UseCompoundAssignmentTests.cs | 0 .../UseCompoundCoalesceAssignmentTests.cs | 0 src/Analyzers/Core/Analyzers/Analyzers.projitems | 2 ++ .../AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs | 2 +- .../UseCompoundAssignment/UseCompoundAssignmentUtilities.cs | 0 src/Analyzers/Core/CodeFixes/CodeFixes.projitems | 1 + .../AbstractUseCompoundAssignmentCodeFixProvider.cs | 4 ++-- .../VisualBasic/Analyzers}/UseCompoundAssignment/Utilities.vb | 0 .../VisualBasicUseCompoundAssignmentDiagnosticAnalyzer.vb | 0 .../VisualBasic/Analyzers/VisualBasicAnalyzers.projitems | 2 ++ .../VisualBasicUseCompoundAssignmentCodeFixProvider.vb | 0 .../VisualBasic/CodeFixes/VisualBasicCodeFixes.projitems | 1 + .../UseCompoundAssignment/UseCompoundAssignmentTests.vb | 0 .../Tests/VisualBasicAnalyzers.UnitTests.projitems | 1 + 22 files changed, 20 insertions(+), 6 deletions(-) rename src/{Features/CSharp/Portable => Analyzers/CSharp/Analyzers}/UseCompoundAssignment/CSharpUseCompoundAssignmentDiagnosticAnalyzer.cs (100%) rename src/{Features/CSharp/Portable => Analyzers/CSharp/Analyzers}/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (95%) rename src/{Features/CSharp/Portable => Analyzers/CSharp/Analyzers}/UseCompoundAssignment/Utilities.cs (100%) rename src/{Features/CSharp/Portable => Analyzers/CSharp/CodeFixes}/UseCompoundAssignment/CSharpUseCompoundAssignmentCodeFixProvider.cs (100%) rename src/{Features/CSharp/Portable => Analyzers/CSharp/CodeFixes}/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (95%) rename src/{EditorFeatures/CSharpTest => Analyzers/CSharp/Tests}/UseCompoundAssignment/UseCompoundAssignmentTests.cs (100%) rename src/{EditorFeatures/CSharpTest => Analyzers/CSharp/Tests}/UseCompoundAssignment/UseCompoundCoalesceAssignmentTests.cs (100%) rename src/{Features/Core/Portable => Analyzers/Core/Analyzers}/UseCompoundAssignment/AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs (97%) rename src/{Features/Core/Portable => Analyzers/Core/Analyzers}/UseCompoundAssignment/UseCompoundAssignmentUtilities.cs (100%) rename src/{Features/Core/Portable => Analyzers/Core/CodeFixes}/UseCompoundAssignment/AbstractUseCompoundAssignmentCodeFixProvider.cs (95%) rename src/{Features/VisualBasic/Portable => Analyzers/VisualBasic/Analyzers}/UseCompoundAssignment/Utilities.vb (100%) rename src/{Features/VisualBasic/Portable => Analyzers/VisualBasic/Analyzers}/UseCompoundAssignment/VisualBasicUseCompoundAssignmentDiagnosticAnalyzer.vb (100%) rename src/{Features/VisualBasic/Portable => Analyzers/VisualBasic/CodeFixes}/UseCompoundAssignment/VisualBasicUseCompoundAssignmentCodeFixProvider.vb (100%) rename src/{EditorFeatures/VisualBasicTest => Analyzers/VisualBasic/Tests}/UseCompoundAssignment/UseCompoundAssignmentTests.vb (100%) diff --git a/src/Analyzers/CSharp/Analyzers/CSharpAnalyzers.projitems b/src/Analyzers/CSharp/Analyzers/CSharpAnalyzers.projitems index c177df4bb99..f30a9d20951 100644 --- a/src/Analyzers/CSharp/Analyzers/CSharpAnalyzers.projitems +++ b/src/Analyzers/CSharp/Analyzers/CSharpAnalyzers.projitems @@ -32,6 +32,9 @@ + + + diff --git a/src/Features/CSharp/Portable/UseCompoundAssignment/CSharpUseCompoundAssignmentDiagnosticAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/UseCompoundAssignment/CSharpUseCompoundAssignmentDiagnosticAnalyzer.cs similarity index 100% rename from src/Features/CSharp/Portable/UseCompoundAssignment/CSharpUseCompoundAssignmentDiagnosticAnalyzer.cs rename to src/Analyzers/CSharp/Analyzers/UseCompoundAssignment/CSharpUseCompoundAssignmentDiagnosticAnalyzer.cs diff --git a/src/Features/CSharp/Portable/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs similarity index 95% rename from src/Features/CSharp/Portable/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs rename to src/Analyzers/CSharp/Analyzers/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs index 2ad0a70ef9b..a0dffafcae2 100644 --- a/src/Features/CSharp/Portable/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs +++ b/src/Analyzers/CSharp/Analyzers/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs @@ -22,7 +22,7 @@ internal class CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer public CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer() : base(IDEDiagnosticIds.UseCoalesceCompoundAssignmentDiagnosticId, CodeStyleOptions2.PreferCompoundAssignment, - new LocalizableResourceString(nameof(FeaturesResources.Use_compound_assignment), FeaturesResources.ResourceManager, typeof(FeaturesResources))) + new LocalizableResourceString(nameof(AnalyzersResources.Use_compound_assignment), AnalyzersResources.ResourceManager, typeof(AnalyzersResources))) { } diff --git a/src/Features/CSharp/Portable/UseCompoundAssignment/Utilities.cs b/src/Analyzers/CSharp/Analyzers/UseCompoundAssignment/Utilities.cs similarity index 100% rename from src/Features/CSharp/Portable/UseCompoundAssignment/Utilities.cs rename to src/Analyzers/CSharp/Analyzers/UseCompoundAssignment/Utilities.cs diff --git a/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems b/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems index f678c2b44c1..0f9c513c9fe 100644 --- a/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems +++ b/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems @@ -30,6 +30,8 @@ + + diff --git a/src/Features/CSharp/Portable/UseCompoundAssignment/CSharpUseCompoundAssignmentCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseCompoundAssignment/CSharpUseCompoundAssignmentCodeFixProvider.cs similarity index 100% rename from src/Features/CSharp/Portable/UseCompoundAssignment/CSharpUseCompoundAssignmentCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/UseCompoundAssignment/CSharpUseCompoundAssignmentCodeFixProvider.cs diff --git a/src/Features/CSharp/Portable/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs similarity index 95% rename from src/Features/CSharp/Portable/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs index 66155919adf..af0a3cd5fcc 100644 --- a/src/Features/CSharp/Portable/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs @@ -88,10 +88,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) } } - private class MyCodeAction : CodeAction.DocumentChangeAction + private class MyCodeAction : CustomCodeActions.DocumentChangeAction { public MyCodeAction(Func> createChangedDocument) - : base(FeaturesResources.Use_compound_assignment, createChangedDocument, FeaturesResources.Use_compound_assignment) + : base(AnalyzersResources.Use_compound_assignment, createChangedDocument, AnalyzersResources.Use_compound_assignment) { } } diff --git a/src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems b/src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems index 2876688be1b..0088a4ae5ab 100644 --- a/src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems +++ b/src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems @@ -19,6 +19,8 @@ + + diff --git a/src/EditorFeatures/CSharpTest/UseCompoundAssignment/UseCompoundAssignmentTests.cs b/src/Analyzers/CSharp/Tests/UseCompoundAssignment/UseCompoundAssignmentTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/UseCompoundAssignment/UseCompoundAssignmentTests.cs rename to src/Analyzers/CSharp/Tests/UseCompoundAssignment/UseCompoundAssignmentTests.cs diff --git a/src/EditorFeatures/CSharpTest/UseCompoundAssignment/UseCompoundCoalesceAssignmentTests.cs b/src/Analyzers/CSharp/Tests/UseCompoundAssignment/UseCompoundCoalesceAssignmentTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/UseCompoundAssignment/UseCompoundCoalesceAssignmentTests.cs rename to src/Analyzers/CSharp/Tests/UseCompoundAssignment/UseCompoundCoalesceAssignmentTests.cs diff --git a/src/Analyzers/Core/Analyzers/Analyzers.projitems b/src/Analyzers/Core/Analyzers/Analyzers.projitems index 668c1a24c11..c2033ec2b0f 100644 --- a/src/Analyzers/Core/Analyzers/Analyzers.projitems +++ b/src/Analyzers/Core/Analyzers/Analyzers.projitems @@ -51,6 +51,8 @@ + + diff --git a/src/Features/Core/Portable/UseCompoundAssignment/AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs b/src/Analyzers/Core/Analyzers/UseCompoundAssignment/AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs similarity index 97% rename from src/Features/Core/Portable/UseCompoundAssignment/AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs rename to src/Analyzers/Core/Analyzers/UseCompoundAssignment/AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs index bd7618bd813..37dcecdf89d 100644 --- a/src/Features/Core/Portable/UseCompoundAssignment/AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs +++ b/src/Analyzers/Core/Analyzers/UseCompoundAssignment/AbstractUseCompoundAssignmentDiagnosticAnalyzer.cs @@ -40,7 +40,7 @@ internal abstract class AbstractUseCompoundAssignmentDiagnosticAnalyzer< : base(IDEDiagnosticIds.UseCompoundAssignmentDiagnosticId, CodeStyleOptions2.PreferCompoundAssignment, new LocalizableResourceString( - nameof(FeaturesResources.Use_compound_assignment), FeaturesResources.ResourceManager, typeof(FeaturesResources))) + nameof(AnalyzersResources.Use_compound_assignment), AnalyzersResources.ResourceManager, typeof(AnalyzersResources))) { _syntaxFacts = syntaxFacts; UseCompoundAssignmentUtilities.GenerateMaps(kinds, out _binaryToAssignmentMap, out _assignmentToTokenMap); diff --git a/src/Features/Core/Portable/UseCompoundAssignment/UseCompoundAssignmentUtilities.cs b/src/Analyzers/Core/Analyzers/UseCompoundAssignment/UseCompoundAssignmentUtilities.cs similarity index 100% rename from src/Features/Core/Portable/UseCompoundAssignment/UseCompoundAssignmentUtilities.cs rename to src/Analyzers/Core/Analyzers/UseCompoundAssignment/UseCompoundAssignmentUtilities.cs diff --git a/src/Analyzers/Core/CodeFixes/CodeFixes.projitems b/src/Analyzers/Core/CodeFixes/CodeFixes.projitems index 819db58fd44..a46ca1c85f3 100644 --- a/src/Analyzers/Core/CodeFixes/CodeFixes.projitems +++ b/src/Analyzers/Core/CodeFixes/CodeFixes.projitems @@ -31,6 +31,7 @@ + diff --git a/src/Features/Core/Portable/UseCompoundAssignment/AbstractUseCompoundAssignmentCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseCompoundAssignment/AbstractUseCompoundAssignmentCodeFixProvider.cs similarity index 95% rename from src/Features/Core/Portable/UseCompoundAssignment/AbstractUseCompoundAssignmentCodeFixProvider.cs rename to src/Analyzers/Core/CodeFixes/UseCompoundAssignment/AbstractUseCompoundAssignmentCodeFixProvider.cs index a2674ddf303..d281b3851a9 100644 --- a/src/Features/Core/Portable/UseCompoundAssignment/AbstractUseCompoundAssignmentCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseCompoundAssignment/AbstractUseCompoundAssignmentCodeFixProvider.cs @@ -92,10 +92,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) return Task.CompletedTask; } - private class MyCodeAction : CodeAction.DocumentChangeAction + private class MyCodeAction : CustomCodeActions.DocumentChangeAction { public MyCodeAction(Func> createChangedDocument) - : base(FeaturesResources.Use_compound_assignment, createChangedDocument, FeaturesResources.Use_compound_assignment) + : base(AnalyzersResources.Use_compound_assignment, createChangedDocument, AnalyzersResources.Use_compound_assignment) { } } diff --git a/src/Features/VisualBasic/Portable/UseCompoundAssignment/Utilities.vb b/src/Analyzers/VisualBasic/Analyzers/UseCompoundAssignment/Utilities.vb similarity index 100% rename from src/Features/VisualBasic/Portable/UseCompoundAssignment/Utilities.vb rename to src/Analyzers/VisualBasic/Analyzers/UseCompoundAssignment/Utilities.vb diff --git a/src/Features/VisualBasic/Portable/UseCompoundAssignment/VisualBasicUseCompoundAssignmentDiagnosticAnalyzer.vb b/src/Analyzers/VisualBasic/Analyzers/UseCompoundAssignment/VisualBasicUseCompoundAssignmentDiagnosticAnalyzer.vb similarity index 100% rename from src/Features/VisualBasic/Portable/UseCompoundAssignment/VisualBasicUseCompoundAssignmentDiagnosticAnalyzer.vb rename to src/Analyzers/VisualBasic/Analyzers/UseCompoundAssignment/VisualBasicUseCompoundAssignmentDiagnosticAnalyzer.vb diff --git a/src/Analyzers/VisualBasic/Analyzers/VisualBasicAnalyzers.projitems b/src/Analyzers/VisualBasic/Analyzers/VisualBasicAnalyzers.projitems index 865cb48bbbc..bfcb7d36617 100644 --- a/src/Analyzers/VisualBasic/Analyzers/VisualBasicAnalyzers.projitems +++ b/src/Analyzers/VisualBasic/Analyzers/VisualBasicAnalyzers.projitems @@ -30,6 +30,8 @@ + + diff --git a/src/Features/VisualBasic/Portable/UseCompoundAssignment/VisualBasicUseCompoundAssignmentCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/UseCompoundAssignment/VisualBasicUseCompoundAssignmentCodeFixProvider.vb similarity index 100% rename from src/Features/VisualBasic/Portable/UseCompoundAssignment/VisualBasicUseCompoundAssignmentCodeFixProvider.vb rename to src/Analyzers/VisualBasic/CodeFixes/UseCompoundAssignment/VisualBasicUseCompoundAssignmentCodeFixProvider.vb diff --git a/src/Analyzers/VisualBasic/CodeFixes/VisualBasicCodeFixes.projitems b/src/Analyzers/VisualBasic/CodeFixes/VisualBasicCodeFixes.projitems index ce344f51518..d3acb9fabc5 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/VisualBasicCodeFixes.projitems +++ b/src/Analyzers/VisualBasic/CodeFixes/VisualBasicCodeFixes.projitems @@ -25,6 +25,7 @@ + diff --git a/src/EditorFeatures/VisualBasicTest/UseCompoundAssignment/UseCompoundAssignmentTests.vb b/src/Analyzers/VisualBasic/Tests/UseCompoundAssignment/UseCompoundAssignmentTests.vb similarity index 100% rename from src/EditorFeatures/VisualBasicTest/UseCompoundAssignment/UseCompoundAssignmentTests.vb rename to src/Analyzers/VisualBasic/Tests/UseCompoundAssignment/UseCompoundAssignmentTests.vb diff --git a/src/Analyzers/VisualBasic/Tests/VisualBasicAnalyzers.UnitTests.projitems b/src/Analyzers/VisualBasic/Tests/VisualBasicAnalyzers.UnitTests.projitems index 24c92c4812e..96b17d03fc1 100644 --- a/src/Analyzers/VisualBasic/Tests/VisualBasicAnalyzers.UnitTests.projitems +++ b/src/Analyzers/VisualBasic/Tests/VisualBasicAnalyzers.UnitTests.projitems @@ -32,6 +32,7 @@ + -- GitLab