Skip to content

Commit

Permalink
Rename FadingOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Cosifne committed Feb 22, 2023
1 parent 1f04902 commit 09fb3ce
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public CSharpRemoveUnreachableCodeDiagnosticAnalyzer()
: base(IDEDiagnosticIds.RemoveUnreachableCodeDiagnosticId,
EnforceOnBuildValues.RemoveUnreachableCode,
option: null,
fadingOption: FadingOptions.FadeOutUnreachableCode,
fadingOption: FadingOptionsStorage.FadeOutUnreachableCode,
new LocalizableResourceString(nameof(CSharpAnalyzersResources.Unreachable_code_detected), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources)),
configurable: false)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal abstract class AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer<TSynt
private readonly DiagnosticDescriptor _generatedCodeClassificationIdDescriptor;

protected AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer(LocalizableString titleAndMessage)
: base(GetDescriptors(titleAndMessage, out var classificationIdDescriptor, out var generatedCodeClassificationIdDescriptor), FadingOptions.FadeOutUnusedImports)
: base(GetDescriptors(titleAndMessage, out var classificationIdDescriptor, out var generatedCodeClassificationIdDescriptor), FadingOptionsStorage.FadeOutUnusedImports)
{
_classificationIdDescriptor = classificationIdDescriptor;
_generatedCodeClassificationIdDescriptor = generatedCodeClassificationIdDescriptor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ public async Task Test_FadingOptions(string diagnosticId, bool fadingOptionValue
private static PerLanguageOption2<bool> GetFadingOptionForDiagnostic(string diagnosticId)
=> diagnosticId switch
{
IDEDiagnosticIds.RemoveUnnecessaryImportsDiagnosticId => FadingOptions.FadeOutUnusedImports,
IDEDiagnosticIds.RemoveUnreachableCodeDiagnosticId => FadingOptions.FadeOutUnreachableCode,
IDEDiagnosticIds.RemoveUnnecessaryImportsDiagnosticId => FadingOptionsStorage.FadeOutUnusedImports,
IDEDiagnosticIds.RemoveUnreachableCodeDiagnosticId => FadingOptionsStorage.FadeOutUnreachableCode,
_ => throw ExceptionUtilities.UnexpectedValue(diagnosticId),
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ class A
}";
await using var testLspServer = await CreateTestWorkspaceWithDiagnosticsAsync(markup, BackgroundAnalysisScope.OpenFiles, useVSDiagnostics);
var firstLocation = testLspServer.GetLocations("first").Single().Range;
testLspServer.TestWorkspace.GlobalOptions.SetGlobalOption(FadingOptions.FadeOutUnusedImports, LanguageNames.CSharp, true);
testLspServer.TestWorkspace.GlobalOptions.SetGlobalOption(FadingOptionsStorage.FadeOutUnusedImports, LanguageNames.CSharp, true);

var document = testLspServer.GetCurrentSolution().Projects.Single().Documents.Single();

Expand Down Expand Up @@ -739,7 +739,7 @@ class A
}";
await using var testLspServer = await CreateTestWorkspaceWithDiagnosticsAsync(markup, BackgroundAnalysisScope.OpenFiles, useVSDiagnostics);
var firstLocation = testLspServer.GetLocations("first").Single().Range;
testLspServer.TestWorkspace.GlobalOptions.SetGlobalOption(FadingOptions.FadeOutUnusedImports, LanguageNames.CSharp, false);
testLspServer.TestWorkspace.GlobalOptions.SetGlobalOption(FadingOptionsStorage.FadeOutUnusedImports, LanguageNames.CSharp, false);

var document = testLspServer.GetCurrentSolution().Projects.Single().Documents.Single();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ public AdvancedOptionPageControl(OptionStore optionStore, IComponentModel compon
BindToOption(Collapse_regions_when_collapsing_to_definitions, BlockStructureOptionsStorage.CollapseRegionsWhenCollapsingToDefinitions, LanguageNames.CSharp);

// Fading
BindToOption(Fade_out_unused_usings, FadingOptions.FadeOutUnusedImports, LanguageNames.CSharp);
BindToOption(Fade_out_unreachable_code, FadingOptions.FadeOutUnreachableCode, LanguageNames.CSharp);
BindToOption(Fade_out_unused_usings, FadingOptionsStorage.FadeOutUnusedImports, LanguageNames.CSharp);
BindToOption(Fade_out_unreachable_code, FadingOptionsStorage.FadeOutUnreachableCode, LanguageNames.CSharp);

// Block Structure Guides
BindToOption(Show_guides_for_declaration_level_constructs, BlockStructureOptionsStorage.ShowBlockStructureGuidesForDeclarationLevelConstructs, LanguageNames.CSharp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ public partial class AutomationObject
{
public int Fading_FadeOutUnreachableCode
{
get { return GetBooleanOption(FadingOptions.FadeOutUnreachableCode); }
set { SetBooleanOption(FadingOptions.FadeOutUnreachableCode, value); }
get { return GetBooleanOption(FadingOptionsStorage.FadeOutUnreachableCode); }
set { SetBooleanOption(FadingOptionsStorage.FadeOutUnreachableCode, value); }
}

public int Fading_FadeOutUnusedImports
{
get { return GetBooleanOption(FadingOptions.FadeOutUnusedImports); }
set { SetBooleanOption(FadingOptions.FadeOutUnusedImports, value); }
get { return GetBooleanOption(FadingOptionsStorage.FadeOutUnusedImports); }
set { SetBooleanOption(FadingOptionsStorage.FadeOutUnusedImports, value); }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options
BindToOption(Collapse_regions_when_collapsing_to_definitions, BlockStructureOptionsStorage.CollapseRegionsWhenCollapsingToDefinitions, LanguageNames.VisualBasic)

' Fading
BindToOption(Fade_out_unused_imports, FadingOptions.FadeOutUnusedImports, LanguageNames.VisualBasic)
BindToOption(Fade_out_unused_imports, FadingOptionsStorage.FadeOutUnusedImports, LanguageNames.VisualBasic)

' Block structure guides
BindToOption(Show_guides_for_declaration_level_constructs, BlockStructureOptionsStorage.ShowBlockStructureGuidesForDeclarationLevelConstructs, LanguageNames.VisualBasic)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options
Partial Public Class AutomationObject
Public Property Fading_FadeOutUnreachableCode As Boolean
Get
Return GetBooleanOption(FadingOptions.FadeOutUnreachableCode)
Return GetBooleanOption(FadingOptionsStorage.FadeOutUnreachableCode)
End Get
Set(value As Boolean)
SetBooleanOption(FadingOptions.FadeOutUnreachableCode, value)
SetBooleanOption(FadingOptionsStorage.FadeOutUnreachableCode, value)
End Set
End Property

Public Property Fading_FadeOutUnusedImports As Boolean
Get
Return GetBooleanOption(FadingOptions.FadeOutUnusedImports)
Return GetBooleanOption(FadingOptionsStorage.FadeOutUnusedImports)
End Get
Set(value As Boolean)
SetBooleanOption(FadingOptions.FadeOutUnusedImports, value)
SetBooleanOption(FadingOptionsStorage.FadeOutUnusedImports, value)
End Set
End Property
End Class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Microsoft.CodeAnalysis.CodeStyle
{
internal static class FadingOptions
internal static class FadingOptionsStorage
{
public static readonly PerLanguageOption2<bool> FadeOutUnusedImports = new("dotnet_fade_out_unused_imports", defaultValue: true);
public static readonly PerLanguageOption2<bool> FadeOutUnreachableCode = new("dotnet_fade_out_unreachable_code", defaultValue: true);
Expand Down

0 comments on commit 09fb3ce

Please sign in to comment.