Skip to content

Commit

Permalink
Move EditorFeatures layer to new options types
Browse files Browse the repository at this point in the history
  • Loading branch information
mavasani committed Mar 10, 2020
1 parent b9cf84d commit 00b3593
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal partial class LineSeparatorTaggerProvider : AsynchronousTaggerProvider<
{
private readonly IEditorFormatMap _editorFormatMap;

protected override IEnumerable<PerLanguageOption<bool>> PerLanguageOptions => SpecializedCollections.SingletonEnumerable(FeatureOnOffOptions.LineSeparator);
protected override IEnumerable<PerLanguageOption2<bool>> PerLanguageOptions => SpecializedCollections.SingletonEnumerable(FeatureOnOffOptions.LineSeparator);

private readonly object _lineSeperatorTagGate = new object();
private LineSeparatorTag _lineSeparatorTag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal class BraceHighlightingViewTaggerProvider : AsynchronousViewTaggerProvi
{
private readonly IBraceMatchingService _braceMatcherService;

protected override IEnumerable<Option<bool>> Options => SpecializedCollections.SingletonEnumerable(InternalFeatureOnOffOptions.BraceMatching);
protected override IEnumerable<Option2<bool>> Options => SpecializedCollections.SingletonEnumerable(InternalFeatureOnOffOptions.BraceMatching);

[ImportingConstructor]
public BraceHighlightingViewTaggerProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ internal partial class SemanticClassificationViewTaggerProvider : AsynchronousVi
// We want to track text changes so that we can try to only reclassify a method body if
// all edits were contained within one.
protected override TaggerTextChangeBehavior TextChangeBehavior => TaggerTextChangeBehavior.TrackTextChanges;
protected override IEnumerable<Option<bool>> Options => SpecializedCollections.SingletonEnumerable(InternalFeatureOnOffOptions.SemanticColorizer);
protected override IEnumerable<Option2<bool>> Options => SpecializedCollections.SingletonEnumerable(InternalFeatureOnOffOptions.SemanticColorizer);

[ImportingConstructor]
public SemanticClassificationViewTaggerProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics
[TagType(typeof(ClassificationTag))]
internal partial class DiagnosticsClassificationTaggerProvider : AbstractDiagnosticsTaggerProvider<ClassificationTag>
{
private static readonly IEnumerable<Option<bool>> s_tagSourceOptions = new[] { EditorComponentOnOffOptions.Tagger, InternalFeatureOnOffOptions.Classification, ServiceComponentOnOffOptions.DiagnosticProvider };
private static readonly IEnumerable<Option2<bool>> s_tagSourceOptions = new[] { EditorComponentOnOffOptions.Tagger, InternalFeatureOnOffOptions.Classification, ServiceComponentOnOffOptions.DiagnosticProvider };

private readonly ClassificationTypeMap _typeMap;
private readonly ClassificationTag _classificationTag;
private readonly IEditorOptionsFactoryService _editorOptionsFactoryService;

protected override IEnumerable<Option<bool>> Options => s_tagSourceOptions;
protected override IEnumerable<Option2<bool>> Options => s_tagSourceOptions;

[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics
[TagType(typeof(IErrorTag))]
internal partial class DiagnosticsSquiggleTaggerProvider : AbstractDiagnosticsAdornmentTaggerProvider<IErrorTag>
{
private static readonly IEnumerable<Option<bool>> s_tagSourceOptions =
private static readonly IEnumerable<Option2<bool>> s_tagSourceOptions =
ImmutableArray.Create(EditorComponentOnOffOptions.Tagger, InternalFeatureOnOffOptions.Squiggles, ServiceComponentOnOffOptions.DiagnosticProvider);

protected override IEnumerable<Option<bool>> Options => s_tagSourceOptions;
protected override IEnumerable<Option2<bool>> Options => s_tagSourceOptions;

[ImportingConstructor]
public DiagnosticsSquiggleTaggerProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics
internal partial class DiagnosticsSuggestionTaggerProvider :
AbstractDiagnosticsAdornmentTaggerProvider<IErrorTag>
{
private static readonly IEnumerable<Option<bool>> s_tagSourceOptions =
private static readonly IEnumerable<Option2<bool>> s_tagSourceOptions =
ImmutableArray.Create(EditorComponentOnOffOptions.Tagger, InternalFeatureOnOffOptions.Squiggles, ServiceComponentOnOffOptions.DiagnosticProvider);

protected override IEnumerable<Option<bool>> Options => s_tagSourceOptions;
protected override IEnumerable<Option2<bool>> Options => s_tagSourceOptions;

[ImportingConstructor]
public DiagnosticsSuggestionTaggerProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal class HighlighterViewTaggerProvider : AsynchronousViewTaggerProvider<Ke
// highlights if the caret stays within an existing tag.
protected override TaggerCaretChangeBehavior CaretChangeBehavior => TaggerCaretChangeBehavior.RemoveAllTagsOnCaretMoveOutsideOfTag;
protected override TaggerTextChangeBehavior TextChangeBehavior => TaggerTextChangeBehavior.RemoveAllTags;
protected override IEnumerable<PerLanguageOption<bool>> PerLanguageOptions => SpecializedCollections.SingletonEnumerable(FeatureOnOffOptions.KeywordHighlighting);
protected override IEnumerable<PerLanguageOption2<bool>> PerLanguageOptions => SpecializedCollections.SingletonEnumerable(FeatureOnOffOptions.KeywordHighlighting);

[ImportingConstructor]
public HighlighterViewTaggerProvider(
Expand Down
2 changes: 1 addition & 1 deletion src/EditorFeatures/Core/Options/SignatureHelpOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Microsoft.CodeAnalysis.Editor.Options
{
internal static class SignatureHelpOptions
{
public static readonly PerLanguageOption<bool> ShowSignatureHelp = new PerLanguageOption<bool>(nameof(SignatureHelpOptions), nameof(ShowSignatureHelp), defaultValue: true);
public static readonly PerLanguageOption2<bool> ShowSignatureHelp = new PerLanguageOption2<bool>(nameof(SignatureHelpOptions), nameof(ShowSignatureHelp), defaultValue: true);
}

[ExportOptionProvider, Shared]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ internal partial class ReferenceHighlightingViewTaggerProvider : AsynchronousVie
// highlights if the caret stays within an existing tag.
protected override TaggerCaretChangeBehavior CaretChangeBehavior => TaggerCaretChangeBehavior.RemoveAllTagsOnCaretMoveOutsideOfTag;
protected override TaggerTextChangeBehavior TextChangeBehavior => TaggerTextChangeBehavior.RemoveAllTags;
protected override IEnumerable<PerLanguageOption<bool>> PerLanguageOptions => SpecializedCollections.SingletonEnumerable(FeatureOnOffOptions.ReferenceHighlighting);
protected override IEnumerable<PerLanguageOption2<bool>> PerLanguageOptions => SpecializedCollections.SingletonEnumerable(FeatureOnOffOptions.ReferenceHighlighting);

[ImportingConstructor]
public ReferenceHighlightingViewTaggerProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Microsoft.CodeAnalysis.Editor.Shared.Extensions
{
internal static partial class ITextBufferExtensions
{
internal static bool GetFeatureOnOffOption(this ITextBuffer buffer, Option<bool> option)
internal static bool GetFeatureOnOffOption(this ITextBuffer buffer, Option2<bool> option)
{
var document = buffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges();

Expand All @@ -26,7 +26,7 @@ internal static bool GetFeatureOnOffOption(this ITextBuffer buffer, Option<bool>
return option.DefaultValue;
}

internal static bool GetFeatureOnOffOption(this ITextBuffer buffer, PerLanguageOption<bool> option)
internal static bool GetFeatureOnOffOption(this ITextBuffer buffer, PerLanguageOption2<bool> option)
{
// Add a FailFast to help diagnose 984249. Hopefully this will let us know what the issue is.
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ internal static class EditorComponentOnOffOptions
{
private const string LocalRegistryPath = @"Roslyn\Internal\OnOff\Components\";

public static readonly Option<bool> Adornment = new Option<bool>(nameof(EditorComponentOnOffOptions), nameof(Adornment), defaultValue: true,
public static readonly Option2<bool> Adornment = new Option2<bool>(nameof(EditorComponentOnOffOptions), nameof(Adornment), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Adornment"));

public static readonly Option<bool> Tagger = new Option<bool>(nameof(EditorComponentOnOffOptions), nameof(Tagger), defaultValue: true,
public static readonly Option2<bool> Tagger = new Option2<bool>(nameof(EditorComponentOnOffOptions), nameof(Tagger), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Tagger"));

public static readonly Option<bool> CodeRefactorings = new Option<bool>(nameof(EditorComponentOnOffOptions), nameof(CodeRefactorings), defaultValue: true,
public static readonly Option2<bool> CodeRefactorings = new Option2<bool>(nameof(EditorComponentOnOffOptions), nameof(CodeRefactorings), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Code Refactorings"));

public static readonly Option<bool> ShowCodeRefactoringsWhenQueriedForCodeFixes = new Option<bool>(
public static readonly Option2<bool> ShowCodeRefactoringsWhenQueriedForCodeFixes = new Option2<bool>(
nameof(EditorComponentOnOffOptions), nameof(ShowCodeRefactoringsWhenQueriedForCodeFixes), defaultValue: false,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + nameof(ShowCodeRefactoringsWhenQueriedForCodeFixes)));
}
Expand Down
34 changes: 17 additions & 17 deletions src/EditorFeatures/Core/Shared/Options/FeatureOnOffOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,50 +13,50 @@ namespace Microsoft.CodeAnalysis.Editor.Shared.Options
{
internal static class FeatureOnOffOptions
{
public static readonly PerLanguageOption<bool> EndConstruct = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(EndConstruct), defaultValue: true,
public static readonly PerLanguageOption2<bool> EndConstruct = new PerLanguageOption2<bool>(nameof(FeatureOnOffOptions), nameof(EndConstruct), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.AutoEndInsert"));

// This value is only used by Visual Basic, and so is using the old serialization name that was used by VB.
public static readonly PerLanguageOption<bool> AutomaticInsertionOfAbstractOrInterfaceMembers = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(AutomaticInsertionOfAbstractOrInterfaceMembers), defaultValue: true,
public static readonly PerLanguageOption2<bool> AutomaticInsertionOfAbstractOrInterfaceMembers = new PerLanguageOption2<bool>(nameof(FeatureOnOffOptions), nameof(AutomaticInsertionOfAbstractOrInterfaceMembers), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.AutoRequiredMemberInsert"));

public static readonly PerLanguageOption<bool> LineSeparator = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(LineSeparator), defaultValue: false,
public static readonly PerLanguageOption2<bool> LineSeparator = new PerLanguageOption2<bool>(nameof(FeatureOnOffOptions), nameof(LineSeparator), defaultValue: false,
storageLocations: new RoamingProfileStorageLocation(language => language == LanguageNames.VisualBasic ? "TextEditor.%LANGUAGE%.Specific.DisplayLineSeparators" : "TextEditor.%LANGUAGE%.Specific.Line Separator"));

public static readonly PerLanguageOption<bool> Outlining = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(Outlining), defaultValue: true,
public static readonly PerLanguageOption2<bool> Outlining = new PerLanguageOption2<bool>(nameof(FeatureOnOffOptions), nameof(Outlining), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Outlining"));

public static readonly PerLanguageOption<bool> KeywordHighlighting = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(KeywordHighlighting), defaultValue: true,
public static readonly PerLanguageOption2<bool> KeywordHighlighting = new PerLanguageOption2<bool>(nameof(FeatureOnOffOptions), nameof(KeywordHighlighting), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation(language => language == LanguageNames.VisualBasic ? "TextEditor.%LANGUAGE%.Specific.EnableHighlightRelatedKeywords" : "TextEditor.%LANGUAGE%.Specific.Keyword Highlighting"));

public static readonly PerLanguageOption<bool> ReferenceHighlighting = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(ReferenceHighlighting), defaultValue: true,
public static readonly PerLanguageOption2<bool> ReferenceHighlighting = new PerLanguageOption2<bool>(nameof(FeatureOnOffOptions), nameof(ReferenceHighlighting), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation(language => language == LanguageNames.VisualBasic ? "TextEditor.%LANGUAGE%.Specific.EnableHighlightReferences" : "TextEditor.%LANGUAGE%.Specific.Reference Highlighting"));

public static readonly PerLanguageOption<bool> FormatOnPaste = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(FormatOnPaste), defaultValue: true,
public static readonly PerLanguageOption2<bool> FormatOnPaste = new PerLanguageOption2<bool>(nameof(FeatureOnOffOptions), nameof(FormatOnPaste), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.FormatOnPaste"));

public static readonly PerLanguageOption<bool> AutoXmlDocCommentGeneration = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(AutoXmlDocCommentGeneration), defaultValue: true,
public static readonly PerLanguageOption2<bool> AutoXmlDocCommentGeneration = new PerLanguageOption2<bool>(nameof(FeatureOnOffOptions), nameof(AutoXmlDocCommentGeneration), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation(language => language == LanguageNames.VisualBasic ? "TextEditor.%LANGUAGE%.Specific.AutoComment" : "TextEditor.%LANGUAGE%.Specific.Automatic XML Doc Comment Generation"));

public static readonly PerLanguageOption<bool> AutoInsertBlockCommentStartString = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(AutoInsertBlockCommentStartString), defaultValue: true,
public static readonly PerLanguageOption2<bool> AutoInsertBlockCommentStartString = new PerLanguageOption2<bool>(nameof(FeatureOnOffOptions), nameof(AutoInsertBlockCommentStartString), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Auto Insert Block Comment Start String"));

public static readonly PerLanguageOption<bool> PrettyListing = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(PrettyListing), defaultValue: true,
public static readonly PerLanguageOption2<bool> PrettyListing = new PerLanguageOption2<bool>(nameof(FeatureOnOffOptions), nameof(PrettyListing), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PrettyListing"));

public static readonly PerLanguageOption<bool> AutoFormattingOnTyping = new PerLanguageOption<bool>(
public static readonly PerLanguageOption2<bool> AutoFormattingOnTyping = new PerLanguageOption2<bool>(
nameof(FeatureOnOffOptions), nameof(AutoFormattingOnTyping), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Auto Formatting On Typing"));

public static readonly PerLanguageOption<bool> AutoFormattingOnCloseBrace = new PerLanguageOption<bool>(
public static readonly PerLanguageOption2<bool> AutoFormattingOnCloseBrace = new PerLanguageOption2<bool>(
nameof(FeatureOnOffOptions), nameof(AutoFormattingOnCloseBrace), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Auto Formatting On Close Brace"));

public static readonly PerLanguageOption<bool> AutoFormattingOnSemicolon = new PerLanguageOption<bool>(
public static readonly PerLanguageOption2<bool> AutoFormattingOnSemicolon = new PerLanguageOption2<bool>(
nameof(FeatureOnOffOptions), nameof(AutoFormattingOnSemicolon), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Auto Formatting On Semicolon"));

public static readonly PerLanguageOption<bool> RenameTrackingPreview = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(RenameTrackingPreview), defaultValue: true,
public static readonly PerLanguageOption2<bool> RenameTrackingPreview = new PerLanguageOption2<bool>(nameof(FeatureOnOffOptions), nameof(RenameTrackingPreview), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation(language => language == LanguageNames.VisualBasic ? "TextEditor.%LANGUAGE%.Specific.RenameTrackingPreview" : "TextEditor.%LANGUAGE%.Specific.Rename Tracking Preview"));

/// <summary>
Expand All @@ -65,18 +65,18 @@ internal static class FeatureOnOffOptions
/// maintain any customized value for this setting, even through versions that have not
/// implemented this feature yet.
/// </summary>
public static readonly PerLanguageOption<bool> RenameTracking = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(RenameTracking), defaultValue: true);
public static readonly PerLanguageOption2<bool> RenameTracking = new PerLanguageOption2<bool>(nameof(FeatureOnOffOptions), nameof(RenameTracking), defaultValue: true);

/// <summary>
/// This option is currently used by Roslyn, but we might want to implement it in the
/// future. Keeping the option while it's unimplemented allows all upgrade paths to
/// maintain any customized value for this setting, even through versions that have not
/// implemented this feature yet.
/// </summary>
public static readonly PerLanguageOption<bool> RefactoringVerification = new PerLanguageOption<bool>(
public static readonly PerLanguageOption2<bool> RefactoringVerification = new PerLanguageOption2<bool>(
nameof(FeatureOnOffOptions), nameof(RefactoringVerification), defaultValue: false);

public static readonly PerLanguageOption<bool> StreamingGoToImplementation = new PerLanguageOption<bool>(
public static readonly PerLanguageOption2<bool> StreamingGoToImplementation = new PerLanguageOption2<bool>(
nameof(FeatureOnOffOptions), nameof(StreamingGoToImplementation), defaultValue: true);

public static readonly Option<bool> NavigateToDecompiledSources = new Option<bool>(
Expand Down
Loading

0 comments on commit 00b3593

Please sign in to comment.