diff --git a/src/Features/CSharpTest/EditAndContinue/TopLevelEditingTests.cs b/src/Features/CSharpTest/EditAndContinue/TopLevelEditingTests.cs index 9f64d234f8774..33282e95f3818 100644 --- a/src/Features/CSharpTest/EditAndContinue/TopLevelEditingTests.cs +++ b/src/Features/CSharpTest/EditAndContinue/TopLevelEditingTests.cs @@ -3019,7 +3019,7 @@ record struct C(int X) var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoStruct, "_y = 0", FeaturesResources.field, CSharpFeaturesResources.record_struct)); + Diagnostic(RudeEditKind.InsertOrMoveStructMember, "_y = 0", FeaturesResources.field, CSharpFeaturesResources.record_struct)); } [Fact] @@ -3038,7 +3038,7 @@ record struct C(int X) var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoStruct, "public int Y", GetResource("auto-property"), GetResource("record struct"))); + Diagnostic(RudeEditKind.InsertOrMoveStructMember, "public int Y", GetResource("auto-property"), GetResource("record struct"))); } [Fact] @@ -3878,7 +3878,7 @@ public void Record_Property_Delete_ReplacingCustomWithSynthesized_TypeLayoutChan var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( - [Diagnostic(RudeEditKind.InsertIntoStruct, "int P", GetResource("auto-property"), GetResource("record struct"))], + [Diagnostic(RudeEditKind.InsertOrMoveStructMember, "int P", GetResource("auto-property"), GetResource("record struct"))], capabilities: EditAndContinueCapabilities.AddInstanceFieldToExistingType | EditAndContinueCapabilities.AddMethodToExistingType); } @@ -8478,7 +8478,8 @@ interface I public void Method_Reorder_Interface_ComImport(string modifier) { var src1 = $$""" - [System.Runtime.InteropServices.ComImport] + using System.Runtime.InteropServices; + [ComImport] [Guid("DBE8A85B-7883-4657-83FD-1FA27A9561EB")] interface I { @@ -8489,7 +8490,8 @@ interface I """; var src2 = $$""" - [System.Runtime.InteropServices.ComImport] + using System.Runtime.InteropServices; + [ComImport] [Guid("DBE8A85B-7883-4657-83FD-1FA27A9561EB")] interface I { @@ -8504,7 +8506,63 @@ interface I edits.VerifyEdits(EditKind.Reorder); edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoComInterface, modifier + "void H()", GetResource("method"))); + Diagnostic(RudeEditKind.InsertOrMoveComInterfaceMember, modifier + "void H()", GetResource("method"))); + } + + [Fact] + public void Method_Insert_Interface_ComImport() + { + var src1 = $$""" + using System.Runtime.InteropServices; + [ComImport] + [Guid("DBE8A85B-7883-4657-83FD-1FA27A9561EB")] + interface I + { + } + """; + + var src2 = $$""" + using System.Runtime.InteropServices; + [ComImport] + [Guid("DBE8A85B-7883-4657-83FD-1FA27A9561EB")] + interface I + { + void F(); + } + """; + + var edits = GetTopEdits(src1, src2); + + edits.VerifySemanticDiagnostics( + Diagnostic(RudeEditKind.InsertVirtual, "void F()", GetResource("method")), + Diagnostic(RudeEditKind.InsertOrMoveComInterfaceMember, "void F()", GetResource("method"))); + } + + [Fact] + public void Method_Insert_Interface_ComImport_Static() + { + var src1 = $$""" + [System.Runtime.InteropServices.ComImport] + [Guid("DBE8A85B-7883-4657-83FD-1FA27A9561EB")] + interface I + { + } + """; + + var src2 = $$""" + [System.Runtime.InteropServices.ComImport] + [Guid("DBE8A85B-7883-4657-83FD-1FA27A9561EB")] + interface I + { + extern static void F(); + } + """; + + var edits = GetTopEdits(src1, src2); + + edits.VerifySemanticDiagnostics( + Diagnostic(RudeEditKind.InsertExtern, "extern static void F()", GetResource("method")), + Diagnostic(RudeEditKind.InsertOrMoveComInterfaceMember, "extern static void F()", GetResource("method"))); } [Fact] @@ -11044,7 +11102,7 @@ public void Constructor_Parameter_Update_Type_Record_TypeLayout() var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( - [Diagnostic(RudeEditKind.InsertIntoStruct, "int x", GetResource("auto-property"), GetResource("record struct"))], + [Diagnostic(RudeEditKind.InsertOrMoveStructMember, "int x", GetResource("auto-property"), GetResource("record struct"))], capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.AddInstanceFieldToExistingType); } @@ -11539,7 +11597,7 @@ public void Constructor_Parameter_Insert_Primary_Captured_Struct() edits.VerifySemanticDiagnostics( [ Diagnostic(RudeEditKind.CapturingPrimaryConstructorParameter, "b", GetResource("struct"), "b"), - Diagnostic(RudeEditKind.InsertIntoStruct, "int b", GetResource("parameter"), GetResource("struct")) + Diagnostic(RudeEditKind.InsertOrMoveStructMember, "int b", GetResource("parameter"), GetResource("struct")) ], capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.AddInstanceFieldToExistingType); } @@ -11589,7 +11647,7 @@ record C(int X, int Y) { } var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "int Y", GetResource("auto-property"), GetResource("record"))); + Diagnostic(RudeEditKind.InsertOrMoveTypeWithLayoutMember, "int Y", GetResource("auto-property"), GetResource("record"))); } [Fact] @@ -11608,7 +11666,7 @@ record struct C(int x, int y) var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoStruct, "int y", GetResource("auto-property"), GetResource("record struct"))); + Diagnostic(RudeEditKind.InsertOrMoveStructMember, "int y", GetResource("auto-property"), GetResource("record struct"))); } [Fact] @@ -11837,7 +11895,7 @@ class C(int x, int y) edits.VerifySemanticDiagnostics( [ Diagnostic(RudeEditKind.CapturingPrimaryConstructorParameter, "y", GetResource("class with explicit or sequential layout"), "y"), - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "int y", GetResource("parameter"), GetResource("class")) + Diagnostic(RudeEditKind.InsertOrMoveTypeWithLayoutMember, "int y", GetResource("parameter"), GetResource("class")) ]); } @@ -11869,7 +11927,7 @@ class C(int x, int y) edits.VerifySemanticDiagnostics( [ Diagnostic(RudeEditKind.CapturingPrimaryConstructorParameter, "y", GetResource("class with explicit or sequential layout"), "y"), - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "int y", GetResource("parameter"), GetResource("class")) + Diagnostic(RudeEditKind.InsertOrMoveTypeWithLayoutMember, "int y", GetResource("parameter"), GetResource("class")) ]); } @@ -11899,7 +11957,7 @@ public void Constructor_Parameter_Reorder_Primary_NotLifted_Record_Struct() var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( - [Diagnostic(RudeEditKind.InsertIntoStruct, "byte y", GetResource("auto-property"), GetResource("record struct"))], + [Diagnostic(RudeEditKind.InsertOrMoveStructMember, "byte y", GetResource("auto-property"), GetResource("record struct"))], capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.AddInstanceFieldToExistingType); } @@ -11911,7 +11969,7 @@ public void Constructor_Parameter_Reorder_Primary_Lifted_Struct() var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( - [Diagnostic(RudeEditKind.InsertIntoStruct, "byte y", GetResource("parameter"), GetResource("struct"))], + [Diagnostic(RudeEditKind.InsertOrMoveStructMember, "byte y", GetResource("parameter"), GetResource("struct"))], capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.AddInstanceFieldToExistingType); } @@ -12809,7 +12867,7 @@ public void Constructor_Instance_Insert_Struct_Primary_Record() edits.VerifySemanticDiagnostics( [ - Diagnostic(RudeEditKind.InsertIntoStruct, "int X", GetResource("auto-property"), GetResource("record struct")) + Diagnostic(RudeEditKind.InsertOrMoveStructMember, "int X", GetResource("auto-property"), GetResource("record struct")) ], capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.AddInstanceFieldToExistingType); } @@ -16765,10 +16823,10 @@ class C } [Theory] - [InlineData("", "struct", RudeEditKind.InsertIntoStruct)] - [InlineData("", "record struct", RudeEditKind.InsertIntoStruct)] - [InlineData("[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]", "class", RudeEditKind.InsertIntoClassWithLayout)] - [InlineData("[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]", "record class", RudeEditKind.InsertIntoClassWithLayout)] + [InlineData("", "struct", RudeEditKind.InsertOrMoveStructMember)] + [InlineData("", "record struct", RudeEditKind.InsertOrMoveStructMember)] + [InlineData("[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]", "class", RudeEditKind.InsertOrMoveTypeWithLayoutMember)] + [InlineData("[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]", "record class", RudeEditKind.InsertOrMoveTypeWithLayoutMember)] internal void Field_Reorder_TypeLayout(string attribute, string keyword, RudeEditKind rudeEditKind) { var src1 = attribute + keyword + " C { int a = 0; int b = 1; int c = 2; }"; @@ -16864,8 +16922,8 @@ struct S var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoStruct, "b", FeaturesResources.field, CSharpFeaturesResources.struct_), - Diagnostic(RudeEditKind.InsertIntoStruct, "d", CSharpFeaturesResources.event_field, CSharpFeaturesResources.struct_)); + Diagnostic(RudeEditKind.InsertOrMoveStructMember, "b", FeaturesResources.field, CSharpFeaturesResources.struct_), + Diagnostic(RudeEditKind.InsertOrMoveStructMember, "d", CSharpFeaturesResources.event_field, CSharpFeaturesResources.struct_)); } [Fact] @@ -16938,9 +16996,8 @@ class C var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "b", FeaturesResources.field, FeaturesResources.class_), - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "c", FeaturesResources.field, FeaturesResources.class_), - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "d", FeaturesResources.field, FeaturesResources.class_)); + Diagnostic(RudeEditKind.InsertOrMoveTypeWithLayoutMember, "b", FeaturesResources.field, FeaturesResources.class_), + Diagnostic(RudeEditKind.InsertOrMoveTypeWithLayoutMember, "c", FeaturesResources.field, FeaturesResources.class_)); } [Fact] @@ -16971,9 +17028,8 @@ class C var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "b", FeaturesResources.field, FeaturesResources.class_), - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "c", FeaturesResources.field, FeaturesResources.class_), - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "d", FeaturesResources.field, FeaturesResources.class_)); + Diagnostic(RudeEditKind.InsertOrMoveTypeWithLayoutMember, "b", FeaturesResources.field, FeaturesResources.class_), + Diagnostic(RudeEditKind.InsertOrMoveTypeWithLayoutMember, "c", FeaturesResources.field, FeaturesResources.class_)); } [Fact] @@ -18066,10 +18122,10 @@ internal void Property_Reorder_TypeLayout(string attribute, string keyword) } [Theory] - [InlineData("", "struct", RudeEditKind.InsertIntoStruct)] - [InlineData("", "record struct", RudeEditKind.InsertIntoStruct)] - [InlineData("[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]", "class", RudeEditKind.InsertIntoClassWithLayout)] - [InlineData("[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]", "record class", RudeEditKind.InsertIntoClassWithLayout)] + [InlineData("", "struct", RudeEditKind.InsertOrMoveStructMember)] + [InlineData("", "record struct", RudeEditKind.InsertOrMoveStructMember)] + [InlineData("[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]", "class", RudeEditKind.InsertOrMoveTypeWithLayoutMember)] + [InlineData("[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]", "record class", RudeEditKind.InsertOrMoveTypeWithLayoutMember)] internal void Property_Reorder_Auto_TypeLayout(string attribute, string keyword, RudeEditKind rudeEditKind) { var src1 = attribute + keyword + " C { int P { get; } int Q { get; } int R { get; } }"; @@ -18221,7 +18277,7 @@ public void Property_Update_Type_TypeLayout() var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( - [Diagnostic(RudeEditKind.InsertIntoStruct, "long P", GetResource("auto-property"), GetResource("struct"))], + [Diagnostic(RudeEditKind.InsertOrMoveStructMember, "long P", GetResource("auto-property"), GetResource("struct"))], capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.AddInstanceFieldToExistingType); } @@ -18384,8 +18440,44 @@ class C Diagnostic(RudeEditKind.InsertExtern, "private static extern int P3", FeaturesResources.property_)); } + [Theory] + [InlineData("", "struct", RudeEditKind.InsertOrMoveStructMember)] + [InlineData("[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]", "class", RudeEditKind.InsertOrMoveTypeWithLayoutMember)] + internal void Property_Insert_TypeLayout(string attribute, string type, RudeEditKind rudeEditKind) + { + var src1 = attribute + type + """ + S + { + public int a; + + public S(int z) { a = z; } + } + """; + var src2 = attribute + type + """ + S + { + public int a; + int c { get; set; } + int e { get { return 0; } set { } } + int g { get; } = 1; + int i { get; set; } = 1; + int k => 1; + int l { get => 1; set {} } + int m { get => 1; set => k; } + public S(int z) { a = z; } + } + """; + + var edits = GetTopEdits(src1, src2); + + edits.VerifySemanticDiagnostics( + Diagnostic(rudeEditKind, "int c", GetResource("auto-property"), GetResource(type)), + Diagnostic(rudeEditKind, "int g", GetResource("auto-property"), GetResource(type)), + Diagnostic(rudeEditKind, "int i", GetResource("auto-property"), GetResource(type))); + } + [Fact] - public void Property_Insert_IntoStruct() + public void Property_Insert_IntoStruct_Static() { var src1 = @" struct S @@ -18399,70 +18491,31 @@ struct S struct S { public int a; - private static int c { get; set; } - private static int e { get { return 0; } set { } } - private static int g { get; } = 1; - private static int i { get; set; } = 1; - private static int k => 1; - private static int l { get => 1; set {} } - private static int m { get => 1; set => k; } + static int c { get; set; } + static int e { get { return 0; } set { } } + static int g { get; } = 1; + static int i { get; set; } = 1; + static int k => 1; + static int l { get => 1; set {} } + static int m { get => 1; set => k; } public S(int z) { a = z; } } "; var edits = GetTopEdits(src1, src2); - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoStruct, "private static int c", GetResource("auto-property"), GetResource("struct")), - Diagnostic(RudeEditKind.InsertIntoStruct, "private static int g", GetResource("auto-property"), GetResource("struct")), - Diagnostic(RudeEditKind.InsertIntoStruct, "private static int i", GetResource("auto-property"), GetResource("struct"))); - } - - [Fact] - public void Property_Insert_IntoLayoutClass_Sequential() - { - var src1 = @" -using System.Runtime.InteropServices; - -[StructLayoutAttribute(LayoutKind.Sequential)] -class C -{ - private int a; -} -"; - var src2 = @" -using System.Runtime.InteropServices; - -[StructLayoutAttribute(LayoutKind.Sequential)] -class C -{ - private int a; - private int b { get; set; } - private static int c { get; set; } - private int d { get { return 0; } set { } } - private static int e { get { return 0; } set { } } - private int f { get; } = 1; - private static int g { get; } = 1; - private int h { get; set; } = 1; - private static int i { get; set; } = 1; - private int j => 1; - private static int k => 1; - private int l { get => 1; set { } } - private static int m { get => 1; set { } } - private int n { get { return 1; } set => a; } - private static int o { get { return 1; } set => a; } -} -"; - - var edits = GetTopEdits(src1, src2); - - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private int b", GetResource("auto-property"), GetResource("class")), - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private static int c", GetResource("auto-property"), GetResource("class")), - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private int f", GetResource("auto-property"), GetResource("class")), - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private static int g", GetResource("auto-property"), GetResource("class")), - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private int h", GetResource("auto-property"), GetResource("class")), - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private static int i", GetResource("auto-property"), GetResource("class"))); + edits.VerifySemantics( + [ + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("S.c")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("S.e")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("S.g")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("S.i")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("S.k")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("S.l")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("S.m")), + SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("S").StaticConstructors.Single()), + ], + capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.AddStaticFieldToExistingType); } [Fact] @@ -20839,7 +20892,7 @@ class C var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( - [Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "c", GetResource("event field"), GetResource("class"))], + [Diagnostic(RudeEditKind.InsertOrMoveTypeWithLayoutMember, "c", GetResource("event field"), GetResource("class"))], capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.AddInstanceFieldToExistingType); } @@ -21338,10 +21391,10 @@ class C } [Theory] - [InlineData("", "struct", RudeEditKind.InsertIntoStruct)] - [InlineData("", "record struct", RudeEditKind.InsertIntoStruct)] - [InlineData("[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]", "class", RudeEditKind.InsertIntoClassWithLayout)] - [InlineData("[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]", "record class", RudeEditKind.InsertIntoClassWithLayout)] + [InlineData("", "struct", RudeEditKind.InsertOrMoveStructMember)] + [InlineData("", "record struct", RudeEditKind.InsertOrMoveStructMember)] + [InlineData("[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]", "class", RudeEditKind.InsertOrMoveTypeWithLayoutMember)] + [InlineData("[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]", "record class", RudeEditKind.InsertOrMoveTypeWithLayoutMember)] internal void EventField_Reorder_TypeLayout(string attribute, string keyword, RudeEditKind rudeEditKind) { var src1 = $$""" diff --git a/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs b/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs index f6fbfd9459249..7db0811c49670 100644 --- a/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs +++ b/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs @@ -5000,7 +5000,7 @@ public void ReportTypeLayoutUpdateRudeEdits(CancellationToken cancellationToken) Debug.Assert(newSymbol != null); Report( - (newSymbol.ContainingType.TypeKind == TypeKind.Struct) ? RudeEditKind.InsertIntoStruct : RudeEditKind.InsertIntoClassWithLayout, + (newSymbol.ContainingType.TypeKind == TypeKind.Struct) ? RudeEditKind.InsertOrMoveStructMember : RudeEditKind.InsertOrMoveTypeWithLayoutMember, cancellationToken, arguments: [ @@ -5023,7 +5023,7 @@ internal void ReportTypeLayoutUpdateRudeEdits(in DiagnosticContext diagnosticCon // can't modify order of members in a COM interface: if (newSymbol.ContainingType is INamedTypeSymbol { IsComImport: true }) { - diagnosticContext.Report(RudeEditKind.InsertIntoComInterface, cancellationToken, arguments: [GetDisplayKind(newSymbol)]); + diagnosticContext.Report(RudeEditKind.InsertOrMoveComInterfaceMember, cancellationToken, arguments: [GetDisplayKind(newSymbol)]); return; } diff --git a/src/Features/Core/Portable/EditAndContinue/EditAndContinueDiagnosticDescriptors.cs b/src/Features/Core/Portable/EditAndContinue/EditAndContinueDiagnosticDescriptors.cs index 338185124482e..c4f134f6bbc50 100644 --- a/src/Features/Core/Portable/EditAndContinue/EditAndContinueDiagnosticDescriptors.cs +++ b/src/Features/Core/Portable/EditAndContinue/EditAndContinueDiagnosticDescriptors.cs @@ -91,8 +91,8 @@ void AddGeneralDiagnostic(EditAndContinueErrorCode code, string resourceName, Di AddRudeEdit(RudeEditKind.InsertExtern, nameof(FeaturesResources.Adding_an_extern_0_requires_restarting_the_application)); AddRudeEdit(RudeEditKind.InsertDllImport, nameof(FeaturesResources.Adding_an_imported_method_requires_restarting_the_application)); AddRudeEdit(RudeEditKind.InsertOperator, nameof(FeaturesResources.Adding_a_user_defined_0_requires_restarting_the_application)); - AddRudeEdit(RudeEditKind.InsertIntoStruct, nameof(FeaturesResources.Adding_0_into_a_1_requires_restarting_the_application)); - AddRudeEdit(RudeEditKind.InsertIntoClassWithLayout, nameof(FeaturesResources.Adding_0_into_a_1_with_explicit_or_sequential_layout_requires_restarting_the_application)); + AddRudeEdit(RudeEditKind.InsertOrMoveStructMember, nameof(FeaturesResources.Adding_or_moving_0_of_1_requires_restarting_the_application)); + AddRudeEdit(RudeEditKind.InsertOrMoveTypeWithLayoutMember, nameof(FeaturesResources.Adding_or_moving_0_of_1_with_explicit_or_sequential_layout_requires_restarting_the_application)); AddRudeEdit(RudeEditKind.Move, nameof(FeaturesResources.Moving_0_requires_restarting_the_application)); AddRudeEdit(RudeEditKind.Delete, nameof(FeaturesResources.Deleting_0_requires_restarting_the_application)); AddRudeEdit(RudeEditKind.GenericMethodUpdate, nameof(FeaturesResources.Modifying_a_generic_method_requires_restarting_the_application)); @@ -149,7 +149,7 @@ void AddGeneralDiagnostic(EditAndContinueErrorCode code, string resourceName, Di AddRudeEdit(RudeEditKind.ChangingNameOrSignatureOfActiveMember, nameof(FeaturesResources.Changing_name_or_signature_of_0_that_contains_an_active_statement_requires_restarting_the_application)); AddRudeEdit(RudeEditKind.UpdateMightNotHaveAnyEffect, nameof(FeaturesResources.Changing_0_might_not_have_any_effect_until_the_application_is_restarted), DiagnosticSeverity.Warning); AddRudeEdit(RudeEditKind.TypeUpdateAroundActiveStatement, nameof(FeaturesResources.Updating_a_0_around_an_active_statement_requires_restarting_the_application)); - AddRudeEdit(RudeEditKind.InsertIntoComInterface, nameof(FeaturesResources.Adding_0_into_a_COM_interface_requires_restarting_the_application)); + AddRudeEdit(RudeEditKind.InsertOrMoveComInterfaceMember, nameof(FeaturesResources.Adding_or_moving_0_of_a_COM_interface_requires_restarting_the_application)); // VB specific AddRudeEdit(RudeEditKind.HandlesClauseUpdate, nameof(FeaturesResources.Updating_the_Handles_clause_of_0_requires_restarting_the_application)); diff --git a/src/Features/Core/Portable/EditAndContinue/RudeEditKind.cs b/src/Features/Core/Portable/EditAndContinue/RudeEditKind.cs index de9963847aa72..ad21348734f9b 100644 --- a/src/Features/Core/Portable/EditAndContinue/RudeEditKind.cs +++ b/src/Features/Core/Portable/EditAndContinue/RudeEditKind.cs @@ -41,8 +41,8 @@ internal enum RudeEditKind : ushort // InsertNonPublicConstructor = 27, // InsertGenericMethod = 28, InsertDllImport = 29, - InsertIntoStruct = 30, - InsertIntoClassWithLayout = 31, + InsertOrMoveStructMember = 30, + InsertOrMoveTypeWithLayoutMember = 31, Move = 32, Delete = 33, // MethodBodyAdd = 34, @@ -144,5 +144,5 @@ internal enum RudeEditKind : ushort ChangingNameOrSignatureOfActiveMember = 117, UpdateMightNotHaveAnyEffect = 118, TypeUpdateAroundActiveStatement = 119, - InsertIntoComInterface = 120, + InsertOrMoveComInterfaceMember = 120, } diff --git a/src/Features/Core/Portable/FeaturesResources.resx b/src/Features/Core/Portable/FeaturesResources.resx index 9f1bcb05c25ba..0c9edac5be335 100644 --- a/src/Features/Core/Portable/FeaturesResources.resx +++ b/src/Features/Core/Portable/FeaturesResources.resx @@ -354,8 +354,8 @@ Changing the declaration scope of a captured variable '{0}' requires restarting the application. - - Adding {0} into a {1} requires restarting the application. + + Adding or moving {0} of {1} requires restarting the application. Adding {0} into an interface requires restarting the application. @@ -363,11 +363,11 @@ Adding {0} into an interface method requires restarting the application. - - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. + + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. - - Adding {0} into a COM interface requires restarting the application. + + Adding or moving {0} of a COM interface requires restarting the application. Updating the modifiers of {0} requires restarting the application. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf index 88fcf541e3fb7..6d5ff35646bc1 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf @@ -85,21 +85,6 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Přidání {0} kolem aktivního příkazu vyžaduje restartování aplikace. - - Adding {0} into a {1} requires restarting the application. - Přidání {0} do {1} vyžaduje restartování aplikace. - - - - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - - - - Adding {0} into a COM interface requires restarting the application. - Adding {0} into a COM interface requires restarting the application. - - Adding {0} into an interface method requires restarting the application. Přidání {0} do metody rozhraní vyžaduje restartování aplikace. @@ -160,6 +145,21 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Přidání importované metody vyžaduje restartování aplikace. + + Adding or moving {0} of {1} requires restarting the application. + Adding or moving {0} of {1} requires restarting the application. + + + + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + + + + Adding or moving {0} of a COM interface requires restarting the application. + Adding or moving {0} of a COM interface requires restarting the application. + + Align wrapped arguments Zarovnat zalomené argumenty diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf index fb9e489304612..629f3bd716de5 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf @@ -85,21 +85,6 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Das Hinzufügen von {0} um eine aktive Anweisung erfordert einen Neustart der Anwendung. - - Adding {0} into a {1} requires restarting the application. - Das Hinzufügen von {0} zu einer {1} erfordert einen Neustart der Anwendung. - - - - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - - - - Adding {0} into a COM interface requires restarting the application. - Adding {0} into a COM interface requires restarting the application. - - Adding {0} into an interface method requires restarting the application. Das Hinzufügen von {0} zu einer Schnittstellenmethode erfordert einen Neustart der Anwendung. @@ -160,6 +145,21 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Das Hinzufügen einer importierten Methode erfordert einen Neustart der Anwendung. + + Adding or moving {0} of {1} requires restarting the application. + Adding or moving {0} of {1} requires restarting the application. + + + + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + + + + Adding or moving {0} of a COM interface requires restarting the application. + Adding or moving {0} of a COM interface requires restarting the application. + + Align wrapped arguments Umschlossene Argumente ausrichten diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf index 6b377b2634e2f..537e6450a05da 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf @@ -85,21 +85,6 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Para agregar {0} alrededor de una instrucción de acción es necesario reiniciar la aplicación. - - Adding {0} into a {1} requires restarting the application. - Para agregar {0} a un {1} es necesario reiniciar la aplicación. - - - - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - - - - Adding {0} into a COM interface requires restarting the application. - Adding {0} into a COM interface requires restarting the application. - - Adding {0} into an interface method requires restarting the application. Para agregar {0} en un método de interfaz es necesario reiniciar la aplicación. @@ -160,6 +145,21 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Para agregar un método importado es necesario reiniciar la aplicación. + + Adding or moving {0} of {1} requires restarting the application. + Adding or moving {0} of {1} requires restarting the application. + + + + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + + + + Adding or moving {0} of a COM interface requires restarting the application. + Adding or moving {0} of a COM interface requires restarting the application. + + Align wrapped arguments Alinear argumentos ajustados diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf index 2c4cdb9a7f15f..5e82649d6c567 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf @@ -85,21 +85,6 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai L’ajout de {0} autour d’une instruction active requiert le redémarrage de l’application. - - Adding {0} into a {1} requires restarting the application. - L’ajout de {0} dans un {1} requiert le redémarrage de l’application. - - - - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - - - - Adding {0} into a COM interface requires restarting the application. - Adding {0} into a COM interface requires restarting the application. - - Adding {0} into an interface method requires restarting the application. L’ajout de {0} dans une méthode d’interface requiert le redémarrage de l’application. @@ -160,6 +145,21 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai L’ajout d’une méthode importée requiert le redémarrage de l’application. + + Adding or moving {0} of {1} requires restarting the application. + Adding or moving {0} of {1} requires restarting the application. + + + + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + + + + Adding or moving {0} of a COM interface requires restarting the application. + Adding or moving {0} of a COM interface requires restarting the application. + + Align wrapped arguments Aligner les arguments enveloppés diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf index 886c6588d33e5..eea20830b2f53 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf @@ -85,21 +85,6 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Se si aggiunge {0} all'inizio di un'istruzione attiva, è necessario riavviare l'applicazione. - - Adding {0} into a {1} requires restarting the application. - Se si aggiunge {0} in un elemento {1}, è necessario riavviare l'applicazione. - - - - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - - - - Adding {0} into a COM interface requires restarting the application. - Adding {0} into a COM interface requires restarting the application. - - Adding {0} into an interface method requires restarting the application. Se si aggiunge {0} in un metodo di interfaccia, è necessario riavviare l'applicazione. @@ -160,6 +145,21 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Se si aggiunge un metodo importato, è necessario riavviare l'applicazione. + + Adding or moving {0} of {1} requires restarting the application. + Adding or moving {0} of {1} requires restarting the application. + + + + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + + + + Adding or moving {0} of a COM interface requires restarting the application. + Adding or moving {0} of a COM interface requires restarting the application. + + Align wrapped arguments Allinea gli argomenti con ritorno a capo diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf index 265447db2e607..b2b6d1c525950 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf @@ -85,21 +85,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma アクティブ ステートメントの前後に {0} を追加するには、アプリケーションを再起動する必要があります。 - - Adding {0} into a {1} requires restarting the application. - {0} を {1} に追加するには、アプリケーションを再起動する必要があります。 - - - - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - - - - Adding {0} into a COM interface requires restarting the application. - Adding {0} into a COM interface requires restarting the application. - - Adding {0} into an interface method requires restarting the application. インターフェイス メソッドに {0} を追加するには、アプリケーションを再起動する必要があります。 @@ -160,6 +145,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma インポートされたメソッドを追加するには、アプリケーションを再起動する必要があります。 + + Adding or moving {0} of {1} requires restarting the application. + Adding or moving {0} of {1} requires restarting the application. + + + + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + + + + Adding or moving {0} of a COM interface requires restarting the application. + Adding or moving {0} of a COM interface requires restarting the application. + + Align wrapped arguments 折り返された引数を揃える diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf index fac7356ca2c8c..0b86c7964130d 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf @@ -85,21 +85,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 활성 문 주위에 {0}을(를) 추가하려면 응용 프로그램을 다시 시작해야 합니다. - - Adding {0} into a {1} requires restarting the application. - {0}을(를) {1}에 추가하려면 응용 프로그램을 다시 시작해야 합니다. - - - - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - - - - Adding {0} into a COM interface requires restarting the application. - Adding {0} into a COM interface requires restarting the application. - - Adding {0} into an interface method requires restarting the application. 인터페이스 메소드에 {0}을(를) 추가하려면 응용 프로그램을 다시 시작해야 합니다. @@ -160,6 +145,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 가져온 메서드를 추가하려면 응용 프로그램을 다시 시작해야 합니다. + + Adding or moving {0} of {1} requires restarting the application. + Adding or moving {0} of {1} requires restarting the application. + + + + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + + + + Adding or moving {0} of a COM interface requires restarting the application. + Adding or moving {0} of a COM interface requires restarting the application. + + Align wrapped arguments 래핑된 인수 맞춤 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf index 9d16104a5a2e6..3a6171d0724ba 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf @@ -85,21 +85,6 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Dodawanie elementu {0} wokół aktywnej instrukcji wymaga ponownego uruchomienia aplikacji. - - Adding {0} into a {1} requires restarting the application. - Dodanie elementu {0} do {1} wymaga ponownego uruchomienia aplikacji. - - - - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - - - - Adding {0} into a COM interface requires restarting the application. - Adding {0} into a COM interface requires restarting the application. - - Adding {0} into an interface method requires restarting the application. Dodanie elementu {0} do metody interfejsu wymaga ponownego uruchomienia aplikacji. @@ -160,6 +145,21 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Dodawanie zaimportowanej metody wymaga ponownego uruchomienia aplikacji. + + Adding or moving {0} of {1} requires restarting the application. + Adding or moving {0} of {1} requires restarting the application. + + + + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + + + + Adding or moving {0} of a COM interface requires restarting the application. + Adding or moving {0} of a COM interface requires restarting the application. + + Align wrapped arguments Wyrównaj zawinięte argumenty diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf index 9169a9e73dda2..485674c3f38b2 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf @@ -85,21 +85,6 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Adicionar {0} em torno de uma instrução ativa requer a reinicialização do aplicativo. - - Adding {0} into a {1} requires restarting the application. - Adicionar {0} a um {1} requer a reinicialização do aplicativo. - - - - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - - - - Adding {0} into a COM interface requires restarting the application. - Adding {0} into a COM interface requires restarting the application. - - Adding {0} into an interface method requires restarting the application. Adicionar {0} a um método de interface requer a reinicialização do aplicativo. @@ -160,6 +145,21 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Adicionar um método importado requer a reinicialização do aplicativo. + + Adding or moving {0} of {1} requires restarting the application. + Adding or moving {0} of {1} requires restarting the application. + + + + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + + + + Adding or moving {0} of a COM interface requires restarting the application. + Adding or moving {0} of a COM interface requires restarting the application. + + Align wrapped arguments Alinhar argumentos encapsulados diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf index 2b2f1fc57ceef..55784a9884a61 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf @@ -85,21 +85,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Для добавления {0} вокруг активного оператора требуется перезапустить приложение. - - Adding {0} into a {1} requires restarting the application. - Для добавления {0} в {1} требуется перезапустить приложение. - - - - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - - - - Adding {0} into a COM interface requires restarting the application. - Adding {0} into a COM interface requires restarting the application. - - Adding {0} into an interface method requires restarting the application. Для добавления {0} в метод интерфейса требуется перезапустить приложение. @@ -160,6 +145,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Для добавления импортированного метода требуется перезапустить приложение. + + Adding or moving {0} of {1} requires restarting the application. + Adding or moving {0} of {1} requires restarting the application. + + + + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + + + + Adding or moving {0} of a COM interface requires restarting the application. + Adding or moving {0} of a COM interface requires restarting the application. + + Align wrapped arguments Выровнять свернутые аргументы diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf index d1043807f5b0f..341cad8c9612e 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf @@ -85,21 +85,6 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Etkin bir deyim etrafında bir {0} öğesinin eklenmesi, uygulamanın yeniden başlatılmasını gerektirir. - - Adding {0} into a {1} requires restarting the application. - {1} öğesine {0} eklemek, uygulamanın yeniden başlatılmasını gerektir. - - - - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - - - - Adding {0} into a COM interface requires restarting the application. - Adding {0} into a COM interface requires restarting the application. - - Adding {0} into an interface method requires restarting the application. Bir arabirim yöntemine {0} eklemek, uygulamanın yeniden başlatılmasını gerektirir. @@ -160,6 +145,21 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be İçeri aktarılan bir yöntemin eklenmesi uygulamanın yeniden başlatılmasını gerektiriyor. + + Adding or moving {0} of {1} requires restarting the application. + Adding or moving {0} of {1} requires restarting the application. + + + + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + + + + Adding or moving {0} of a COM interface requires restarting the application. + Adding or moving {0} of a COM interface requires restarting the application. + + Align wrapped arguments Sarmalanan bağımsız değişkenleri hizala diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf index 17dfe80fde467..d6d2e9484094c 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf @@ -85,21 +85,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 在活动语句周围添加 {0} 需要重新启动应用程序。 - - Adding {0} into a {1} requires restarting the application. - 将 {0} 添加进 {1} 中需要重新启动应用程序。 - - - - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - - - - Adding {0} into a COM interface requires restarting the application. - Adding {0} into a COM interface requires restarting the application. - - Adding {0} into an interface method requires restarting the application. 将 {0} 添加到接口方法中需要重新启动应用程序。 @@ -160,6 +145,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 添加导入的方法需要重新启动应用程序。 + + Adding or moving {0} of {1} requires restarting the application. + Adding or moving {0} of {1} requires restarting the application. + + + + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + + + + Adding or moving {0} of a COM interface requires restarting the application. + Adding or moving {0} of a COM interface requires restarting the application. + + Align wrapped arguments 对齐包装的参数 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf index 252bbc8b28a05..dc59a28d9a7ee 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf @@ -85,21 +85,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 新增作用中陳述式前後的 {0} 需要重新啟動應用程式。 - - Adding {0} into a {1} requires restarting the application. - 新增 {0} 到 {1} 需要重新啟動應用程式。 - - - - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - Adding {0} into a {1} with explicit or sequential layout requires restarting the application. - - - - Adding {0} into a COM interface requires restarting the application. - Adding {0} into a COM interface requires restarting the application. - - Adding {0} into an interface method requires restarting the application. 在介面方法中新增 {0} 需要重新啟動應用程式。 @@ -160,6 +145,21 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 新增匯入的方法需要重新啟動應用程式。 + + Adding or moving {0} of {1} requires restarting the application. + Adding or moving {0} of {1} requires restarting the application. + + + + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + Adding or moving {0} of {1} with explicit or sequential layout requires restarting the application. + + + + Adding or moving {0} of a COM interface requires restarting the application. + Adding or moving {0} of a COM interface requires restarting the application. + + Align wrapped arguments 對齊包裝的引數 diff --git a/src/Features/Test/EditAndContinue/RudeEditDiagnosticTests.cs b/src/Features/Test/EditAndContinue/RudeEditDiagnosticTests.cs index c5fdc1551a471..0bfa5459fcf9b 100644 --- a/src/Features/Test/EditAndContinue/RudeEditDiagnosticTests.cs +++ b/src/Features/Test/EditAndContinue/RudeEditDiagnosticTests.cs @@ -55,8 +55,8 @@ public void ToDiagnostic() var arg2 = new HashSet() { - RudeEditKind.InsertIntoStruct, - RudeEditKind.InsertIntoStruct, + RudeEditKind.InsertOrMoveStructMember, + RudeEditKind.InsertOrMoveStructMember, RudeEditKind.ChangingCapturedVariableType, RudeEditKind.RenamingCapturedVariable, RudeEditKind.ChangingStateMachineShape, diff --git a/src/Features/VisualBasic/Portable/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb b/src/Features/VisualBasic/Portable/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb index 7a5561da05c6c..5b72758a44be3 100644 --- a/src/Features/VisualBasic/Portable/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb +++ b/src/Features/VisualBasic/Portable/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb @@ -915,7 +915,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue Case SyntaxKind.FieldDeclaration ' Attribute or modifier update - If editKind = EditKind.Update Then + If editKind = EditKind.Update OrElse editKind = EditKind.Reorder Then Dim field = CType(node, FieldDeclarationSyntax) If field.Declarators.Count = 1 AndAlso field.Declarators(0).Names.Count = 1 Then node = field.Declarators(0).Names(0) @@ -1798,40 +1798,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue Private Sub ClassifyReorder(oldNode As SyntaxNode, newNode As SyntaxNode) Select Case newNode.Kind - Case SyntaxKind.OptionStatement, - SyntaxKind.ImportsStatement, - SyntaxKind.AttributesStatement, - SyntaxKind.NamespaceBlock, - SyntaxKind.ClassBlock, - SyntaxKind.StructureBlock, - SyntaxKind.InterfaceBlock, - SyntaxKind.ModuleBlock, - SyntaxKind.EnumBlock, - SyntaxKind.DelegateFunctionStatement, - SyntaxKind.DelegateSubStatement, - SyntaxKind.SubBlock, - SyntaxKind.FunctionBlock, - SyntaxKind.DeclareSubStatement, - SyntaxKind.DeclareFunctionStatement, - SyntaxKind.ConstructorBlock, - SyntaxKind.OperatorBlock, - SyntaxKind.PropertyBlock, - SyntaxKind.EventBlock, - SyntaxKind.GetAccessorBlock, - SyntaxKind.SetAccessorBlock, - SyntaxKind.AddHandlerAccessorBlock, - SyntaxKind.RemoveHandlerAccessorBlock, - SyntaxKind.RaiseEventAccessorBlock, - SyntaxKind.ClassConstraint, - SyntaxKind.StructureConstraint, - SyntaxKind.NewConstraint, - SyntaxKind.TypeConstraint, - SyntaxKind.AttributeList, - SyntaxKind.Attribute, - SyntaxKind.Parameter - ' We'll ignore these edits. A general policy is to ignore edits that are only discoverable via reflection. - Return - Case SyntaxKind.EnumMemberDeclaration ' To allow this change we would need to check that values of all fields of the enum ' are preserved, or make sure we can update all method bodies that accessed those that changed. @@ -1847,9 +1813,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue ' Identifier can be moved within the same type declaration. ' Determine validity of such change in semantic analysis. Return - - Case Else - Throw ExceptionUtilities.UnexpectedValue(newNode.Kind) End Select End Sub diff --git a/src/Features/VisualBasicTest/EditAndContinue/TopLevelEditingTests.vb b/src/Features/VisualBasicTest/EditAndContinue/TopLevelEditingTests.vb index 26c40b88f58b0..2a7b0c8682d6a 100644 --- a/src/Features/VisualBasicTest/EditAndContinue/TopLevelEditingTests.vb +++ b/src/Features/VisualBasicTest/EditAndContinue/TopLevelEditingTests.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports Microsoft.CodeAnalysis.Differencing Imports Microsoft.CodeAnalysis.EditAndContinue Imports Microsoft.CodeAnalysis.EditAndContinue.UnitTests Imports Microsoft.CodeAnalysis.Emit @@ -5090,28 +5091,114 @@ Imports System.Runtime.InteropServices End Sub - Public Sub Method_Reorder1() - Dim src1 = "Class C : " & vbLf & "Sub f(a As Integer, b As Integer)" & vbLf & "a = b : End Sub : " & vbLf & "Sub g() : End Sub : End Class" - Dim src2 = "Class C : " & vbLf & "Sub g() : End Sub : " & vbLf & "Sub f(a As Integer, b As Integer)" & vbLf & "a = b : End Sub : End Class" + Public Sub Method_Reorder() + Dim src1 = " +Class C + + + Sub F() + End Sub + Sub G() + End Sub + Sub H() + End Sub +End Class +" + + Dim src2 = " +class C + Sub H() + End Sub + Sub F() + End Sub + Sub G() + End Sub + + +End Class +" + Dim edits = GetTopEdits(src1, src2) - edits.VerifyEdits( - "Reorder [Sub g() : End Sub]@64 -> @11") + edits.VerifyEdits(EditKind.Reorder) - edits.VerifySemantics({SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember(Of NamedTypeSymbol)("C").GetMember("g"))}) + edits.VerifySemantics({SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("C.H"))}) End Sub - Public Sub InterfaceMethod_Reorder1() - Dim src1 = "Interface I : " & vbLf & "Sub f(a As Integer, b As Integer)" & vbLf & "Sub g() : End Interface" - Dim src2 = "Interface I : " & vbLf & "Sub g() : " & vbLf & "Sub f(a As Integer, b As Integer) : End Interface" + Public Sub Method_Reorder_Interface() + Dim src1 = " +Interface I + Sub F() + Sub G() + Sub H() +End Interface +" + Dim src2 = " +Interface I + Sub H() + Sub F() + Sub G() +End Interface +" Dim edits = GetTopEdits(src1, src2) + edits.VerifyEdits(EditKind.Reorder) + edits.VerifySemantics({SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember("I.H"))}) + End Sub - edits.VerifyEdits( - "Reorder [Sub g()]@49 -> @15") + + Public Sub Method_Reorder_Interface_ComImport() + Dim src1 = " +Imports System.Runtime.InteropServices + + +Interface I + Sub F() + Sub G() + Sub H() +End Interface +" + Dim src2 = " +Imports System.Runtime.InteropServices + + + +Interface I + Sub H() + Sub F() + Sub G() +End Interface +" + Dim edits = GetTopEdits(src1, src2) + edits.VerifyEdits(EditKind.Reorder) + edits.VerifySemanticDiagnostics( + Diagnostic(RudeEditKind.InsertOrMoveComInterfaceMember, "Sub H()", GetResource("method"))) + End Sub + + + Public Sub Method_Insert_Interface_ComImport() + Dim src1 = " +Imports System.Runtime.InteropServices + + + +Interface I +End Interface +" + Dim src2 = " +Imports System.Runtime.InteropServices + + + +Interface I + Sub F() +End Interface +" + Dim edits = GetTopEdits(src1, src2) edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.Move, "Sub g()", FeaturesResources.method)) + Diagnostic(RudeEditKind.InsertVirtual, "Sub F()", GetResource("method")), + Diagnostic(RudeEditKind.InsertOrMoveComInterfaceMember, "Sub F()", GetResource("method"))) End Sub @@ -7606,6 +7693,29 @@ End Class Public Sub Field_Reorder1() + Dim src1 = " +Class C + + Dim a = 0 + Dim b = 1 + Dim c +End Class" + Dim src2 = " +Class C + Dim c + Dim a = 0 + Dim b = 1 + +End Class" + Dim edits = GetTopEdits(src1, src2) + + edits.VerifyEdits(EditKind.Reorder) + + edits.VerifySemantics() + End Sub + + + Public Sub Field_Reorder2() Dim src1 = "Class C : Dim a As Object, b As Object : End Class" Dim src2 = "Class C : Dim b As Object, a As Object : End Class" Dim edits = GetTopEdits(src1, src2) @@ -7617,7 +7727,7 @@ End Class End Sub - Public Sub Field_Reorder2() + Public Sub Field_Reorder3() Dim src1 = "Class C : Dim a As Object, b, c As Object : End Class" Dim src2 = "Class C : Dim b, c As Object, a As Object : End Class" Dim edits = GetTopEdits(src1, src2) @@ -7629,22 +7739,144 @@ End Class End Sub - Public Sub Field_Reorder_WithInitializers() - Dim src1 = "Class C : Dim a = 0 : Dim b = 1 : Dim c = 2 : End Class" - Dim src2 = "Class C : Dim c = 2 : Dim a = 0 : Dim b = 1 : End Class" + Public Sub Field_Reorder_WithInitializer() + Dim src1 = " +Class C + + Dim a = 0 + Dim b = 1 + Dim c = 2 +End Class" + Dim src2 = " +Class C + Dim c = 2 + Dim a = 0 + Dim b = 1 + +End Class" Dim edits = GetTopEdits(src1, src2) + edits.VerifyEdits(EditKind.Reorder) + + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember(Of NamedTypeSymbol)("C").InstanceConstructors.Single(), preserveLocalVariables:=True)) + End Sub + + + Public Sub Field_Reorder_WithEvents() + Dim src1 = " +Class C + + Dim a As Integer = 0 + Dim b As Integer = 1 + Dim WithEvents WE As Object +End Class" + Dim src2 = " +Class C + Dim WithEvents WE As Object + Dim a As Integer = 0 + Dim b As Integer = 1 + +End Class" + Dim edits = GetTopEdits(src1, src2) + + edits.VerifyEdits(EditKind.Reorder) + edits.VerifySemantics() End Sub - Public Sub EventFieldReorder() - Dim src1 = "Class C : Dim a As Integer = 0 : Dim b As Integer = 1 : Event c As Action : End Class" - Dim src2 = "Class C : Event c As Action : Dim a As Integer = 0 : Dim b As Integer = 1 : End Class" + Friend Sub Field_Reorder_WithEvents_TypeLayout1() + Dim src1 = " +Imports System.Runtime.InteropServices + +Class C + Dim a As Integer + Dim WithEvents WE As Object +End Class" + + Dim src2 = " +Imports System.Runtime.InteropServices + +Class C + Dim WithEvents WE As Object + Dim a As Integer +End Class" + Dim edits = GetTopEdits(src1, src2) + edits.VerifyEdits(EditKind.Reorder) + edits.VerifySemanticDiagnostics( + Diagnostic(RudeEditKind.InsertOrMoveTypeWithLayoutMember, "Dim WithEvents WE As Object", GetResource("WithEvents field"), GetResource("class"))) + End Sub - edits.VerifyEdits( - "Reorder [Event c As Action]@56 -> @10") + + Friend Sub Field_Reorder_WithEvents_TypeLayout2() + Dim src1 = " +Imports System.Runtime.InteropServices + +Class C + Dim WithEvents WE1, WE2 As Object +End Class" + + Dim src2 = " +Imports System.Runtime.InteropServices + +Class C + Dim WithEvents WE2, WE1 As Object +End Class" + + Dim edits = GetTopEdits(src1, src2) + edits.VerifyEdits(EditKind.Reorder) + edits.VerifySemanticDiagnostics( + Diagnostic(RudeEditKind.InsertOrMoveTypeWithLayoutMember, "WE2", GetResource("WithEvents field"), GetResource("class"))) + End Sub + + + Public Sub Field_Reorder_Reloadable() + Dim src1 = ReloadableAttributeSrc & " + +Structure C + + Dim a = 0 + Dim b = 1 + Dim c +End Structure" + Dim src2 = ReloadableAttributeSrc & " + +Structure C + Dim c + Dim a = 0 + Dim b = 1 + +End Structure" + Dim edits = GetTopEdits(src1, src2) + + edits.VerifyEdits(EditKind.Reorder) + + edits.VerifySemantics( + {SemanticEdit(SemanticEditKind.Replace, Function(c) c.GetMember("C"))}, + capabilities:=EditAndContinueCapabilities.NewTypeDefinition) + End Sub + + + Public Sub EventField_Reorder() + Dim src1 = " +Class C + + Dim a As Integer = 0 + Dim b As Integer = 1 + Event c As Action +End Class" + Dim src2 = " +Class C + Event c As Action + Dim a As Integer = 0 + Dim b As Integer = 1 + +End Class" + Dim edits = GetTopEdits(src1, src2) + + edits.VerifyEdits(EditKind.Reorder) edits.VerifySemantics() End Sub @@ -7872,7 +8104,7 @@ End Class End Sub - Public Sub FieldInsert_WithEvents1() + Public Sub Field_Insert_WithEvents() Dim src1 = "Class C : End Class" Dim src2 = "Class C : WithEvents F As C : End Class" Dim edits = GetTopEdits(src1, src2) @@ -7882,7 +8114,7 @@ End Class End Sub - Public Sub FieldInsert_WithEvents2() + Public Sub Field_Insert_WithEvents2() Dim src1 = "Class C : WithEvents F As C : End Class" Dim src2 = "Class C : WithEvents F, G As C : End Class" Dim edits = GetTopEdits(src1, src2) @@ -7892,7 +8124,7 @@ End Class End Sub - Public Sub FieldInsert_WithEvents3() + Public Sub Field_Insert_WithEvents3() Dim src1 = "Class C : WithEvents F As C : End Class" Dim src2 = "Class C : WithEvents F As C, G As C : End Class" Dim edits = GetTopEdits(src1, src2) @@ -7902,25 +8134,23 @@ End Class End Sub - Public Sub FieldInsert_IntoStruct() + Public Sub Field_Insert_IntoStruct() Dim src1 = "Structure S : Private a As Integer : End Structure" Dim src2 = " Structure S Private a As Integer Private b As Integer - Private Shared c As Integer Private Event d As System.Action End Structure " Dim edits = GetTopEdits(src1, src2) edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoStruct, "Private Event d", GetResource("event"), GetResource("structure")), - Diagnostic(RudeEditKind.InsertIntoStruct, "b As Integer", GetResource("field"), GetResource("structure")), - Diagnostic(RudeEditKind.InsertIntoStruct, "c As Integer", GetResource("field"), GetResource("structure"))) + Diagnostic(RudeEditKind.InsertOrMoveStructMember, "Private Event d", GetResource("event"), GetResource("structure")), + Diagnostic(RudeEditKind.InsertOrMoveStructMember, "b As Integer", GetResource("field"), GetResource("structure"))) End Sub - Public Sub FieldInsert_IntoLayoutClass_Auto() + Public Sub Field_Insert_IntoLayoutClass_Auto() Dim src1 = " Imports System.Runtime.InteropServices @@ -7981,9 +8211,8 @@ End Class Dim edits = GetTopEdits(src1, src2) edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "b As Integer", FeaturesResources.field, FeaturesResources.class_), - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "c As Integer", FeaturesResources.field, FeaturesResources.class_), - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "d As Integer", FeaturesResources.field, FeaturesResources.class_)) + Diagnostic(RudeEditKind.InsertOrMoveTypeWithLayoutMember, "b As Integer", FeaturesResources.field, FeaturesResources.class_), + Diagnostic(RudeEditKind.InsertOrMoveTypeWithLayoutMember, "c As Integer", FeaturesResources.field, FeaturesResources.class_)) End Sub @@ -8011,9 +8240,8 @@ End Class Dim edits = GetTopEdits(src1, src2) edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "b As Integer", FeaturesResources.field, FeaturesResources.class_), - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "c As Integer", FeaturesResources.field, FeaturesResources.class_), - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "d As Integer", FeaturesResources.field, FeaturesResources.class_)) + Diagnostic(RudeEditKind.InsertOrMoveTypeWithLayoutMember, "b As Integer", FeaturesResources.field, FeaturesResources.class_), + Diagnostic(RudeEditKind.InsertOrMoveTypeWithLayoutMember, "c As Integer", FeaturesResources.field, FeaturesResources.class_)) End Sub @@ -8045,7 +8273,7 @@ End Class ' TODO: We don't compare the ordering currently. We could allow this edit if the ordering is preserved. edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "b As Integer", FeaturesResources.field, FeaturesResources.class_)) + Diagnostic(RudeEditKind.InsertOrMoveTypeWithLayoutMember, "b As Integer", FeaturesResources.field, FeaturesResources.class_)) End Sub @@ -8075,7 +8303,7 @@ End Class Dim edits = GetTopEdits(src1, src2) edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "a As Integer", FeaturesResources.field, FeaturesResources.class_)) + Diagnostic(RudeEditKind.InsertOrMoveTypeWithLayoutMember, "a As Integer", FeaturesResources.field, FeaturesResources.class_)) End Sub @@ -8346,36 +8574,173 @@ End Class End Sub - Public Sub PropertyReorder1() - Dim src1 = "Class C : ReadOnly Property P" & vbLf & "Get" & vbLf & "Return 1 : End Get : End Property : " & - "ReadOnly Property Q" & vbLf & "Get" & vbLf & "Return 1 : End Get : End Property : End Class" - Dim src2 = "Class C : ReadOnly Property Q" & vbLf & "Get" & vbLf & "Return 1 : End Get : End Property : " & - "ReadOnly Property P" & vbLf & "Get" & vbLf & "Return 1 : End Get : End Property : End Class" + Public Sub Property_Reorder1() + Dim src1 = " +Class C + ReadOnly Property P + Get + Return 1 + End Get + End Property + ReadOnly Property Q + Get + Return 1 + End Get + End Property +End Class" + Dim src2 = " +Class C + ReadOnly Property Q + Get + Return 1 + End Get + End Property + ReadOnly Property P + Get + Return 1 + End Get + End Property +End Class" Dim edits = GetTopEdits(src1, src2) + edits.VerifyEdits(EditKind.Reorder) + edits.VerifySemantics() + End Sub - edits.VerifyEdits( - "Reorder [ReadOnly Property Q" & vbLf & "Get" & vbLf & "Return 1 : End Get : End Property]@70 -> @10") + + Public Sub Property_Reorder_Auto() + Dim src1 = " +Class C - edits.VerifySemanticDiagnostics() + Property P As Integer = 0 + Property Q As Integer = 1 + Property R As Integer +End Class" + Dim src2 = " +Class C + Property R As Integer + Property P As Integer = 0 + Property Q As Integer = 1 + +End Class" + + Dim edits = GetTopEdits(src1, src2) + edits.VerifyEdits(EditKind.Reorder) + edits.VerifySemantics() End Sub - Public Sub PropertyReorder2() - Dim src1 = "Class C : Property P As Integer : Property Q As Integer : End Class" - Dim src2 = "Class C : Property Q As Integer : Property P As Integer : End Class" + Public Sub Property_Reorder_Auto_WithInitializer() + Dim src1 = " +Class C + + Property P As Integer = 0 + Property Q As Integer = 1 + Property R As Integer = 2 +End Class" + Dim src2 = " +Class C + Property R As Integer = 2 + Property P As Integer = 0 + Property Q As Integer = 1 + +End Class" Dim edits = GetTopEdits(src1, src2) + edits.VerifyEdits(EditKind.Reorder) + edits.VerifySemantics( + SemanticEdit(SemanticEditKind.Update, Function(c) c.GetMember(Of NamedTypeSymbol)("C").InstanceConstructors.Single(), preserveLocalVariables:=True)) + End Sub - edits.VerifyEdits( - "Reorder [Property Q As Integer]@34 -> @10") + + + ", "Class")> + Public Sub Property_Reorder_TypeLayout(attribute As String, keyword As String) + Dim src1 = attribute & keyword & " C + ReadOnly Property Q + Get + Return 1 + End Get + End Property + ReadOnly Property P + Get + Return 1 + End Get + End Property +End " & keyword + + Dim src2 = attribute & keyword & " C + ReadOnly Property P + Get + Return 1 + End Get + End Property + ReadOnly Property Q + Get + Return 1 + End Get + End Property +End " & keyword + + Dim edits = GetTopEdits(src1, src2) + edits.VerifyEdits(EditKind.Reorder) + edits.VerifySemantics() + End Sub + + + + ", "Class", RudeEditKind.InsertOrMoveTypeWithLayoutMember)> + Friend Sub Property_Reorder_Auto_TypeLayout(attribute As String, keyword As String, rudeEditKind As RudeEditKind) + Dim src1 = attribute & keyword & " C + + Property P As Integer = 0 + Property Q As Integer = 1 + Property R As Integer = 2 +End " & keyword + + Dim src2 = attribute & keyword & " C + Property R As Integer = 2 + Property P As Integer = 0 + Property Q As Integer = 1 + +End " & keyword + + Dim edits = GetTopEdits(src1, src2) + edits.VerifyEdits(EditKind.Reorder) edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.Move, "Property Q", FeaturesResources.auto_property)) + Diagnostic(rudeEditKind, "Property R", GetResource("auto-property"), GetResource(keyword))) + End Sub + + + Friend Sub Property_Reorder_Auto_Reloadable() + Dim src1 = ReloadableAttributeSrc & " + +Structure C + Property P As Integer = 0 + Property Q As Integer = 1 + Property R As Integer +End Structure" + + Dim src2 = ReloadableAttributeSrc & " + +Structure C + Property R As Integer + Property P As Integer = 0 + Property Q As Integer = 1 + +End Structure" + + Dim edits = GetTopEdits(src1, src2) + edits.VerifyEdits(EditKind.Reorder) + + edits.VerifySemantics( + {SemanticEdit(SemanticEditKind.Replace, Function(c) c.GetMember(Of NamedTypeSymbol)("C"))}, + capabilities:=EditAndContinueCapabilities.NewTypeDefinition) End Sub - Public Sub PropertyAccessorReorder() + Public Sub PropertyAccessor_Reorder() Dim src1 = "Class C : Property P As Integer" & vbLf & "Get" & vbLf & "Return 1 : End Get" & vbLf & "Set : End Set : End Property : End Class" Dim src2 = "Class C : Property P As Integer" & vbLf & "Set : End Set" & vbLf & "Get" & vbLf & "Return 1 : End Get : End Property : End Class" Dim edits = GetTopEdits(src1, src2) @@ -8387,7 +8752,7 @@ End Class End Sub - Public Sub PropertyTypeUpdate() + Public Sub Property_Update_Type() Dim src1 = "Class C : Property P As Integer : End Class" Dim src2 = "Class C : Property P As Char : End Class" Dim edits = GetTopEdits(src1, src2) @@ -8409,7 +8774,7 @@ End Class End Sub - Public Sub PropertyInsert() + Public Sub Property_Insert() Dim src1 = "Class C : End Class" Dim src2 = " Class C @@ -8570,7 +8935,7 @@ End Class" End Sub - Public Sub PropertyRename1() + Public Sub Property_Rename1() Dim src1 = "Class C : ReadOnly Property P As Integer" & vbLf & "Get : End Get : End Property : End Class" Dim src2 = "Class C : ReadOnly Property Q As Integer" & vbLf & "Get : End Get : End Property : End Class" Dim edits = GetTopEdits(src1, src2) @@ -8590,7 +8955,7 @@ End Class" End Sub - Public Sub PropertyRename2() + Public Sub Property_Rename2() Dim src1 = "Class C : ReadOnly Property P As Integer : End Class" Dim src2 = "Class C : ReadOnly Property Q As Integer : End Class" Dim edits = GetTopEdits(src1, src2) @@ -8609,14 +8974,15 @@ End Class" capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.AddInstanceFieldToExistingType) End Sub - - Public Sub PropertyInsert_IntoStruct() - Dim src1 = "Structure S : Private a As Integer : End Structure" - Dim src2 = " -Structure S - Private a As Integer + + + ", "Class", RudeEditKind.InsertOrMoveTypeWithLayoutMember)> + Friend Sub Property_Insert_TypeLayout(attribute As String, type As String, rudeEditKind As RudeEditKind) + Dim src1 = attribute & type & " S +End " & type + + Dim src2 = attribute & type & " S Private Property b As Integer - Private Shared Property c As Integer Private Property d As Integer Get @@ -8627,15 +8993,6 @@ Structure S End Set End Property - Private Shared Property e As Integer - Get - Return 0 - End Get - - Set - End Set - End Property - Private ReadOnly Property f As Integer Get Return 0 @@ -8646,46 +9003,24 @@ Structure S Set End Set End Property - - Private Shared ReadOnly Property h As Integer - Get - Return 0 - End Get - End Property - - Private Shared WriteOnly Property i As Integer - Set - End Set - End Property -End Structure" +End " & type Dim edits = GetTopEdits(src1, src2) edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoStruct, "Private Property b", GetResource("auto-property"), GetResource("structure")), - Diagnostic(RudeEditKind.InsertIntoStruct, "Private Shared Property c", GetResource("auto-property"), GetResource("structure"))) + Diagnostic(rudeEditKind, "Private Property b", GetResource("auto-property"), GetResource(type))) End Sub - - Public Sub PropertyInsert_IntoLayoutClass_Sequential() - Dim src1 = " -Imports System.Runtime.InteropServices - - -Class C - Private a As Integer -End Class -" - - Dim src2 = " -Imports System.Runtime.InteropServices + + + ", "Class")> + Friend Sub Property_Insert_TypeLayout_Shared(attribute As String, type As String) + Dim src1 = attribute & type & " S +End " & type - -Class C - Private a As Integer - Private Property b As Integer + Dim src2 = attribute & type & " S Private Shared Property c As Integer - Private Property d As Integer + Private Shared Property e As Integer Get Return 0 End Get @@ -8694,20 +9029,25 @@ Class C End Set End Property - Private Shared Property e As Integer + Private Shared ReadOnly Property h As Integer Get Return 0 End Get + End Property + Private Shared WriteOnly Property i As Integer Set End Set End Property -End Class -" +End " & type Dim edits = GetTopEdits(src1, src2) - edits.VerifySemanticDiagnostics( - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "Private Property b", GetResource("auto-property"), GetResource("class")), - Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "Private Shared Property c", GetResource("auto-property"), GetResource("class"))) + + edits.VerifySemantics( + {SemanticEdit(SemanticEditKind.Insert, Function(c) c.GetMember("S.c")), + SemanticEdit(SemanticEditKind.Insert, Function(c) c.GetMember("S.e")), + SemanticEdit(SemanticEditKind.Insert, Function(c) c.GetMember("S.h")), + SemanticEdit(SemanticEditKind.Insert, Function(c) c.GetMember("S.i"))}, + capabilities:=EditAndContinueCapabilities.AddMethodToExistingType Or EditAndContinueCapabilities.AddStaticFieldToExistingType) End Sub @@ -9635,7 +9975,7 @@ End Class - Public Sub Field_Insert(modifiers As String) + Public Sub Field_Insert_Accessibility(modifiers As String) Dim src1 = "Class C : End Class" Dim src2 = "Class C : " & modifiers & " a As Integer = 1 : End Class" Dim edits = GetTopEdits(src1, src2) @@ -9656,7 +9996,7 @@ End Class - Public Sub Property_Insert(accessibility As String) + Public Sub Property_Insert_Accessibility(accessibility As String) Dim src1 = "Class C : End Class" Dim src2 = "Class C : " & accessibility & " Property a As Integer = 1 : End Class" Dim edits = GetTopEdits(src1, src2)