39 references to ParenthesesPreference
Microsoft.CodeAnalysis.CodeStyle (27)
AbstractAddRequiredParenthesesDiagnosticAnalyzer.cs (1)
117
if (preference.Value !=
ParenthesesPreference
.AlwaysForClarity)
AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (2)
94
if (preference.Value ==
ParenthesesPreference
.AlwaysForClarity &&
104
Debug.Assert(preference.Value ==
ParenthesesPreference
.NeverIfUnnecessary ||
AnalyzerOptionsProvider.cs (4)
89
public CodeStyleOption2<
ParenthesesPreference
> ArithmeticBinaryParentheses => GetOption(CodeStyleOptions2.ArithmeticBinaryParentheses, FallbackCodeStyleOptions.ArithmeticBinaryParentheses);
90
public CodeStyleOption2<
ParenthesesPreference
> OtherBinaryParentheses => GetOption(CodeStyleOptions2.OtherBinaryParentheses, FallbackCodeStyleOptions.OtherBinaryParentheses);
91
public CodeStyleOption2<
ParenthesesPreference
> RelationalBinaryParentheses => GetOption(CodeStyleOptions2.RelationalBinaryParentheses, FallbackCodeStyleOptions.RelationalBinaryParentheses);
92
public CodeStyleOption2<
ParenthesesPreference
> OtherParentheses => GetOption(CodeStyleOptions2.OtherParentheses, FallbackCodeStyleOptions.OtherParentheses);
CodeStyleOptions2.cs (11)
235
private static readonly BidirectionalMap<string,
ParenthesesPreference
> s_parenthesesPreferenceMap =
238
KeyValuePairUtil.Create("always_for_clarity",
ParenthesesPreference
.AlwaysForClarity),
239
KeyValuePairUtil.Create("never_if_unnecessary",
ParenthesesPreference
.NeverIfUnnecessary),
242
private static PerLanguageOption2<CodeStyleOption2<
ParenthesesPreference
>> CreateParenthesesOption(CodeStyleOption2<
ParenthesesPreference
> defaultValue, string name)
253
return new CodeStyleOption2<
ParenthesesPreference
>(s_parenthesesPreferenceMap.GetValueOrDefault(value), notification);
261
var value = s_parenthesesPreferenceMap.GetKeyOrDefault(option.Value) ?? s_parenthesesPreferenceMap.GetKeyOrDefault(
ParenthesesPreference
.AlwaysForClarity);
265
internal static readonly PerLanguageOption2<CodeStyleOption2<
ParenthesesPreference
>> ArithmeticBinaryParentheses =
270
internal static readonly PerLanguageOption2<CodeStyleOption2<
ParenthesesPreference
>> OtherBinaryParentheses =
275
internal static readonly PerLanguageOption2<CodeStyleOption2<
ParenthesesPreference
>> RelationalBinaryParentheses =
280
internal static readonly PerLanguageOption2<CodeStyleOption2<
ParenthesesPreference
>> OtherParentheses =
IdeCodeStyleOptions.cs (8)
19
private static readonly CodeStyleOption2<
ParenthesesPreference
> s_alwaysForClarityPreference =
20
new(
ParenthesesPreference
.AlwaysForClarity, NotificationOption2.Silent);
22
private static readonly CodeStyleOption2<
ParenthesesPreference
> s_neverIfUnnecessaryPreference =
23
new(
ParenthesesPreference
.NeverIfUnnecessary, NotificationOption2.Silent);
51
[DataMember] public CodeStyleOption2<
ParenthesesPreference
> ArithmeticBinaryParentheses { get; init; } = s_alwaysForClarityPreference;
52
[DataMember] public CodeStyleOption2<
ParenthesesPreference
> OtherBinaryParentheses { get; init; } = s_alwaysForClarityPreference;
53
[DataMember] public CodeStyleOption2<
ParenthesesPreference
> RelationalBinaryParentheses { get; init; } = s_alwaysForClarityPreference;
54
[DataMember] public CodeStyleOption2<
ParenthesesPreference
> OtherParentheses { get; init; } = s_neverIfUnnecessaryPreference;
ParenthesesDiagnosticAnalyzersHelper.cs (1)
18
internal static CodeStyleOption2<
ParenthesesPreference
> GetLanguageOption(AnalyzerOptionsProvider options, PrecedenceKind precedenceKind)
Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities (12)
ParenthesesOptionsProvider.cs (12)
23
private static readonly CodeStyleOption2<
ParenthesesPreference
> IgnorePreference =
24
new CodeStyleOption2<
ParenthesesPreference
>(
ParenthesesPreference
.AlwaysForClarity, NotificationOption2.None);
26
private static readonly CodeStyleOption2<
ParenthesesPreference
> RequireForPrecedenceClarityPreference =
27
new CodeStyleOption2<
ParenthesesPreference
>(
ParenthesesPreference
.AlwaysForClarity, NotificationOption2.Suggestion);
29
private static readonly CodeStyleOption2<
ParenthesesPreference
> RemoveIfUnnecessaryPreference =
30
new CodeStyleOption2<
ParenthesesPreference
>(
ParenthesesPreference
.NeverIfUnnecessary, NotificationOption2.Suggestion);
32
private static IEnumerable<PerLanguageOption2<CodeStyleOption2<
ParenthesesPreference
>>> GetAllExceptOtherParenthesesOptions()
48
private static IEnumerable<PerLanguageOption2<CodeStyleOption2<
ParenthesesPreference
>>> GetAllParenthesesOptions()
94
private OptionsCollection GetSingleRequireOption(PerLanguageOption2<CodeStyleOption2<
ParenthesesPreference
>> option)