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