src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (23)
17public static bool TryParseStringEditorConfigCodeStyleOption(string arg, CodeStyleOption2<string> defaultValue, [NotNullWhen(true)] out CodeStyleOption2<string>? option)
30public static bool TryParseBoolEditorConfigCodeStyleOption(string arg, CodeStyleOption2<bool> defaultValue, out CodeStyleOption2<bool> option)
118public static Option2<CodeStyleOption2<T>> CreateEditorConfigOption<T>(
121CodeStyleOption2<T> defaultValue,
124Func<CodeStyleOption2<T>, EditorConfigValueSerializer<CodeStyleOption2<T>>>? serializerFactory = null)
126var option = new Option2<CodeStyleOption2<T>>(name, defaultValue, group, languageName, isEditorConfigOption: true, serializer: (serializerFactory ?? EditorConfigValueSerializer.CodeStyle).Invoke(defaultValue));
143public static PerLanguageOption2<CodeStyleOption2<T>> CreatePerLanguageEditorConfigOption<T>(
146CodeStyleOption2<T> defaultValue,
148Func<CodeStyleOption2<T>, EditorConfigValueSerializer<CodeStyleOption2<T>>>? serializerFactory = null)
150var option = new PerLanguageOption2<CodeStyleOption2<T>>(name, defaultValue, group, isEditorConfigOption: true, serializer: (serializerFactory ?? EditorConfigValueSerializer.CodeStyle).Invoke(defaultValue));
155private static readonly CodeStyleOption2<UnusedValuePreference> s_preferNoneUnusedValuePreference =
165internal static EditorConfigValueSerializer<CodeStyleOption2<UnusedValuePreference>> GetUnusedValuePreferenceSerializer(CodeStyleOption2<UnusedValuePreference> defaultValue)
169private static Optional<CodeStyleOption2<UnusedValuePreference>> ParseUnusedExpressionAssignmentPreference(
171CodeStyleOption2<UnusedValuePreference> defaultCodeStyleOption)
183private static string GetUnusedExpressionAssignmentPreferenceEditorConfigString(CodeStyleOption2<UnusedValuePreference> option, CodeStyleOption2<UnusedValuePreference> defaultValue)
190internal static string GetEditorConfigStringNotificationPart<T>(CodeStyleOption2<T> option, CodeStyleOption2<T> defaultValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\IOptionReader.cs (8)
40public static T GetOptionValue<T>(this IOptionsReader options, Option2<CodeStyleOption2<T>> option)
43public static T GetOptionValue<T>(this IOptionsReader options, Option2<CodeStyleOption2<T>> option, T defaultValue)
44=> options.TryGetOption<CodeStyleOption2<T>>(new OptionKey2(option), out var style) ? style!.Value : defaultValue;
46public static T GetOptionValue<T>(this IOptionsReader options, PerLanguageOption2<CodeStyleOption2<T>> option, string language)
49public static T GetOptionValue<T>(this IOptionsReader options, PerLanguageOption2<CodeStyleOption2<T>> option, string language, T defaultValue)
50=> options.TryGetOption<CodeStyleOption2<T>>(new OptionKey2(option, language), out var style) ? style!.Value : defaultValue;