From 5982787410f01a8d6b621358175820ddfa8447a1 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 19 Nov 2018 11:36:51 -0600 Subject: [PATCH] Remove OptionGroup --- .../CSharpCodeStyleResources.Designer.cs | 47 ++-------- .../Analyzers/CSharpCodeStyleResources.resx | 17 +--- .../Formatting/CSharpFormattingOptions.cs | 86 +++++++++---------- .../xlf/CSharpCodeStyleResources.cs.xlf | 8 +- .../xlf/CSharpCodeStyleResources.de.xlf | 8 +- .../xlf/CSharpCodeStyleResources.es.xlf | 8 +- .../xlf/CSharpCodeStyleResources.fr.xlf | 8 +- .../xlf/CSharpCodeStyleResources.it.xlf | 8 +- .../xlf/CSharpCodeStyleResources.ja.xlf | 8 +- .../xlf/CSharpCodeStyleResources.ko.xlf | 8 +- .../xlf/CSharpCodeStyleResources.pl.xlf | 8 +- .../xlf/CSharpCodeStyleResources.pt-BR.xlf | 8 +- .../xlf/CSharpCodeStyleResources.ru.xlf | 8 +- .../xlf/CSharpCodeStyleResources.tr.xlf | 8 +- .../xlf/CSharpCodeStyleResources.zh-Hans.xlf | 8 +- .../xlf/CSharpCodeStyleResources.zh-Hant.xlf | 8 +- .../Analyzers/CodeStyleResources.Designer.cs | 18 ---- .../Core/Analyzers/CodeStyleResources.resx | 6 -- .../Analyzers/Formatting/FormattingOptions.cs | 30 +++---- .../Analyzers/Options/IOptionWithGroup.cs | 15 ---- .../Core/Analyzers/Options/OptionGroup.cs | 30 ------- .../Core/Analyzers/Options/Option`1.cs | 21 +---- .../Analyzers/Options/PerLanguageOption`1.cs | 21 +---- 23 files changed, 153 insertions(+), 242 deletions(-) delete mode 100644 src/CodeStyle/Core/Analyzers/Options/IOptionWithGroup.cs delete mode 100644 src/CodeStyle/Core/Analyzers/Options/OptionGroup.cs diff --git a/src/CodeStyle/CSharp/Analyzers/CSharpCodeStyleResources.Designer.cs b/src/CodeStyle/CSharp/Analyzers/CSharpCodeStyleResources.Designer.cs index 2d32956ccf8..fd966821709 100644 --- a/src/CodeStyle/CSharp/Analyzers/CSharpCodeStyleResources.Designer.cs +++ b/src/CodeStyle/CSharp/Analyzers/CSharpCodeStyleResources.Designer.cs @@ -10,6 +10,7 @@ namespace Microsoft.CodeAnalysis.CSharp { using System; + using System.Reflection; /// @@ -19,7 +20,7 @@ namespace Microsoft.CodeAnalysis.CSharp { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class CSharpCodeStyleResources { @@ -39,7 +40,7 @@ internal class CSharpCodeStyleResources { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.CodeAnalysis.CSharp.CSharpCodeStyleResources", typeof(CSharpCodeStyleResources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.CodeAnalysis.CSharp.CSharpCodeStyleResources", typeof(CSharpCodeStyleResources).GetTypeInfo().Assembly); resourceMan = temp; } return resourceMan; @@ -61,47 +62,11 @@ internal class CSharpCodeStyleResources { } /// - /// Looks up a localized string similar to . + /// Looks up a localized string similar to Remove this value when another is added.. /// - internal static string Expected_string_or_char_literal { + internal static string EmptyResource { get { - return ResourceManager.GetString("Expected_string_or_char_literal", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to . - /// - internal static string Indentation_preferences { - get { - return ResourceManager.GetString("Indentation_preferences", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to . - /// - internal static string New_line_preferences { - get { - return ResourceManager.GetString("New_line_preferences", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to . - /// - internal static string Space_preferences { - get { - return ResourceManager.GetString("Space_preferences", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to . - /// - internal static string Wrapping_preferences { - get { - return ResourceManager.GetString("Wrapping_preferences", resourceCulture); + return ResourceManager.GetString("EmptyResource", resourceCulture); } } } diff --git a/src/CodeStyle/CSharp/Analyzers/CSharpCodeStyleResources.resx b/src/CodeStyle/CSharp/Analyzers/CSharpCodeStyleResources.resx index 9189ced5fee..14ed010cf9e 100644 --- a/src/CodeStyle/CSharp/Analyzers/CSharpCodeStyleResources.resx +++ b/src/CodeStyle/CSharp/Analyzers/CSharpCodeStyleResources.resx @@ -117,19 +117,8 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - - - - - - - - - - + + Remove this value when another is added. + https://github.com/Microsoft/msbuild/issues/1661 \ No newline at end of file diff --git a/src/CodeStyle/CSharp/Analyzers/Formatting/CSharpFormattingOptions.cs b/src/CodeStyle/CSharp/Analyzers/Formatting/CSharpFormattingOptions.cs index 27a2794f4e8..af15e617868 100644 --- a/src/CodeStyle/CSharp/Analyzers/Formatting/CSharpFormattingOptions.cs +++ b/src/CodeStyle/CSharp/Analyzers/Formatting/CSharpFormattingOptions.cs @@ -67,9 +67,9 @@ internal static partial class CSharpFormattingOptions private static ImmutableDictionary, SpacingWithinParenthesesOption> SpacingWithinParenthesisOptionsMap { get; } private static ImmutableDictionary, NewLineOption> NewLineOptionsMap { get; } - private static Option CreateOption(OptionGroup group, string name, T defaultValue, params OptionStorageLocation[] storageLocations) + private static Option CreateOption(string name, T defaultValue, params OptionStorageLocation[] storageLocations) { - var option = new Option(nameof(CSharpFormattingOptions), group, name, defaultValue, storageLocations); + var option = new Option(nameof(CSharpFormattingOptions), name, defaultValue, storageLocations); s_allOptionsBuilder.Add(option); return option; } @@ -77,7 +77,7 @@ private static Option CreateOption(OptionGroup group, string name, T defau private static Option CreateSpaceWithinParenthesesOption(SpacingWithinParenthesesOption parenthesesOption, string name) { var option = CreateOption( - CSharpFormattingOptionGroups.Spacing, name, + name, defaultValue: false, storageLocations: new OptionStorageLocation[] { new EditorConfigStorageLocation( @@ -95,7 +95,7 @@ private static Option CreateSpaceWithinParenthesesOption(SpacingWithinPare private static Option CreateNewLineForBracesOption(NewLineOption newLineOption, string name) { var option = CreateOption( - CSharpFormattingOptionGroups.NewLine, name, + name, defaultValue: true, storageLocations: new OptionStorageLocation[] { new EditorConfigStorageLocation( @@ -111,49 +111,49 @@ private static Option CreateNewLineForBracesOption(NewLineOption newLineOp } public static Option SpacingAfterMethodDeclarationName { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpacingAfterMethodDeclarationName), + nameof(SpacingAfterMethodDeclarationName), defaultValue: false, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_between_method_declaration_name_and_open_parenthesis"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpacingAfterMethodDeclarationName")}); public static Option SpaceWithinMethodDeclarationParenthesis { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceWithinMethodDeclarationParenthesis), + nameof(SpaceWithinMethodDeclarationParenthesis), defaultValue: false, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_between_method_declaration_parameter_list_parentheses"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceWithinMethodDeclarationParenthesis")}); public static Option SpaceBetweenEmptyMethodDeclarationParentheses { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceBetweenEmptyMethodDeclarationParentheses), + nameof(SpaceBetweenEmptyMethodDeclarationParentheses), defaultValue: false, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_between_method_declaration_empty_parameter_list_parentheses"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceBetweenEmptyMethodDeclarationParentheses")}); public static Option SpaceAfterMethodCallName { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceAfterMethodCallName), + nameof(SpaceAfterMethodCallName), defaultValue: false, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_between_method_call_name_and_opening_parenthesis"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceAfterMethodCallName")}); public static Option SpaceWithinMethodCallParentheses { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceWithinMethodCallParentheses), + nameof(SpaceWithinMethodCallParentheses), defaultValue: false, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_between_method_call_parameter_list_parentheses"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceWithinMethodCallParentheses")}); public static Option SpaceBetweenEmptyMethodCallParentheses { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceBetweenEmptyMethodCallParentheses), + nameof(SpaceBetweenEmptyMethodCallParentheses), defaultValue: false, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_between_method_call_empty_parameter_list_parentheses"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceBetweenEmptyMethodCallParentheses")}); public static Option SpaceAfterControlFlowStatementKeyword { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceAfterControlFlowStatementKeyword), + nameof(SpaceAfterControlFlowStatementKeyword), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_after_keywords_in_control_flow_statements"), @@ -169,14 +169,14 @@ private static Option CreateNewLineForBracesOption(NewLineOption newLineOp SpacingWithinParenthesesOption.ControlFlowStatements, nameof(SpaceWithinOtherParentheses)); public static Option SpaceAfterCast { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceAfterCast), + nameof(SpaceAfterCast), defaultValue: false, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_after_cast"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceAfterCast")}); public static Option SpacesIgnoreAroundVariableDeclaration { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpacesIgnoreAroundVariableDeclaration), + nameof(SpacesIgnoreAroundVariableDeclaration), defaultValue: false, storageLocations: new OptionStorageLocation[] { new EditorConfigStorageLocation( @@ -186,84 +186,84 @@ private static Option CreateNewLineForBracesOption(NewLineOption newLineOp new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpacesIgnoreAroundVariableDeclaration")}); public static Option SpaceBeforeOpenSquareBracket { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceBeforeOpenSquareBracket), + nameof(SpaceBeforeOpenSquareBracket), defaultValue: false, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_before_open_square_brackets"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceBeforeOpenSquareBracket")}); public static Option SpaceBetweenEmptySquareBrackets { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceBetweenEmptySquareBrackets), + nameof(SpaceBetweenEmptySquareBrackets), defaultValue: false, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_between_empty_square_brackets"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceBetweenEmptySquareBrackets")}); public static Option SpaceWithinSquareBrackets { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceWithinSquareBrackets), + nameof(SpaceWithinSquareBrackets), defaultValue: false, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_between_square_brackets"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceWithinSquareBrackets")}); public static Option SpaceAfterColonInBaseTypeDeclaration { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceAfterColonInBaseTypeDeclaration), + nameof(SpaceAfterColonInBaseTypeDeclaration), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_after_colon_in_inheritance_clause"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceAfterColonInBaseTypeDeclaration")}); public static Option SpaceAfterComma { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceAfterComma), + nameof(SpaceAfterComma), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_after_comma"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceAfterComma")}); public static Option SpaceAfterDot { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceAfterDot), + nameof(SpaceAfterDot), defaultValue: false, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_after_dot"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceAfterDot")}); public static Option SpaceAfterSemicolonsInForStatement { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceAfterSemicolonsInForStatement), + nameof(SpaceAfterSemicolonsInForStatement), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_after_semicolon_in_for_statement"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceAfterSemicolonsInForStatement")}); public static Option SpaceBeforeColonInBaseTypeDeclaration { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceBeforeColonInBaseTypeDeclaration), + nameof(SpaceBeforeColonInBaseTypeDeclaration), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_before_colon_in_inheritance_clause"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceBeforeColonInBaseTypeDeclaration")}); public static Option SpaceBeforeComma { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceBeforeComma), + nameof(SpaceBeforeComma), defaultValue: false, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_before_comma"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceBeforeComma")}); public static Option SpaceBeforeDot { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceBeforeDot), + nameof(SpaceBeforeDot), defaultValue: false, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_before_dot"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceBeforeDot")}); public static Option SpaceBeforeSemicolonsInForStatement { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpaceBeforeSemicolonsInForStatement), + nameof(SpaceBeforeSemicolonsInForStatement), defaultValue: false, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_space_before_semicolon_in_for_statement"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpaceBeforeSemicolonsInForStatement")}); public static Option SpacingAroundBinaryOperator { get; } = CreateOption( - CSharpFormattingOptionGroups.Spacing, nameof(SpacingAroundBinaryOperator), + nameof(SpacingAroundBinaryOperator), defaultValue: BinaryOperatorSpacingOptions.Single, storageLocations: new OptionStorageLocation[] { new EditorConfigStorageLocation( @@ -273,42 +273,42 @@ private static Option CreateNewLineForBracesOption(NewLineOption newLineOp new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpacingAroundBinaryOperator")}); public static Option IndentBraces { get; } = CreateOption( - CSharpFormattingOptionGroups.Indentation, nameof(IndentBraces), + nameof(IndentBraces), defaultValue: false, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_indent_braces"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.OpenCloseBracesIndent")}); public static Option IndentBlock { get; } = CreateOption( - CSharpFormattingOptionGroups.Indentation, nameof(IndentBlock), + nameof(IndentBlock), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_indent_block_contents"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.IndentBlock")}); public static Option IndentSwitchSection { get; } = CreateOption( - CSharpFormattingOptionGroups.Indentation, nameof(IndentSwitchSection), + nameof(IndentSwitchSection), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_indent_switch_labels"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.IndentSwitchSection")}); public static Option IndentSwitchCaseSection { get; } = CreateOption( - CSharpFormattingOptionGroups.Indentation, nameof(IndentSwitchCaseSection), + nameof(IndentSwitchCaseSection), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_indent_case_contents"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.IndentSwitchCaseSection")}); public static Option IndentSwitchCaseSectionWhenBlock { get; } = CreateOption( - CSharpFormattingOptionGroups.Indentation, nameof(IndentSwitchCaseSectionWhenBlock), + nameof(IndentSwitchCaseSectionWhenBlock), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_indent_case_contents_when_block"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.IndentSwitchCaseSectionWhenBlock")}); public static Option LabelPositioning { get; } = CreateOption( - CSharpFormattingOptionGroups.Indentation, nameof(LabelPositioning), + nameof(LabelPositioning), defaultValue: LabelPositionOptions.OneLess, storageLocations: new OptionStorageLocation[] { new EditorConfigStorageLocation( @@ -318,14 +318,14 @@ private static Option CreateNewLineForBracesOption(NewLineOption newLineOp new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.LabelPositioning")}); public static Option WrappingPreserveSingleLine { get; } = CreateOption( - CSharpFormattingOptionGroups.Wrapping, nameof(WrappingPreserveSingleLine), + nameof(WrappingPreserveSingleLine), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_preserve_single_line_blocks"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.WrappingPreserveSingleLine")}); public static Option WrappingKeepStatementsOnSingleLine { get; } = CreateOption( - CSharpFormattingOptionGroups.Wrapping, nameof(WrappingKeepStatementsOnSingleLine), + nameof(WrappingKeepStatementsOnSingleLine), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_preserve_single_line_statements"), @@ -359,42 +359,42 @@ private static Option CreateNewLineForBracesOption(NewLineOption newLineOp NewLineOption.Lambdas, nameof(NewLinesForBracesInLambdaExpressionBody)); public static Option NewLineForElse { get; } = CreateOption( - CSharpFormattingOptionGroups.NewLine, nameof(NewLineForElse), + nameof(NewLineForElse), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_new_line_before_else"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.NewLineForElse")}); public static Option NewLineForCatch { get; } = CreateOption( - CSharpFormattingOptionGroups.NewLine, nameof(NewLineForCatch), + nameof(NewLineForCatch), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_new_line_before_catch"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.NewLineForCatch")}); public static Option NewLineForFinally { get; } = CreateOption( - CSharpFormattingOptionGroups.NewLine, nameof(NewLineForFinally), + nameof(NewLineForFinally), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_new_line_before_finally"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.NewLineForFinally")}); public static Option NewLineForMembersInObjectInit { get; } = CreateOption( - CSharpFormattingOptionGroups.NewLine, nameof(NewLineForMembersInObjectInit), + nameof(NewLineForMembersInObjectInit), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_new_line_before_members_in_object_initializers"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.NewLineForMembersInObjectInit")}); public static Option NewLineForMembersInAnonymousTypes { get; } = CreateOption( - CSharpFormattingOptionGroups.NewLine, nameof(NewLineForMembersInAnonymousTypes), + nameof(NewLineForMembersInAnonymousTypes), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_new_line_before_members_in_anonymous_types"), new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.NewLineForMembersInAnonymousTypes")}); public static Option NewLineForClausesInQuery { get; } = CreateOption( - CSharpFormattingOptionGroups.NewLine, nameof(NewLineForClausesInQuery), + nameof(NewLineForClausesInQuery), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("csharp_new_line_between_query_expression_clauses"), @@ -433,12 +433,4 @@ internal enum BinaryOperatorSpacingOptions /// Remove Spacing Remove = 2 } - - internal static class CSharpFormattingOptionGroups - { - public static readonly OptionGroup NewLine = new OptionGroup(CSharpCodeStyleResources.New_line_preferences, priority: 1); - public static readonly OptionGroup Indentation = new OptionGroup(CSharpCodeStyleResources.Indentation_preferences, priority: 2); - public static readonly OptionGroup Spacing = new OptionGroup(CSharpCodeStyleResources.Space_preferences, priority: 3); - public static readonly OptionGroup Wrapping = new OptionGroup(CSharpCodeStyleResources.Wrapping_preferences, priority: 4); - } } diff --git a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.cs.xlf b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.cs.xlf index 1f894e33919..51449b0889f 100644 --- a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.cs.xlf +++ b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.cs.xlf @@ -1,6 +1,12 @@  - + + + Remove this value when another is added. + Odebrat tuto hodnotu, když se přidá jiná + https://github.com/Microsoft/msbuild/issues/1661 + + \ No newline at end of file diff --git a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.de.xlf b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.de.xlf index 91acff71f7c..b2c2e51e5d5 100644 --- a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.de.xlf +++ b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.de.xlf @@ -1,6 +1,12 @@  - + + + Remove this value when another is added. + Dieser Wert wird entfernt, wenn ein anderer hinzugefügt wird. + https://github.com/Microsoft/msbuild/issues/1661 + + \ No newline at end of file diff --git a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.es.xlf b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.es.xlf index aa3b9d5f705..25898aaea31 100644 --- a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.es.xlf +++ b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.es.xlf @@ -1,6 +1,12 @@  - + + + Remove this value when another is added. + Quite este valor cuando se agregue otro. + https://github.com/Microsoft/msbuild/issues/1661 + + \ No newline at end of file diff --git a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.fr.xlf b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.fr.xlf index 709eed96c50..363f62c91f0 100644 --- a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.fr.xlf +++ b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.fr.xlf @@ -1,6 +1,12 @@  - + + + Remove this value when another is added. + Supprimer cette valeur quand une autre est ajoutée. + https://github.com/Microsoft/msbuild/issues/1661 + + \ No newline at end of file diff --git a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.it.xlf b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.it.xlf index e7b69560a0c..6f5f3ff310d 100644 --- a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.it.xlf +++ b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.it.xlf @@ -1,6 +1,12 @@  - + + + Remove this value when another is added. + Rimuovere questo valore quando ne viene aggiunto un altro. + https://github.com/Microsoft/msbuild/issues/1661 + + \ No newline at end of file diff --git a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.ja.xlf b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.ja.xlf index d9881a3ffae..80173166da6 100644 --- a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.ja.xlf +++ b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.ja.xlf @@ -1,6 +1,12 @@  - + + + Remove this value when another is added. + 別の値が追加されたら、この値を削除します。 + https://github.com/Microsoft/msbuild/issues/1661 + + \ No newline at end of file diff --git a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.ko.xlf b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.ko.xlf index 2a94ca50e6d..1c821f10b24 100644 --- a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.ko.xlf +++ b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.ko.xlf @@ -1,6 +1,12 @@  - + + + Remove this value when another is added. + 다른 값을 추가할 때 이 값을 제거하세요. + https://github.com/Microsoft/msbuild/issues/1661 + + \ No newline at end of file diff --git a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.pl.xlf b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.pl.xlf index be3322a0299..517cb0b150f 100644 --- a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.pl.xlf +++ b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.pl.xlf @@ -1,6 +1,12 @@  - + + + Remove this value when another is added. + Usuń tę wartość, gdy dodawana jest kolejna. + https://github.com/Microsoft/msbuild/issues/1661 + + \ No newline at end of file diff --git a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.pt-BR.xlf b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.pt-BR.xlf index 0fa20227c88..7b744d872d4 100644 --- a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.pt-BR.xlf +++ b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.pt-BR.xlf @@ -1,6 +1,12 @@  - + + + Remove this value when another is added. + Remover este valor quando outro for adicionado. + https://github.com/Microsoft/msbuild/issues/1661 + + \ No newline at end of file diff --git a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.ru.xlf b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.ru.xlf index b9f11bdae9d..2a306742825 100644 --- a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.ru.xlf +++ b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.ru.xlf @@ -1,6 +1,12 @@  - + + + Remove this value when another is added. + Удалите это значение при добавлении другого значения. + https://github.com/Microsoft/msbuild/issues/1661 + + \ No newline at end of file diff --git a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.tr.xlf b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.tr.xlf index 757631272b8..532cd843d87 100644 --- a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.tr.xlf +++ b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.tr.xlf @@ -1,6 +1,12 @@  - + + + Remove this value when another is added. + Başka bir değer eklendiğinde bu değeri kaldırın. + https://github.com/Microsoft/msbuild/issues/1661 + + \ No newline at end of file diff --git a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.zh-Hans.xlf b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.zh-Hans.xlf index de4ccd1d3b5..3e0c6e8fa5b 100644 --- a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.zh-Hans.xlf +++ b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.zh-Hans.xlf @@ -1,6 +1,12 @@  - + + + Remove this value when another is added. + 在添加其他值时删除此值。 + https://github.com/Microsoft/msbuild/issues/1661 + + \ No newline at end of file diff --git a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.zh-Hant.xlf b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.zh-Hant.xlf index 9bf5eb42a39..582bd908dec 100644 --- a/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.zh-Hant.xlf +++ b/src/CodeStyle/CSharp/Analyzers/xlf/CSharpCodeStyleResources.zh-Hant.xlf @@ -1,6 +1,12 @@  - + + + Remove this value when another is added. + 當新增另一個值時移除此值。 + https://github.com/Microsoft/msbuild/issues/1661 + + \ No newline at end of file diff --git a/src/CodeStyle/Core/Analyzers/CodeStyleResources.Designer.cs b/src/CodeStyle/Core/Analyzers/CodeStyleResources.Designer.cs index 8e0b846bf75..023da5e75fc 100644 --- a/src/CodeStyle/Core/Analyzers/CodeStyleResources.Designer.cs +++ b/src/CodeStyle/Core/Analyzers/CodeStyleResources.Designer.cs @@ -97,24 +97,6 @@ internal class CodeStyleResources { } } - /// - /// Looks up a localized string similar to . - /// - internal static string Indentation_and_spacing { - get { - return ResourceManager.GetString("Indentation_and_spacing", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to . - /// - internal static string New_line_preferences { - get { - return ResourceManager.GetString("New_line_preferences", resourceCulture); - } - } - /// /// Looks up a localized string similar to . /// diff --git a/src/CodeStyle/Core/Analyzers/CodeStyleResources.resx b/src/CodeStyle/Core/Analyzers/CodeStyleResources.resx index 826d11c84ee..9a6e047707c 100644 --- a/src/CodeStyle/Core/Analyzers/CodeStyleResources.resx +++ b/src/CodeStyle/Core/Analyzers/CodeStyleResources.resx @@ -129,12 +129,6 @@ Fix formatting - - - - - - diff --git a/src/CodeStyle/Core/Analyzers/Formatting/FormattingOptions.cs b/src/CodeStyle/Core/Analyzers/Formatting/FormattingOptions.cs index 60f008f8d76..9b7fe602409 100644 --- a/src/CodeStyle/Core/Analyzers/Formatting/FormattingOptions.cs +++ b/src/CodeStyle/Core/Analyzers/Formatting/FormattingOptions.cs @@ -13,22 +13,22 @@ internal static class FormattingOptions internal static ImmutableArray AllOptions { get; } - private static PerLanguageOption CreatePerLanguageOption(OptionGroup group, string name, T defaultValue, params OptionStorageLocation[] storageLocations) + private static PerLanguageOption CreatePerLanguageOption(string name, T defaultValue, params OptionStorageLocation[] storageLocations) { - var option = new PerLanguageOption(nameof(FormattingOptions), group, name, defaultValue, storageLocations); + var option = new PerLanguageOption(nameof(FormattingOptions), name, defaultValue, storageLocations); s_allOptionsBuilder.Add(option); return option; } - private static Option CreateOption(OptionGroup group, string name, T defaultValue, params OptionStorageLocation[] storageLocations) + private static Option CreateOption(string name, T defaultValue, params OptionStorageLocation[] storageLocations) { - var option = new Option(nameof(FormattingOptions), group, name, defaultValue, storageLocations); + var option = new Option(nameof(FormattingOptions), name, defaultValue, storageLocations); s_allOptionsBuilder.Add(option); return option; } public static PerLanguageOption UseTabs { get; } = CreatePerLanguageOption( - FormattingOptionGroups.IndentationAndSpacing, nameof(UseTabs), + nameof(UseTabs), defaultValue: false, storageLocations: new EditorConfigStorageLocation( "indent_style", @@ -37,23 +37,23 @@ private static Option CreateOption(OptionGroup group, string name, T defau // This is also serialized by the Visual Studio-specific LanguageSettingsPersister public static PerLanguageOption TabSize { get; } = CreatePerLanguageOption( - FormattingOptionGroups.IndentationAndSpacing, nameof(TabSize), + nameof(TabSize), defaultValue: 4, storageLocations: EditorConfigStorageLocation.ForInt32Option("tab_width")); // This is also serialized by the Visual Studio-specific LanguageSettingsPersister public static PerLanguageOption IndentationSize { get; } = CreatePerLanguageOption( - FormattingOptionGroups.IndentationAndSpacing, nameof(IndentationSize), + nameof(IndentationSize), defaultValue: 4, storageLocations: EditorConfigStorageLocation.ForInt32Option("indent_size")); // This is also serialized by the Visual Studio-specific LanguageSettingsPersister public static PerLanguageOption SmartIndent { get; } = CreatePerLanguageOption( - FormattingOptionGroups.IndentationAndSpacing, nameof(SmartIndent), + nameof(SmartIndent), defaultValue: IndentStyle.Smart); public static PerLanguageOption NewLine { get; } = CreatePerLanguageOption( - FormattingOptionGroups.NewLine, nameof(NewLine), + nameof(NewLine), defaultValue: Environment.NewLine, storageLocations: new EditorConfigStorageLocation( "end_of_line", @@ -61,7 +61,7 @@ private static Option CreateOption(OptionGroup group, string name, T defau GetEndOfLineEditorConfigString)); internal static Option InsertFinalNewLine { get; } = CreateOption( - FormattingOptionGroups.NewLine, nameof(InsertFinalNewLine), + nameof(InsertFinalNewLine), defaultValue: false, storageLocations: EditorConfigStorageLocation.ForBoolOption("insert_final_newline")); @@ -79,11 +79,11 @@ private static Optional ParseEditorConfigEndOfLine(string endOfLineValue private static string GetEndOfLineEditorConfigString(string option) => s_parenthesesPreferenceMap.TryGetKey(option, out var editorConfigString) ? editorConfigString : null; - internal static PerLanguageOption DebugMode { get; } = CreatePerLanguageOption(OptionGroup.Default, nameof(DebugMode), defaultValue: false); + internal static PerLanguageOption DebugMode { get; } = CreatePerLanguageOption(nameof(DebugMode), defaultValue: false); internal static Option AllowConcurrent { get; } = new Option(nameof(FormattingOptions), nameof(AllowConcurrent), defaultValue: true); - internal static Option AllowDisjointSpanMerging { get; } = CreateOption(OptionGroup.Default, nameof(AllowDisjointSpanMerging), defaultValue: false); + internal static Option AllowDisjointSpanMerging { get; } = CreateOption(nameof(AllowDisjointSpanMerging), defaultValue: false); static FormattingOptions() { @@ -99,10 +99,4 @@ public enum IndentStyle Smart = 2 } } - - internal static class FormattingOptionGroups - { - public static readonly OptionGroup IndentationAndSpacing = new OptionGroup(CodeStyleResources.Indentation_and_spacing, priority: 1); - public static readonly OptionGroup NewLine = new OptionGroup(CodeStyleResources.New_line_preferences, priority: 2); - } } diff --git a/src/CodeStyle/Core/Analyzers/Options/IOptionWithGroup.cs b/src/CodeStyle/Core/Analyzers/Options/IOptionWithGroup.cs deleted file mode 100644 index 2ff54cb4da3..00000000000 --- a/src/CodeStyle/Core/Analyzers/Options/IOptionWithGroup.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.CodeAnalysis.Options -{ - /// - /// Group/sub-feature associated with an . - /// - internal interface IOptionWithGroup : IOption - { - /// - /// Group/sub-feature for this option. - /// - OptionGroup Group { get; } - } -} diff --git a/src/CodeStyle/Core/Analyzers/Options/OptionGroup.cs b/src/CodeStyle/Core/Analyzers/Options/OptionGroup.cs deleted file mode 100644 index 957869f612a..00000000000 --- a/src/CodeStyle/Core/Analyzers/Options/OptionGroup.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace Microsoft.CodeAnalysis.Options -{ - /// - /// Group/sub-feature associated with an . - /// - internal sealed class OptionGroup - { - public static readonly OptionGroup Default = new OptionGroup(string.Empty, int.MaxValue); - - public OptionGroup(string description, int priority) - { - Description = description ?? throw new ArgumentNullException(nameof(description)); - Priority = priority; - } - - /// - /// A localizable resource description string for the option group. - /// - public string Description { get; } - - /// - /// Relative priority of the option group with respect to other option groups within the same feature. - /// - public int Priority { get; } - } -} diff --git a/src/CodeStyle/Core/Analyzers/Options/Option`1.cs b/src/CodeStyle/Core/Analyzers/Options/Option`1.cs index 0f43eb72258..8b518480d5d 100644 --- a/src/CodeStyle/Core/Analyzers/Options/Option`1.cs +++ b/src/CodeStyle/Core/Analyzers/Options/Option`1.cs @@ -2,25 +2,19 @@ using System; using System.Collections.Immutable; -using System.Diagnostics; namespace Microsoft.CodeAnalysis.Options { /// /// An global option. An instance of this class can be used to access an option value from an OptionSet. /// - internal class Option : IOptionWithGroup + internal class Option : IOption { /// /// Feature this option is associated with. /// public string Feature { get; } - /// - /// Optional group/sub-feature for this option. - /// - internal OptionGroup Group { get; } - /// /// The name of the option. /// @@ -50,29 +44,18 @@ public Option(string feature, string name, T defaultValue) } public Option(string feature, string name, T defaultValue, params OptionStorageLocation[] storageLocations) - : this(feature, group: OptionGroup.Default, name, defaultValue, storageLocations) - { - } - - internal Option(string feature, OptionGroup group, string name, T defaultValue, params OptionStorageLocation[] storageLocations) { if (string.IsNullOrWhiteSpace(feature)) { throw new ArgumentNullException(nameof(feature)); } - if (group == null) - { - throw new ArgumentNullException(nameof(group)); - } - if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException(nameof(name)); } this.Feature = feature; - this.Group = group; this.Name = name; this.DefaultValue = defaultValue; this.StorageLocations = storageLocations.ToImmutableArray(); @@ -82,8 +65,6 @@ internal Option(string feature, OptionGroup group, string name, T defaultValue, bool IOption.IsPerLanguage => false; - OptionGroup IOptionWithGroup.Group => this.Group; - public override string ToString() { return string.Format("{0} - {1}", this.Feature, this.Name); diff --git a/src/CodeStyle/Core/Analyzers/Options/PerLanguageOption`1.cs b/src/CodeStyle/Core/Analyzers/Options/PerLanguageOption`1.cs index 6267f2b4aa7..abf43293e33 100644 --- a/src/CodeStyle/Core/Analyzers/Options/PerLanguageOption`1.cs +++ b/src/CodeStyle/Core/Analyzers/Options/PerLanguageOption`1.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Immutable; -using System.Diagnostics; namespace Microsoft.CodeAnalysis.Options { @@ -10,18 +9,13 @@ namespace Microsoft.CodeAnalysis.Options /// An option that can be specified once per language. /// /// - internal class PerLanguageOption : IOptionWithGroup + internal class PerLanguageOption : IOption { /// /// Feature this option is associated with. /// public string Feature { get; } - /// - /// Optional group/sub-feature for this option. - /// - internal OptionGroup Group { get; } - /// /// The name of the option. /// @@ -45,29 +39,18 @@ public PerLanguageOption(string feature, string name, T defaultValue) } public PerLanguageOption(string feature, string name, T defaultValue, params OptionStorageLocation[] storageLocations) - : this(feature, group: OptionGroup.Default, name, defaultValue, storageLocations) - { - } - - internal PerLanguageOption(string feature, OptionGroup group, string name, T defaultValue, params OptionStorageLocation[] storageLocations) { if (string.IsNullOrWhiteSpace(feature)) { throw new ArgumentNullException(nameof(feature)); } - if (group == null) - { - throw new ArgumentNullException(nameof(group)); - } - if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException(nameof(name)); } this.Feature = feature; - this.Group = group; this.Name = name; this.DefaultValue = defaultValue; this.StorageLocations = storageLocations.ToImmutableArray(); @@ -77,8 +60,6 @@ internal PerLanguageOption(string feature, OptionGroup group, string name, T def bool IOption.IsPerLanguage => true; - OptionGroup IOptionWithGroup.Group => this.Group; - public override string ToString() { return string.Format("{0} - {1}", this.Feature, this.Name); -- GitLab