提交 8f18ac99 编写于 作者: J Jason Malinowski

Remove AbstractOptionPreviewViewModel.ShouldPersistOption

Since we only apply the options that finally changed, this behavior
should be redundant, but requires us to categorize options in a not-
obvious way.
上级 968158f3
......@@ -71,10 +71,5 @@ public IndentationViewModel(OptionSet options, IServiceProvider serviceProvider)
Items.Add(new RadioButtonViewModel<LabelPositionOptions>(CSharpVSResources.Indent_labels_normally, GotoLabelPreview, "goto", LabelPositionOptions.NoIndent, CSharpFormattingOptions.LabelPositioning, this, options));
Items.Add(new RadioButtonViewModel<LabelPositionOptions>(CSharpVSResources.Place_goto_labels_one_indent_less_than_current, GotoLabelPreview, "goto", LabelPositionOptions.OneLess, CSharpFormattingOptions.LabelPositioning, this, options));
}
internal override bool ShouldPersistOption(OptionKey key)
{
return key.Option.Feature == CSharpFormattingOptions.IndentFeatureName;
}
}
}
......@@ -13,11 +13,6 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.Options.Formatting
/// </summary>
internal class NewLinesViewModel : AbstractOptionPreviewViewModel
{
internal override bool ShouldPersistOption(OptionKey key)
{
return key.Option.Feature == CSharpFormattingOptions.NewLineFormattingFeatureName;
}
private static string s_previewText = @"//[
class C {
}
......
......@@ -13,11 +13,6 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.Options.Formatting
/// </summary>
internal class SpacingViewModel : AbstractOptionPreviewViewModel
{
internal override bool ShouldPersistOption(OptionKey key)
{
return key.Option.Feature == CSharpFormattingOptions.SpacingFeatureName;
}
private static readonly string s_methodPreview = @"
class C {
//[
......
......@@ -20,13 +20,6 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.Options.Formatting
/// </remarks>
internal class StyleViewModel : AbstractOptionPreviewViewModel
{
internal override bool ShouldPersistOption(OptionKey key)
{
return key.Option.Feature == CSharpCodeStyleOptions.FeatureName ||
key.Option.Feature == CodeStyleOptions.PerLanguageCodeStyleOption ||
key.Option.Feature == CodeAnalysis.Editing.GenerationOptions.FeatureName;
}
#region "Preview Text"
private static readonly string s_fieldDeclarationPreviewTrue = @"
......
......@@ -13,11 +13,6 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.Options.Formatting
/// </summary>
internal class WrappingViewModel : AbstractOptionPreviewViewModel
{
internal override bool ShouldPersistOption(OptionKey key)
{
return key.Option.Feature == CSharpFormattingOptions.WrappingFeatureName;
}
private static readonly string s_blockPreview = @"
class C
{
......
......@@ -69,10 +69,7 @@ internal OptionSet ApplyChangedOptions(OptionSet optionSet)
{
foreach (var optionKey in this.Options.GetChangedOptions(_originalOptions))
{
if (ShouldPersistOption(optionKey))
{
optionSet = optionSet.WithChangedOption(optionKey, this.Options.GetOption(optionKey));
}
optionSet = optionSet.WithChangedOption(optionKey, this.Options.GetOption(optionKey));
}
return optionSet;
......@@ -203,7 +200,5 @@ private void UpdateDocument(string text)
{
UpdatePreview(text);
}
internal abstract bool ShouldPersistOption(OptionKey optionKey);
}
}
......@@ -11,11 +11,6 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options
Friend Class StyleViewModel
Inherits AbstractOptionPreviewViewModel
Friend Overrides Function ShouldPersistOption(key As OptionKey) As Boolean
Return key.Option.Feature = SimplificationOptions.PerLanguageFeatureName OrElse
key.Option.Feature = CodeStyleOptions.PerLanguageCodeStyleOption
End Function
#Region "Preview Text"
Private Shared s_fieldDeclarationPreviewTrue As String = "
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册