提交 59827874 编写于 作者: S Sam Harwell

Remove OptionGroup

上级 f5eb7df5
......@@ -10,6 +10,7 @@
namespace Microsoft.CodeAnalysis.CSharp {
using System;
using System.Reflection;
/// <summary>
......@@ -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 {
}
/// <summary>
/// Looks up a localized string similar to .
/// Looks up a localized string similar to Remove this value when another is added..
/// </summary>
internal static string Expected_string_or_char_literal {
internal static string EmptyResource {
get {
return ResourceManager.GetString("Expected_string_or_char_literal", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to .
/// </summary>
internal static string Indentation_preferences {
get {
return ResourceManager.GetString("Indentation_preferences", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to .
/// </summary>
internal static string New_line_preferences {
get {
return ResourceManager.GetString("New_line_preferences", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to .
/// </summary>
internal static string Space_preferences {
get {
return ResourceManager.GetString("Space_preferences", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to .
/// </summary>
internal static string Wrapping_preferences {
get {
return ResourceManager.GetString("Wrapping_preferences", resourceCulture);
return ResourceManager.GetString("EmptyResource", resourceCulture);
}
}
}
......
......@@ -117,19 +117,8 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Expected_string_or_char_literal" xml:space="preserve">
<value />
</data>
<data name="Indentation_preferences" xml:space="preserve">
<value />
</data>
<data name="New_line_preferences" xml:space="preserve">
<value />
</data>
<data name="Space_preferences" xml:space="preserve">
<value />
</data>
<data name="Wrapping_preferences" xml:space="preserve">
<value />
<data name="EmptyResource" xml:space="preserve">
<value>Remove this value when another is added.</value>
<comment>https://github.com/Microsoft/msbuild/issues/1661</comment>
</data>
</root>
\ No newline at end of file
......@@ -67,9 +67,9 @@ internal static partial class CSharpFormattingOptions
private static ImmutableDictionary<Option<bool>, SpacingWithinParenthesesOption> SpacingWithinParenthesisOptionsMap { get; }
private static ImmutableDictionary<Option<bool>, NewLineOption> NewLineOptionsMap { get; }
private static Option<T> CreateOption<T>(OptionGroup group, string name, T defaultValue, params OptionStorageLocation[] storageLocations)
private static Option<T> CreateOption<T>(string name, T defaultValue, params OptionStorageLocation[] storageLocations)
{
var option = new Option<T>(nameof(CSharpFormattingOptions), group, name, defaultValue, storageLocations);
var option = new Option<T>(nameof(CSharpFormattingOptions), name, defaultValue, storageLocations);
s_allOptionsBuilder.Add(option);
return option;
}
......@@ -77,7 +77,7 @@ private static Option<T> CreateOption<T>(OptionGroup group, string name, T defau
private static Option<bool> CreateSpaceWithinParenthesesOption(SpacingWithinParenthesesOption parenthesesOption, string name)
{
var option = CreateOption(
CSharpFormattingOptionGroups.Spacing, name,
name,
defaultValue: false,
storageLocations: new OptionStorageLocation[] {
new EditorConfigStorageLocation<bool>(
......@@ -95,7 +95,7 @@ private static Option<bool> CreateSpaceWithinParenthesesOption(SpacingWithinPare
private static Option<bool> CreateNewLineForBracesOption(NewLineOption newLineOption, string name)
{
var option = CreateOption(
CSharpFormattingOptionGroups.NewLine, name,
name,
defaultValue: true,
storageLocations: new OptionStorageLocation[] {
new EditorConfigStorageLocation<bool>(
......@@ -111,49 +111,49 @@ private static Option<bool> CreateNewLineForBracesOption(NewLineOption newLineOp
}
public static Option<bool> 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<bool> 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<bool> 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<bool> 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<bool> 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<bool> 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<bool> 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<bool> CreateNewLineForBracesOption(NewLineOption newLineOp
SpacingWithinParenthesesOption.ControlFlowStatements, nameof(SpaceWithinOtherParentheses));
public static Option<bool> 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<bool> SpacesIgnoreAroundVariableDeclaration { get; } = CreateOption(
CSharpFormattingOptionGroups.Spacing, nameof(SpacesIgnoreAroundVariableDeclaration),
nameof(SpacesIgnoreAroundVariableDeclaration),
defaultValue: false,
storageLocations: new OptionStorageLocation[] {
new EditorConfigStorageLocation<bool>(
......@@ -186,84 +186,84 @@ private static Option<bool> CreateNewLineForBracesOption(NewLineOption newLineOp
new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpacesIgnoreAroundVariableDeclaration")});
public static Option<bool> 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<bool> 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<bool> 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<bool> 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<bool> 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<bool> 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<bool> 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<bool> 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<bool> 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<bool> 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<bool> 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<BinaryOperatorSpacingOptions> SpacingAroundBinaryOperator { get; } = CreateOption(
CSharpFormattingOptionGroups.Spacing, nameof(SpacingAroundBinaryOperator),
nameof(SpacingAroundBinaryOperator),
defaultValue: BinaryOperatorSpacingOptions.Single,
storageLocations: new OptionStorageLocation[] {
new EditorConfigStorageLocation<BinaryOperatorSpacingOptions>(
......@@ -273,42 +273,42 @@ private static Option<bool> CreateNewLineForBracesOption(NewLineOption newLineOp
new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.SpacingAroundBinaryOperator")});
public static Option<bool> 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<bool> 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<bool> 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<bool> 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<bool> 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<LabelPositionOptions> LabelPositioning { get; } = CreateOption(
CSharpFormattingOptionGroups.Indentation, nameof(LabelPositioning),
nameof(LabelPositioning),
defaultValue: LabelPositionOptions.OneLess,
storageLocations: new OptionStorageLocation[] {
new EditorConfigStorageLocation<LabelPositionOptions>(
......@@ -318,14 +318,14 @@ private static Option<bool> CreateNewLineForBracesOption(NewLineOption newLineOp
new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.LabelPositioning")});
public static Option<bool> 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<bool> 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<bool> CreateNewLineForBracesOption(NewLineOption newLineOp
NewLineOption.Lambdas, nameof(NewLinesForBracesInLambdaExpressionBody));
public static Option<bool> 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<bool> 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<bool> 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<bool> 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<bool> 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<bool> 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);
}
}
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="cs" original="../CSharpCodeStyleResources.resx">
<body />
<body>
<trans-unit id="EmptyResource">
<source>Remove this value when another is added.</source>
<target state="translated">Odebrat tuto hodnotu, když se přidá jiná</target>
<note>https://github.com/Microsoft/msbuild/issues/1661</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="de" original="../CSharpCodeStyleResources.resx">
<body />
<body>
<trans-unit id="EmptyResource">
<source>Remove this value when another is added.</source>
<target state="translated">Dieser Wert wird entfernt, wenn ein anderer hinzugefügt wird.</target>
<note>https://github.com/Microsoft/msbuild/issues/1661</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="es" original="../CSharpCodeStyleResources.resx">
<body />
<body>
<trans-unit id="EmptyResource">
<source>Remove this value when another is added.</source>
<target state="translated">Quite este valor cuando se agregue otro.</target>
<note>https://github.com/Microsoft/msbuild/issues/1661</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="fr" original="../CSharpCodeStyleResources.resx">
<body />
<body>
<trans-unit id="EmptyResource">
<source>Remove this value when another is added.</source>
<target state="translated">Supprimer cette valeur quand une autre est ajoutée.</target>
<note>https://github.com/Microsoft/msbuild/issues/1661</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="it" original="../CSharpCodeStyleResources.resx">
<body />
<body>
<trans-unit id="EmptyResource">
<source>Remove this value when another is added.</source>
<target state="translated">Rimuovere questo valore quando ne viene aggiunto un altro.</target>
<note>https://github.com/Microsoft/msbuild/issues/1661</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="ja" original="../CSharpCodeStyleResources.resx">
<body />
<body>
<trans-unit id="EmptyResource">
<source>Remove this value when another is added.</source>
<target state="translated">別の値が追加されたら、この値を削除します。</target>
<note>https://github.com/Microsoft/msbuild/issues/1661</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="ko" original="../CSharpCodeStyleResources.resx">
<body />
<body>
<trans-unit id="EmptyResource">
<source>Remove this value when another is added.</source>
<target state="translated">다른 값을 추가할 때 이 값을 제거하세요.</target>
<note>https://github.com/Microsoft/msbuild/issues/1661</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="pl" original="../CSharpCodeStyleResources.resx">
<body />
<body>
<trans-unit id="EmptyResource">
<source>Remove this value when another is added.</source>
<target state="translated">Usuń tę wartość, gdy dodawana jest kolejna.</target>
<note>https://github.com/Microsoft/msbuild/issues/1661</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="pt-BR" original="../CSharpCodeStyleResources.resx">
<body />
<body>
<trans-unit id="EmptyResource">
<source>Remove this value when another is added.</source>
<target state="translated">Remover este valor quando outro for adicionado.</target>
<note>https://github.com/Microsoft/msbuild/issues/1661</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="ru" original="../CSharpCodeStyleResources.resx">
<body />
<body>
<trans-unit id="EmptyResource">
<source>Remove this value when another is added.</source>
<target state="translated">Удалите это значение при добавлении другого значения.</target>
<note>https://github.com/Microsoft/msbuild/issues/1661</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="tr" original="../CSharpCodeStyleResources.resx">
<body />
<body>
<trans-unit id="EmptyResource">
<source>Remove this value when another is added.</source>
<target state="translated">Başka bir değer eklendiğinde bu değeri kaldırın.</target>
<note>https://github.com/Microsoft/msbuild/issues/1661</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="zh-Hans" original="../CSharpCodeStyleResources.resx">
<body />
<body>
<trans-unit id="EmptyResource">
<source>Remove this value when another is added.</source>
<target state="translated">在添加其他值时删除此值。</target>
<note>https://github.com/Microsoft/msbuild/issues/1661</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="zh-Hant" original="../CSharpCodeStyleResources.resx">
<body />
<body>
<trans-unit id="EmptyResource">
<source>Remove this value when another is added.</source>
<target state="translated">當新增另一個值時移除此值。</target>
<note>https://github.com/Microsoft/msbuild/issues/1661</note>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -97,24 +97,6 @@ internal class CodeStyleResources {
}
}
/// <summary>
/// Looks up a localized string similar to .
/// </summary>
internal static string Indentation_and_spacing {
get {
return ResourceManager.GetString("Indentation_and_spacing", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to .
/// </summary>
internal static string New_line_preferences {
get {
return ResourceManager.GetString("New_line_preferences", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to .
/// </summary>
......
......@@ -129,12 +129,6 @@
<data name="Fix_formatting" xml:space="preserve">
<value>Fix formatting</value>
</data>
<data name="Indentation_and_spacing" xml:space="preserve">
<value />
</data>
<data name="New_line_preferences" xml:space="preserve">
<value />
</data>
<data name="None" xml:space="preserve">
<value />
</data>
......
......@@ -13,22 +13,22 @@ internal static class FormattingOptions
internal static ImmutableArray<IOption> AllOptions { get; }
private static PerLanguageOption<T> CreatePerLanguageOption<T>(OptionGroup group, string name, T defaultValue, params OptionStorageLocation[] storageLocations)
private static PerLanguageOption<T> CreatePerLanguageOption<T>(string name, T defaultValue, params OptionStorageLocation[] storageLocations)
{
var option = new PerLanguageOption<T>(nameof(FormattingOptions), group, name, defaultValue, storageLocations);
var option = new PerLanguageOption<T>(nameof(FormattingOptions), name, defaultValue, storageLocations);
s_allOptionsBuilder.Add(option);
return option;
}
private static Option<T> CreateOption<T>(OptionGroup group, string name, T defaultValue, params OptionStorageLocation[] storageLocations)
private static Option<T> CreateOption<T>(string name, T defaultValue, params OptionStorageLocation[] storageLocations)
{
var option = new Option<T>(nameof(FormattingOptions), group, name, defaultValue, storageLocations);
var option = new Option<T>(nameof(FormattingOptions), name, defaultValue, storageLocations);
s_allOptionsBuilder.Add(option);
return option;
}
public static PerLanguageOption<bool> UseTabs { get; } = CreatePerLanguageOption(
FormattingOptionGroups.IndentationAndSpacing, nameof(UseTabs),
nameof(UseTabs),
defaultValue: false,
storageLocations: new EditorConfigStorageLocation<bool>(
"indent_style",
......@@ -37,23 +37,23 @@ private static Option<T> CreateOption<T>(OptionGroup group, string name, T defau
// This is also serialized by the Visual Studio-specific LanguageSettingsPersister
public static PerLanguageOption<int> 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<int> 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<IndentStyle> SmartIndent { get; } = CreatePerLanguageOption(
FormattingOptionGroups.IndentationAndSpacing, nameof(SmartIndent),
nameof(SmartIndent),
defaultValue: IndentStyle.Smart);
public static PerLanguageOption<string> NewLine { get; } = CreatePerLanguageOption(
FormattingOptionGroups.NewLine, nameof(NewLine),
nameof(NewLine),
defaultValue: Environment.NewLine,
storageLocations: new EditorConfigStorageLocation<string>(
"end_of_line",
......@@ -61,7 +61,7 @@ private static Option<T> CreateOption<T>(OptionGroup group, string name, T defau
GetEndOfLineEditorConfigString));
internal static Option<bool> InsertFinalNewLine { get; } = CreateOption(
FormattingOptionGroups.NewLine, nameof(InsertFinalNewLine),
nameof(InsertFinalNewLine),
defaultValue: false,
storageLocations: EditorConfigStorageLocation.ForBoolOption("insert_final_newline"));
......@@ -79,11 +79,11 @@ private static Optional<string> ParseEditorConfigEndOfLine(string endOfLineValue
private static string GetEndOfLineEditorConfigString(string option)
=> s_parenthesesPreferenceMap.TryGetKey(option, out var editorConfigString) ? editorConfigString : null;
internal static PerLanguageOption<bool> DebugMode { get; } = CreatePerLanguageOption(OptionGroup.Default, nameof(DebugMode), defaultValue: false);
internal static PerLanguageOption<bool> DebugMode { get; } = CreatePerLanguageOption(nameof(DebugMode), defaultValue: false);
internal static Option<bool> AllowConcurrent { get; } = new Option<bool>(nameof(FormattingOptions), nameof(AllowConcurrent), defaultValue: true);
internal static Option<bool> AllowDisjointSpanMerging { get; } = CreateOption(OptionGroup.Default, nameof(AllowDisjointSpanMerging), defaultValue: false);
internal static Option<bool> 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);
}
}
// 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
{
/// <summary>
/// Group/sub-feature associated with an <see cref="IOption"/>.
/// </summary>
internal interface IOptionWithGroup : IOption
{
/// <summary>
/// Group/sub-feature for this option.
/// </summary>
OptionGroup Group { get; }
}
}
// 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
{
/// <summary>
/// Group/sub-feature associated with an <see cref="IOption"/>.
/// </summary>
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;
}
/// <summary>
/// A localizable resource description string for the option group.
/// </summary>
public string Description { get; }
/// <summary>
/// Relative priority of the option group with respect to other option groups within the same feature.
/// </summary>
public int Priority { get; }
}
}
......@@ -2,25 +2,19 @@
using System;
using System.Collections.Immutable;
using System.Diagnostics;
namespace Microsoft.CodeAnalysis.Options
{
/// <summary>
/// An global option. An instance of this class can be used to access an option value from an OptionSet.
/// </summary>
internal class Option<T> : IOptionWithGroup
internal class Option<T> : IOption
{
/// <summary>
/// Feature this option is associated with.
/// </summary>
public string Feature { get; }
/// <summary>
/// Optional group/sub-feature for this option.
/// </summary>
internal OptionGroup Group { get; }
/// <summary>
/// The name of the option.
/// </summary>
......@@ -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);
......
......@@ -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.
/// </summary>
/// <typeparam name="T"></typeparam>
internal class PerLanguageOption<T> : IOptionWithGroup
internal class PerLanguageOption<T> : IOption
{
/// <summary>
/// Feature this option is associated with.
/// </summary>
public string Feature { get; }
/// <summary>
/// Optional group/sub-feature for this option.
/// </summary>
internal OptionGroup Group { get; }
/// <summary>
/// The name of the option.
/// </summary>
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册