47 references to UnusedValuePreference
Microsoft.CodeAnalysis.CodeStyle (44)
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (26)
20using PropertiesMap = ImmutableDictionary<(UnusedValuePreference preference, bool isUnusedLocalAssignment, bool isRemovableAssignment), 97Option2<CodeStyleOption2<UnusedValuePreference>> unusedValueExpressionStatementOption, 98Option2<CodeStyleOption2<UnusedValuePreference>> unusedValueAssignmentOption) 115protected abstract CodeStyleOption2<UnusedValuePreference> GetUnusedValueExpressionStatementOption(AnalyzerOptionsProvider provider); 116protected abstract CodeStyleOption2<UnusedValuePreference> GetUnusedValueAssignmentOption(AnalyzerOptionsProvider provider); 144/// 1. The underlying <see cref="UnusedValuePreference"/> for the reported diagnostic 153var builder = ImmutableDictionary.CreateBuilder<(UnusedValuePreference preference, bool isUnusedLocalAssignment, bool isRemovableAssignment), 155AddEntries(UnusedValuePreference.DiscardVariable); 156AddEntries(UnusedValuePreference.UnusedLocalVariable); 159void AddEntries(UnusedValuePreference preference) 165void AddEntries2(UnusedValuePreference preference, bool isUnusedLocalAssignment) 171void AddEntryCore(UnusedValuePreference preference, bool isUnusedLocalAssignment, bool isRemovableAssignment) 222(UnusedValuePreference preference, NotificationOption2 notification) GetPreferenceAndSeverity(CodeStyleOption2<UnusedValuePreference> option) 229return (default(UnusedValuePreference), NotificationOption2.None); 233if (preferenceOpt.Value == UnusedValuePreference.DiscardVariable && 236preferenceOpt = UnusedValuePreference.UnusedLocalVariable; 249UnusedValuePreference unusedValueExpressionStatementPreference, 251UnusedValuePreference unusedValueAssignmentPreference, 268public UnusedValuePreference UnusedValueExpressionStatementPreference { get; } 270public UnusedValuePreference UnusedValueAssignmentPreference { get; } 294public static bool TryGetUnusedValuePreference(Diagnostic diagnostic, out UnusedValuePreference preference) 301case nameof(UnusedValuePreference.DiscardVariable): 302preference = UnusedValuePreference.DiscardVariable; 305case nameof(UnusedValuePreference.UnusedLocalVariable): 306preference = UnusedValuePreference.UnusedLocalVariable;
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (1)
620_options.UnusedValueAssignmentPreference == UnusedValuePreference.UnusedLocalVariable)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (11)
154private static readonly CodeStyleOption2<UnusedValuePreference> s_preferNoneUnusedValuePreference = 157private static readonly BidirectionalMap<string, UnusedValuePreference> s_unusedExpressionAssignmentPreferenceMap = 160KeyValuePairUtil.Create("discard_variable", UnusedValuePreference.DiscardVariable), 161KeyValuePairUtil.Create("unused_local_variable", UnusedValuePreference.UnusedLocalVariable), 164internal static EditorConfigValueSerializer<CodeStyleOption2<UnusedValuePreference>> GetUnusedValuePreferenceSerializer(CodeStyleOption2<UnusedValuePreference> defaultValue) 168private static Optional<CodeStyleOption2<UnusedValuePreference>> ParseUnusedExpressionAssignmentPreference( 170CodeStyleOption2<UnusedValuePreference> defaultCodeStyleOption) 175return new CodeStyleOption2<UnusedValuePreference>( 182private static string GetUnusedExpressionAssignmentPreferenceEditorConfigString(CodeStyleOption2<UnusedValuePreference> option, CodeStyleOption2<UnusedValuePreference> defaultValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\VisualBasic\VisualBasicCodeStyleOptions.cs (6)
45public static readonly Option2<CodeStyleOption2<UnusedValuePreference>> UnusedValueExpressionStatement = CreateOption( 48defaultValue: new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.UnusedLocalVariable, NotificationOption2.Silent), 51public static readonly Option2<CodeStyleOption2<UnusedValuePreference>> UnusedValueAssignment = CreateOption( 54defaultValue: new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.UnusedLocalVariable, NotificationOption2.Suggestion),
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (3)
135if (!AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.TryGetUnusedValuePreference(diagnostic, out var preference)) 216if (!AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.TryGetUnusedValuePreference(diagnostic, out var preference)) 255Debug.Assert(AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.TryGetUnusedValuePreference(diagnostic, out var diagnosticPreference) &&