From fc4a61586e2773f4b9836c60d01a19229a290e3c Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Fri, 29 Jul 2016 16:29:33 -0700 Subject: [PATCH] Obsolete `EditorHints`. - For tests added grouped pragma warning disables to not pollute the test files with too many duplicate warning disable/restores. #780 --- src/Microsoft.AspNetCore.Razor/Editor/EditorHints.cs | 3 ++- .../Editor/SpanEditHandler.cs | 10 ++++++++-- .../Editor/AutoCompleteEditHandlerTest.cs | 2 ++ .../Editor/ImplicitExpressionEditHandlerTest.cs | 2 ++ .../Editor/SpanEditHandlerTest.cs | 2 ++ .../Framework/TestSpanBuilder.cs | 2 ++ 6 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.AspNetCore.Razor/Editor/EditorHints.cs b/src/Microsoft.AspNetCore.Razor/Editor/EditorHints.cs index a32b383980..719fa01e54 100644 --- a/src/Microsoft.AspNetCore.Razor/Editor/EditorHints.cs +++ b/src/Microsoft.AspNetCore.Razor/Editor/EditorHints.cs @@ -6,9 +6,10 @@ using System; namespace Microsoft.AspNetCore.Razor.Editor { /// - /// Used within . + /// This class is obsolete and will be removed in a future version. /// [Flags] + [Obsolete("This class is obsolete and will be removed in a future version.")] public enum EditorHints { /// diff --git a/src/Microsoft.AspNetCore.Razor/Editor/SpanEditHandler.cs b/src/Microsoft.AspNetCore.Razor/Editor/SpanEditHandler.cs index b160962caa..c6934f93c9 100644 --- a/src/Microsoft.AspNetCore.Razor/Editor/SpanEditHandler.cs +++ b/src/Microsoft.AspNetCore.Razor/Editor/SpanEditHandler.cs @@ -29,8 +29,9 @@ namespace Microsoft.AspNetCore.Razor.Editor public AcceptedCharacters AcceptedCharacters { get; set; } /// - /// Provides a set of hints to editors which may be manipulating the document in which this span is located. + /// This property is obsolete and will be removed in a future version. /// + [Obsolete("This property is obsolete and will be removed in a future version.")] public EditorHints EditorHints { get; set; } public Func> Tokenizer { get; set; } @@ -158,7 +159,10 @@ namespace Microsoft.AspNetCore.Razor.Editor public override string ToString() { - return GetType().Name + ";Accepts:" + AcceptedCharacters + ((EditorHints == EditorHints.None) ? string.Empty : (";Hints: " + EditorHints.ToString())); + return GetType().Name + ";Accepts:" + AcceptedCharacters + +#pragma warning disable 618 // Ignore obsolete warning for EditorHints + ((EditorHints == EditorHints.None) ? string.Empty : (";Hints: " + EditorHints.ToString())); +#pragma warning restore 618 // Ignore obsolete warning for EditorHints } public override bool Equals(object obj) @@ -167,7 +171,9 @@ namespace Microsoft.AspNetCore.Razor.Editor return other != null && GetType() == other.GetType() && AcceptedCharacters == other.AcceptedCharacters && +#pragma warning disable 618 // Ignore obsolete warning for EditorHints EditorHints == other.EditorHints; +#pragma warning restore 618 // Ignore obsolete warning for EditorHints } public override int GetHashCode() diff --git a/test/Microsoft.AspNetCore.Razor.Test/Editor/AutoCompleteEditHandlerTest.cs b/test/Microsoft.AspNetCore.Razor.Test/Editor/AutoCompleteEditHandlerTest.cs index db1ef775d4..892ec81b3e 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/Editor/AutoCompleteEditHandlerTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/Editor/AutoCompleteEditHandlerTest.cs @@ -10,6 +10,7 @@ namespace Microsoft.AspNetCore.Razor.Editor { public class AutoCompleteEditHandlerTest { +#pragma warning disable 618 // Ignore obsolete warning for EditorHints public static TheoryData MatchingTestDataSet { get @@ -180,6 +181,7 @@ namespace Microsoft.AspNetCore.Razor.Editor }; } } +#pragma warning restore 618 // Ignore obsolete warning for EditorHints [Theory] [MemberData(nameof(MatchingTestDataSet))] diff --git a/test/Microsoft.AspNetCore.Razor.Test/Editor/ImplicitExpressionEditHandlerTest.cs b/test/Microsoft.AspNetCore.Razor.Test/Editor/ImplicitExpressionEditHandlerTest.cs index e8d21445ed..b0cb4dd719 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/Editor/ImplicitExpressionEditHandlerTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/Editor/ImplicitExpressionEditHandlerTest.cs @@ -12,6 +12,7 @@ namespace Microsoft.AspNetCore.Razor.Editor { public class ImplicitExpressionEditHandlerTest { +#pragma warning disable 618 // Ignore obsolete warning for EditorHints public static TheoryData MatchingTestDataSet { get @@ -253,6 +254,7 @@ namespace Microsoft.AspNetCore.Razor.Editor }; } } +#pragma warning restore 618 // Ignore obsolete warning for EditorHints [Theory] [MemberData(nameof(MatchingTestDataSet))] diff --git a/test/Microsoft.AspNetCore.Razor.Test/Editor/SpanEditHandlerTest.cs b/test/Microsoft.AspNetCore.Razor.Test/Editor/SpanEditHandlerTest.cs index 32ecc960b4..eb21188b47 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/Editor/SpanEditHandlerTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/Editor/SpanEditHandlerTest.cs @@ -11,6 +11,7 @@ namespace Microsoft.AspNetCore.Razor.Editor { public class SpanEditHandlerTest { +#pragma warning disable 618 // Ignore obsolete warning for EditorHints public static TheoryData MatchingTestDataSet { get @@ -127,6 +128,7 @@ namespace Microsoft.AspNetCore.Razor.Editor }; } } +#pragma warning restore 618 // Ignore obsolete warning for EditorHints [Theory] [MemberData(nameof(MatchingTestDataSet))] diff --git a/test/Microsoft.AspNetCore.Razor.Test/Framework/TestSpanBuilder.cs b/test/Microsoft.AspNetCore.Razor.Test/Framework/TestSpanBuilder.cs index e97dae18a9..d030149d29 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/Framework/TestSpanBuilder.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/Framework/TestSpanBuilder.cs @@ -269,10 +269,12 @@ namespace Microsoft.AspNetCore.Razor.Test.Framework }); } +#pragma warning disable 618 // Ignore obsolete warning for EditorHints public static SpanConstructor WithEditorHints(this SpanConstructor self, EditorHints hints) { return self.With(eh => eh.EditorHints = hints); } +#pragma warning restore 618 // Ignore obsolete warning for EditorHints } public class UnclassifiedCodeSpanConstructor