提交 0d194fd0 编写于 作者: C CyrusNajmabadi

Remove options to allow users to control if they want fading or not.

上级 f3e63a6c
......@@ -14,12 +14,12 @@ internal abstract class RemoveUnnecessaryCastDiagnosticAnalyzerBase<TLanguageKin
private static readonly LocalizableString s_localizableMessage = new LocalizableResourceString(nameof(WorkspacesResources.Cast_is_redundant), WorkspacesResources.ResourceManager, typeof(WorkspacesResources));
private static readonly DiagnosticDescriptor s_descriptor = new DiagnosticDescriptor(IDEDiagnosticIds.RemoveUnnecessaryCastDiagnosticId,
s_localizableTitle,
s_localizableMessage,
DiagnosticCategory.Style,
DiagnosticSeverity.Hidden,
isEnabledByDefault: true,
customTags: DiagnosticCustomTags.Unnecessary);
s_localizableTitle,
s_localizableMessage,
DiagnosticCategory.Style,
DiagnosticSeverity.Hidden,
isEnabledByDefault: true,
customTags: DiagnosticCustomTags.Unnecessary);
#region Interface methods
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis.Options;
namespace Microsoft.CodeAnalysis.Fading
{
internal static class FadingOptions
{
public static readonly PerLanguageOption<bool> FadeOutUnusedImports = new PerLanguageOption<bool>(
nameof(FadingOptions), nameof(FadeOutUnusedImports), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation($"TextEditor.%LANGUAGE%.Specific.{nameof(FadeOutUnusedImports)}"));
public static readonly PerLanguageOption<bool> FadeOutUnnecessaryCasts = new PerLanguageOption<bool>(
nameof(FadingOptions), nameof(FadeOutUnnecessaryCasts), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation($"TextEditor.%LANGUAGE%.Specific.{nameof(FadeOutUnnecessaryCasts)}"));
public static readonly PerLanguageOption<bool> FadeOutUnreachableCode = new PerLanguageOption<bool>(
nameof(FadingOptions), nameof(FadeOutUnreachableCode), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation($"TextEditor.%LANGUAGE%.Specific.{nameof(FadeOutUnreachableCode)}"));
public static readonly PerLanguageOption<bool> FadeOutNullChecksThatCanBeSimplified = new PerLanguageOption<bool>(
nameof(FadingOptions), nameof(FadeOutNullChecksThatCanBeSimplified), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation($"TextEditor.%LANGUAGE%.Specific.{nameof(FadeOutNullChecksThatCanBeSimplified)}"));
public static readonly PerLanguageOption<bool> FadeOutInitializersThatCanBeSimplified = new PerLanguageOption<bool>(
nameof(FadingOptions), nameof(FadeOutInitializersThatCanBeSimplified), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation($"TextEditor.%LANGUAGE%.Specific.{nameof(FadeOutInitializersThatCanBeSimplified)}"));
public static readonly PerLanguageOption<bool> FadeOutDefaultExpressionsThatCanBeSimplified = new PerLanguageOption<bool>(
nameof(FadingOptions), nameof(FadeOutDefaultExpressionsThatCanBeSimplified), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation($"TextEditor.%LANGUAGE%.Specific.{nameof(FadeOutDefaultExpressionsThatCanBeSimplified)}"));
}
}
\ No newline at end of file
......@@ -149,6 +149,7 @@
<Compile Include="CodeFixes\FixAllOccurrences\FixSomeCodeAction.cs" />
<Compile Include="AddPackage\InstallPackageDirectlyCodeAction.cs" />
<Compile Include="AddConstructorParametersFromMembers\State.cs" />
<Compile Include="Fading\FadingOptions.cs" />
<Compile Include="FeaturesResources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
......
......@@ -61,6 +61,23 @@
Content="{x:Static local:AdvancedOptionPageStrings.Option_Collapse_regions_when_collapsing_to_definitions}" />
</StackPanel>
</GroupBox>
<GroupBox x:Uid="FadingGroupBox"
Header="{x:Static local:AdvancedOptionPageStrings.Option_Fading}">
<StackPanel>
<CheckBox x:Name="Fade_out_unused_usings"
Content="{x:Static local:AdvancedOptionPageStrings.Option_Fade_out_unused_usings}" />
<CheckBox x:Name="Fade_out_unnecessary_casts"
Content="{x:Static local:AdvancedOptionPageStrings.Option_Fade_out_unnecessary_casts}" />
<CheckBox x:Name="Fade_out_unreachable_code"
Content="{x:Static local:AdvancedOptionPageStrings.Option_Fade_out_unreachable_code}" />
<CheckBox x:Name="Fade_out_null_checks_that_can_be_simplified"
Content="{x:Static local:AdvancedOptionPageStrings.Option_Fade_out_null_checks_that_can_be_simplified}" />
<CheckBox x:Name="Fade_out_initializers_that_can_be_simplified"
Content="{x:Static local:AdvancedOptionPageStrings.Option_Fade_out_initializers_that_can_be_simplified}" />
<CheckBox x:Name="Fade_out_default_expressions_that_can_be_simplified"
Content="{x:Static local:AdvancedOptionPageStrings.Option_Fade_out_default_expressions_that_can_be_simplified}" />
</StackPanel>
</GroupBox>
<GroupBox x:Uid="BlockStructureGuidesGroupBox"
Header="{x:Static local:AdvancedOptionPageStrings.Option_Block_Structure_Guides}">
<StackPanel>
......
......@@ -6,6 +6,7 @@
using Microsoft.CodeAnalysis.Editor.CSharp.SplitStringLiteral;
using Microsoft.CodeAnalysis.Editor.Shared.Options;
using Microsoft.CodeAnalysis.ExtractMethod;
using Microsoft.CodeAnalysis.Fading;
using Microsoft.CodeAnalysis.ImplementType;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.CodeAnalysis.Structure;
......@@ -34,6 +35,13 @@ public AdvancedOptionPageControl(IServiceProvider serviceProvider) : base(servic
BindToOption(Show_outlining_for_comments_and_preprocessor_regions, BlockStructureOptions.ShowOutliningForCommentsAndPreprocessorRegions, LanguageNames.CSharp);
BindToOption(Collapse_regions_when_collapsing_to_definitions, BlockStructureOptions.CollapseRegionsWhenCollapsingToDefinitions, LanguageNames.CSharp);
BindToOption(Fade_out_unused_usings, FadingOptions.FadeOutUnusedImports, LanguageNames.CSharp);
BindToOption(Fade_out_unnecessary_casts, FadingOptions.FadeOutUnnecessaryCasts, LanguageNames.CSharp);
BindToOption(Fade_out_unreachable_code, FadingOptions.FadeOutUnreachableCode, LanguageNames.CSharp);
BindToOption(Fade_out_null_checks_that_can_be_simplified, FadingOptions.FadeOutNullChecksThatCanBeSimplified, LanguageNames.CSharp);
BindToOption(Fade_out_initializers_that_can_be_simplified, FadingOptions.FadeOutInitializersThatCanBeSimplified, LanguageNames.CSharp);
BindToOption(Fade_out_default_expressions_that_can_be_simplified, FadingOptions.FadeOutDefaultExpressionsThatCanBeSimplified, LanguageNames.CSharp);
BindToOption(Show_guides_for_declaration_level_constructs, BlockStructureOptions.ShowBlockStructureGuidesForDeclarationLevelConstructs, LanguageNames.CSharp);
BindToOption(Show_guides_for_code_level_constructs, BlockStructureOptions.ShowBlockStructureGuidesForCodeLevelConstructs, LanguageNames.CSharp);
......
......@@ -134,6 +134,27 @@ public static string Option_Show_guides_for_declaration_level_constructs
public static string Option_Show_guides_for_code_level_constructs
=> ServicesVSResources.Show_guides_for_code_level_constructs;
public static string Option_Fading
=> ServicesVSResources.Fading;
public static string Option_Fade_out_unused_usings
=> ServicesVSResources.Fade_out_unused_usings;
public static string Option_Fade_out_unnecessary_casts
=> ServicesVSResources.Fade_out_unnecessary_casts;
public static string Option_Fade_out_unreachable_code
=> ServicesVSResources.Fade_out_unreachable_code;
public static string Option_Fade_out_null_checks_that_can_be_simplified
=> ServicesVSResources.Fade_out_null_checks_that_can_be_simplified;
public static string Option_Fade_out_initializers_that_can_be_simplified
=> ServicesVSResources.Fade_out_initializers_that_can_be_simplified;
public static string Option_Fade_out_default_expressions_that_can_be_simplified
=> ServicesVSResources.Fade_out_default_expressions_that_can_be_simplified;
public static string Option_Performance
{
get { return CSharpVSResources.Performance; }
......
......@@ -777,6 +777,69 @@ internal class ServicesVSResources {
}
}
/// <summary>
/// Looks up a localized string similar to Fade out &apos;defualt&apos; expressions that can be simplified.
/// </summary>
internal static string Fade_out_default_expressions_that_can_be_simplified {
get {
return ResourceManager.GetString("Fade_out_default_expressions_that_can_be_simplified", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Fade out initializers that can be simplified.
/// </summary>
internal static string Fade_out_initializers_that_can_be_simplified {
get {
return ResourceManager.GetString("Fade_out_initializers_that_can_be_simplified", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Fade out null checks that can be simplified.
/// </summary>
internal static string Fade_out_null_checks_that_can_be_simplified {
get {
return ResourceManager.GetString("Fade_out_null_checks_that_can_be_simplified", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Fade out unnecessary casts.
/// </summary>
internal static string Fade_out_unnecessary_casts {
get {
return ResourceManager.GetString("Fade_out_unnecessary_casts", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Fade out unreachable code.
/// </summary>
internal static string Fade_out_unreachable_code {
get {
return ResourceManager.GetString("Fade_out_unreachable_code", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Fade out unused usings.
/// </summary>
internal static string Fade_out_unused_usings {
get {
return ResourceManager.GetString("Fade_out_unused_usings", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Fading.
/// </summary>
internal static string Fading {
get {
return ResourceManager.GetString("Fading", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Failed to create document in miscellaneous files project..
/// </summary>
......
......@@ -933,4 +933,25 @@ Additional information: {1}</value>
<data name="Perform_editor_feature_analysis_in_external_process" xml:space="preserve">
<value>Perform editor _feature analysis in external process (experimental)</value>
</data>
<data name="Fade_out_default_expressions_that_can_be_simplified" xml:space="preserve">
<value>Fade out 'defualt' expressions that can be simplified</value>
</data>
<data name="Fade_out_initializers_that_can_be_simplified" xml:space="preserve">
<value>Fade out initializers that can be simplified</value>
</data>
<data name="Fade_out_null_checks_that_can_be_simplified" xml:space="preserve">
<value>Fade out null checks that can be simplified</value>
</data>
<data name="Fade_out_unnecessary_casts" xml:space="preserve">
<value>Fade out unnecessary casts</value>
</data>
<data name="Fade_out_unreachable_code" xml:space="preserve">
<value>Fade out unreachable code</value>
</data>
<data name="Fade_out_unused_usings" xml:space="preserve">
<value>Fade out unused usings</value>
</data>
<data name="Fading" xml:space="preserve">
<value>Fading</value>
</data>
</root>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册