提交 8cdec336 编写于 作者: D Dustin Campbell

Remove obsolete MEF v1 method of exporting options: [ExportedOption]

上级 c93594e5
......@@ -1342,7 +1342,7 @@ class C
var optionSet = new Dictionary<OptionKey, object>
{
{ new OptionKey(BraceCompletionOptions.EnableBraceCompletion, LanguageNames.CSharp), false }
{ new OptionKey(BraceCompletionOptions.Enable, LanguageNames.CSharp), false }
};
AssertFormatAfterTypeChar(code, expected);
......@@ -1372,7 +1372,7 @@ public int P
var optionSet = new Dictionary<OptionKey, object>
{
{ new OptionKey(BraceCompletionOptions.EnableBraceCompletion, LanguageNames.CSharp), false }
{ new OptionKey(BraceCompletionOptions.Enable, LanguageNames.CSharp), false }
};
AssertFormatAfterTypeChar(code, expected);
......
// 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 System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Editor.Implementation.TodoComments
{
internal static class TodoCommentOptions
{
[ExportOption]
public static readonly Option<string> TokenList = new Option<string>(nameof(TodoCommentOptions), nameof(TokenList), defaultValue: "HACK:1|TODO:1|UNDONE:1|UnresolvedMergeConflict:0");
}
[ExportOptionProvider, Shared]
internal class TodoCommentOptionsProvider : IOptionProvider
{
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
TodoCommentOptions.TokenList);
}
}
// 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 System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Editor.Options
{
internal static class BraceCompletionOptions
{
// This is serialized by the Visual Studio-specific LanguageSettingsPersister
[ExportOption]
public static readonly PerLanguageOption<bool> EnableBraceCompletion = new PerLanguageOption<bool>(nameof(BraceCompletionOptions), nameof(EnableBraceCompletion), defaultValue: true);
public static readonly PerLanguageOption<bool> Enable = new PerLanguageOption<bool>(nameof(BraceCompletionOptions), nameof(Enable), defaultValue: true);
}
[ExportOptionProvider, Shared]
internal class BraceCompletionOptionsProvider : IOptionProvider
{
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
BraceCompletionOptions.Enable);
}
}
// 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 System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Editor.Options
{
......@@ -9,13 +12,19 @@ internal static class EditorCompletionOptions
public const string FeatureName = "EditorCompletion";
// Intentionally not persisted
[ExportOption]
public static readonly Option<bool> UseSuggestionMode = new Option<bool>(FeatureName, nameof(UseSuggestionMode), defaultValue: false);
// Default into suggestion mode in the watch/immediate windows but respect the
// user's preferences if they switch away from it.
// Intentionally not persisted
[ExportOption]
public static readonly Option<bool> UseSuggestionMode_Debugger = new Option<bool>(FeatureName, nameof(UseSuggestionMode_Debugger), defaultValue: true);
}
[ExportOptionProvider, Shared]
internal class EditorCompletionOptionsProvider : IOptionProvider
{
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
EditorCompletionOptions.UseSuggestionMode,
EditorCompletionOptions.UseSuggestionMode_Debugger);
}
}
// 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 System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Editor.Options
{
internal partial class ExtensionManagerOptions
{
[ExportOption]
public static readonly Option<bool> DisableCrashingExtensions = new Option<bool>(nameof(ExtensionManagerOptions), nameof(DisableCrashingExtensions), defaultValue: true);
}
[ExportOptionProvider, Shared]
internal class ExtensionManagerOptionsProvider : IOptionProvider
{
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
ExtensionManagerOptions.DisableCrashingExtensions);
}
}
// 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 System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Editor.Options
{
internal static class NavigationBarOptions
{
[ExportOption]
public static readonly PerLanguageOption<bool> ShowNavigationBar = new PerLanguageOption<bool>(nameof(NavigationBarOptions), nameof(ShowNavigationBar), defaultValue: true);
}
[ExportOptionProvider, Shared]
internal class NavigationBarOptionsProvider : IOptionProvider
{
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
NavigationBarOptions.ShowNavigationBar);
}
}
// 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 System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Editor.Options
{
internal static class SignatureHelpOptions
{
[ExportOption]
public static readonly PerLanguageOption<bool> ShowSignatureHelp = new PerLanguageOption<bool>(nameof(SignatureHelpOptions), nameof(ShowSignatureHelp), defaultValue: true);
}
[ExportOptionProvider, Shared]
internal class SignatureHelpOptionsProvider : IOptionProvider
{
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
SignatureHelpOptions.ShowSignatureHelp);
}
}
// 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 System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Editor.Shared.Options
{
......@@ -11,21 +14,28 @@ internal static class EditorComponentOnOffOptions
{
private const string LocalRegistryPath = @"Roslyn\Internal\OnOff\Components\";
[ExportOption]
public static readonly Option<bool> Adornment = new Option<bool>(nameof(EditorComponentOnOffOptions), nameof(Adornment), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Adornment"));
[ExportOption]
public static readonly Option<bool> Tagger = new Option<bool>(nameof(EditorComponentOnOffOptions), nameof(Tagger), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Tagger"));
[ExportOption]
public static readonly Option<bool> CodeRefactorings = new Option<bool>(nameof(EditorComponentOnOffOptions), nameof(CodeRefactorings), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Code Refactorings"));
[ExportOption]
public static readonly Option<bool> ShowCodeRefactoringsWhenQueriedForCodeFixes = new Option<bool>(
nameof(EditorComponentOnOffOptions), nameof(ShowCodeRefactoringsWhenQueriedForCodeFixes), defaultValue: false,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + nameof(ShowCodeRefactoringsWhenQueriedForCodeFixes)));
}
[ExportOptionProvider, Shared]
internal class EditorComponentOnOffOptionsProvider : IOptionProvider
{
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
EditorComponentOnOffOptions.Adornment,
EditorComponentOnOffOptions.Tagger,
EditorComponentOnOffOptions.CodeRefactorings,
EditorComponentOnOffOptions.ShowCodeRefactoringsWhenQueriedForCodeFixes);
}
}
// 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 System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Editor.Shared.Options
{
internal static class FeatureOnOffOptions
{
[ExportOption]
public static readonly PerLanguageOption<bool> EndConstruct = new PerLanguageOption<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.
[ExportOption]
public static readonly PerLanguageOption<bool> AutomaticInsertionOfAbstractOrInterfaceMembers = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(AutomaticInsertionOfAbstractOrInterfaceMembers), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.AutoRequiredMemberInsert"));
[ExportOption]
public static readonly PerLanguageOption<bool> LineSeparator = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(LineSeparator), defaultValue: false,
storageLocations: new RoamingProfileStorageLocation(language => language == LanguageNames.VisualBasic ? "TextEditor.%LANGUAGE%.Specific.DisplayLineSeparators" : "TextEditor.%LANGUAGE%.Specific.Line Separator"));
[ExportOption]
public static readonly PerLanguageOption<bool> Outlining = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(Outlining), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Outlining"));
[ExportOption]
public static readonly PerLanguageOption<bool> KeywordHighlighting = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(KeywordHighlighting), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation(language => language == LanguageNames.VisualBasic ? "TextEditor.%LANGUAGE%.Specific.EnableHighlightRelatedKeywords" : "TextEditor.%LANGUAGE%.Specific.Keyword Highlighting"));
[ExportOption]
public static readonly PerLanguageOption<bool> ReferenceHighlighting = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(ReferenceHighlighting), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation(language => language == LanguageNames.VisualBasic ? "TextEditor.%LANGUAGE%.Specific.EnableHighlightReferences" : "TextEditor.%LANGUAGE%.Specific.Reference Highlighting"));
[ExportOption]
public static readonly PerLanguageOption<bool> FormatOnPaste = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(FormatOnPaste), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.FormatOnPaste"));
[ExportOption]
public static readonly PerLanguageOption<bool> AutoXmlDocCommentGeneration = new PerLanguageOption<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"));
[ExportOption]
public static readonly PerLanguageOption<bool> AutoInsertBlockCommentStartString = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(AutoInsertBlockCommentStartString), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Auto Insert Block Comment Start String"));
[ExportOption]
public static readonly PerLanguageOption<bool> PrettyListing = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(PrettyListing), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PrettyListing"));
[ExportOption]
public static readonly PerLanguageOption<bool> AutoFormattingOnTyping = new PerLanguageOption<bool>(
nameof(FeatureOnOffOptions), nameof(AutoFormattingOnTyping), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Auto Formatting On Typing"));
[ExportOption]
public static readonly PerLanguageOption<bool> AutoFormattingOnReturn = new PerLanguageOption<bool>(
nameof(FeatureOnOffOptions), nameof(AutoFormattingOnReturn), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Auto Formatting On Return"));
[ExportOption]
public static readonly PerLanguageOption<bool> AutoFormattingOnCloseBrace = new PerLanguageOption<bool>(
nameof(FeatureOnOffOptions), nameof(AutoFormattingOnCloseBrace), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Auto Formatting On Close Brace"));
[ExportOption]
public static readonly PerLanguageOption<bool> AutoFormattingOnSemicolon = new PerLanguageOption<bool>(
nameof(FeatureOnOffOptions), nameof(AutoFormattingOnSemicolon), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Auto Formatting On Semicolon"));
[ExportOption]
public static readonly PerLanguageOption<bool> RenameTrackingPreview = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(RenameTrackingPreview), defaultValue: true,
storageLocations: new RoamingProfileStorageLocation(language => language == LanguageNames.VisualBasic ? "TextEditor.%LANGUAGE%.Specific.RenameTrackingPreview" : "TextEditor.%LANGUAGE%.Specific.Rename Tracking Preview"));
......@@ -77,7 +65,6 @@ internal static class FeatureOnOffOptions
/// maintain any customized value for this setting, even through versions that have not
/// implemented this feature yet.
/// </summary>
[ExportOption]
public static readonly PerLanguageOption<bool> RenameTracking = new PerLanguageOption<bool>(nameof(FeatureOnOffOptions), nameof(RenameTracking), defaultValue: true);
/// <summary>
......@@ -86,12 +73,34 @@ internal static class FeatureOnOffOptions
/// maintain any customized value for this setting, even through versions that have not
/// implemented this feature yet.
/// </summary>
[ExportOption]
public static readonly PerLanguageOption<bool> RefactoringVerification = new PerLanguageOption<bool>(
nameof(FeatureOnOffOptions), nameof(RefactoringVerification), defaultValue: false);
[ExportOption]
public static readonly PerLanguageOption<bool> StreamingGoToImplementation = new PerLanguageOption<bool>(
nameof(FeatureOnOffOptions), nameof(StreamingGoToImplementation), defaultValue: true);
}
[ExportOptionProvider, Shared]
internal class FeatureOnOffOptionsProvider : IOptionProvider
{
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
FeatureOnOffOptions.EndConstruct,
FeatureOnOffOptions.AutomaticInsertionOfAbstractOrInterfaceMembers,
FeatureOnOffOptions.LineSeparator,
FeatureOnOffOptions.Outlining,
FeatureOnOffOptions.KeywordHighlighting,
FeatureOnOffOptions.ReferenceHighlighting,
FeatureOnOffOptions.FormatOnPaste,
FeatureOnOffOptions.AutoXmlDocCommentGeneration,
FeatureOnOffOptions.AutoInsertBlockCommentStartString,
FeatureOnOffOptions.PrettyListing,
FeatureOnOffOptions.AutoFormattingOnTyping,
FeatureOnOffOptions.AutoFormattingOnReturn,
FeatureOnOffOptions.AutoFormattingOnCloseBrace,
FeatureOnOffOptions.AutoFormattingOnSemicolon,
FeatureOnOffOptions.RenameTrackingPreview,
FeatureOnOffOptions.RenameTracking,
FeatureOnOffOptions.RefactoringVerification,
FeatureOnOffOptions.StreamingGoToImplementation);
}
}
// 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 System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Editor.Shared.Options
{
......@@ -8,82 +11,88 @@ internal static class InternalFeatureOnOffOptions
{
internal const string LocalRegistryPath = @"Roslyn\Internal\OnOff\Features\";
[ExportOption]
public static readonly Option<bool> BraceMatching = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(BraceMatching), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Brace Matching"));
[ExportOption]
public static readonly Option<bool> Classification = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(Classification), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Classification"));
[ExportOption]
public static readonly Option<bool> SemanticColorizer = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(SemanticColorizer), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Semantic Colorizer"));
[ExportOption]
public static readonly Option<bool> SyntacticColorizer = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(SyntacticColorizer), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Syntactic Colorizer"));
[ExportOption]
public static readonly Option<bool> AutomaticPairCompletion = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(AutomaticPairCompletion), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Automatic Pair Completion"));
[ExportOption]
public static readonly Option<bool> AutomaticLineEnder = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(AutomaticLineEnder), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Automatic Line Ender"));
[ExportOption]
public static readonly Option<bool> SmartIndenter = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(SmartIndenter), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Smart Indenter"));
[ExportOption]
public static readonly Option<bool> CompletionSet = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(CompletionSet), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Completion Set"));
[ExportOption]
public static readonly Option<bool> KeywordHighlight = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(KeywordHighlight), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Keyword Highlight"));
[ExportOption]
public static readonly Option<bool> QuickInfo = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(QuickInfo), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Quick Info"));
[ExportOption]
public static readonly Option<bool> Squiggles = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(Squiggles), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Squiggles"));
[ExportOption]
public static readonly Option<bool> FormatOnSave = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(FormatOnSave), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "FormatOnSave"));
[ExportOption]
public static readonly Option<bool> RenameTracking = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(RenameTracking), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Rename Tracking"));
[ExportOption]
public static readonly Option<bool> EventHookup = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(EventHookup), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Event Hookup"));
/// Due to https://github.com/dotnet/roslyn/issues/5393, the name "Snippets" is unusable for serialization.
/// (Summary: Some builds incorrectly set it without providing a way to clear it so it exists in many registries.)
[ExportOption]
public static readonly Option<bool> Snippets = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(Snippets), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Snippets2"));
[ExportOption]
public static readonly Option<bool> TodoComments = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(TodoComments), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Todo Comments"));
[ExportOption]
public static readonly Option<bool> DesignerAttributes = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(DesignerAttributes), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Designer Attribute"));
[ExportOption]
public static readonly Option<bool> FullSolutionAnalysisMemoryMonitor = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(FullSolutionAnalysisMemoryMonitor), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Full Solution Analysis Memory Monitor"));
[ExportOption]
public static readonly Option<bool> ProjectReferenceConversion = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(ProjectReferenceConversion), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "Project Reference Conversion"));
}
[ExportOptionProvider, Shared]
internal class InternalFeatureOnOffOptionsProvider : IOptionProvider
{
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
InternalFeatureOnOffOptions.BraceMatching,
InternalFeatureOnOffOptions.Classification,
InternalFeatureOnOffOptions.SemanticColorizer,
InternalFeatureOnOffOptions.SyntacticColorizer,
InternalFeatureOnOffOptions.AutomaticPairCompletion,
InternalFeatureOnOffOptions.AutomaticLineEnder,
InternalFeatureOnOffOptions.SmartIndenter,
InternalFeatureOnOffOptions.CompletionSet,
InternalFeatureOnOffOptions.KeywordHighlight,
InternalFeatureOnOffOptions.QuickInfo,
InternalFeatureOnOffOptions.Squiggles,
InternalFeatureOnOffOptions.FormatOnSave,
InternalFeatureOnOffOptions.RenameTracking,
InternalFeatureOnOffOptions.EventHookup,
InternalFeatureOnOffOptions.Snippets,
InternalFeatureOnOffOptions.TodoComments,
InternalFeatureOnOffOptions.DesignerAttributes,
InternalFeatureOnOffOptions.FullSolutionAnalysisMemoryMonitor,
InternalFeatureOnOffOptions.ProjectReferenceConversion);
}
}
// 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 System.Collections.Immutable;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
using Microsoft.CodeAnalysis.Remote;
using Roslyn.Test.Utilities.Remote;
using Roslyn.Utilities;
......@@ -13,11 +15,17 @@ namespace Microsoft.CodeAnalysis.Test.Utilities.RemoteHost
{
internal static class RemoteHostOptions
{
[ExportOption]
public static readonly Option<bool> RemoteHostTest = new Option<bool>(
nameof(RemoteHostOptions), nameof(RemoteHostTest), defaultValue: false);
}
[ExportOptionProvider, Shared]
internal class RemoteHostOptionsProvider : IOptionProvider
{
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
RemoteHostOptions.RemoteHostTest);
}
[ExportWorkspaceService(typeof(IRemoteHostClientFactory)), Shared]
internal class InProcRemoteHostClientFactory : IRemoteHostClientFactory
{
......
......@@ -33,7 +33,6 @@ public static Type[] GetLanguageNeutralTypes()
typeof(Solution), // ServicesCore
typeof(Microsoft.CodeAnalysis.Options.GlobalOptionService),
typeof(Microsoft.CodeAnalysis.Options.OptionServiceFactory),
typeof(Microsoft.CodeAnalysis.Options.Providers.ExportedOptionProvider),
typeof(Microsoft.CodeAnalysis.Editor.Implementation.SmartIndent.SmartIndentProvider),
typeof(Microsoft.CodeAnalysis.Editor.Implementation.ForegroundNotification.ForegroundNotificationService),
typeof(Microsoft.CodeAnalysis.Editor.UnitTests.TestOptionsServiceFactory),
......
// 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 System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.VisualStudio.LanguageServices.Implementation
{
......@@ -8,12 +11,19 @@ internal static class LoggerOptions
{
private const string LocalRegistryPath = @"Roslyn\Internal\Performance\Logger\";
[ExportOption]
public static readonly Option<bool> EtwLoggerKey = new Option<bool>(nameof(LoggerOptions), nameof(EtwLoggerKey), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "EtwLogger"));
[ExportOption]
public static readonly Option<bool> TraceLoggerKey = new Option<bool>(nameof(LoggerOptions), nameof(TraceLoggerKey), defaultValue: false,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + "TraceLoggerKey"));
}
[ExportOptionProvider, Shared]
internal class LoggerOptionsProvider : IOptionProvider
{
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
LoggerOptions.EtwLoggerKey,
LoggerOptions.TraceLoggerKey);
}
}
......@@ -86,7 +86,7 @@ internal sealed class LanguageSettingsPersister : ForegroundThreadAffinitizedObj
CompletionOptions.TriggerOnTyping,
SignatureHelpOptions.ShowSignatureHelp,
NavigationBarOptions.ShowNavigationBar,
BraceCompletionOptions.EnableBraceCompletion,
BraceCompletionOptions.Enable,
};
int IVsTextManagerEvents4.OnUserPreferencesChanged4(
......@@ -159,7 +159,7 @@ private static object GetValueForOption(IOption option, LANGPREFERENCES3 languag
{
return languagePreference.fDropdownBar != 0;
}
else if (option == BraceCompletionOptions.EnableBraceCompletion)
else if (option == BraceCompletionOptions.Enable)
{
return languagePreference.fBraceCompletion != 0;
}
......@@ -214,7 +214,7 @@ private static void SetValueForOption(IOption option, ref LANGPREFERENCES3 langu
{
languagePreference.fDropdownBar = Convert.ToUInt32((bool)value ? 1 : 0);
}
else if (option == BraceCompletionOptions.EnableBraceCompletion)
else if (option == BraceCompletionOptions.Enable)
{
languagePreference.fBraceCompletion = Convert.ToUInt32((bool)value ? 1 : 0);
}
......
// 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 System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Editor.Shared.Options;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.VisualStudio.LanguageServices.Remote
{
internal static class RemoteHostOptions
{
[ExportOption]
public static readonly Option<bool> RemoteHost = new Option<bool>(
nameof(InternalFeatureOnOffOptions), nameof(RemoteHost), defaultValue: true,
storageLocations: new LocalUserProfileStorageLocation(InternalFeatureOnOffOptions.LocalRegistryPath + nameof(RemoteHost)));
......@@ -23,7 +25,6 @@ internal static class RemoteHostOptions
//
// When primary workspace is staled, missing data will be synced to OOP on
// demand and cached for 3 min. enough for primary workspace in OOP to be synced to latest.
[ExportOption]
public static readonly Option<int> SolutionChecksumMonitorBackOffTimeSpanInMS = new Option<int>(
nameof(InternalFeatureOnOffOptions), nameof(SolutionChecksumMonitorBackOffTimeSpanInMS), defaultValue: 4000,
storageLocations: new LocalUserProfileStorageLocation(InternalFeatureOnOffOptions.LocalRegistryPath + nameof(SolutionChecksumMonitorBackOffTimeSpanInMS)));
......@@ -34,18 +35,26 @@ internal static class RemoteHostOptions
// this is our timeout on how long we will try keep connecting. so far I saw over 2-3 seconds before connection made
// when there are many (over 10+ requests) at the same time. one of reasons of this is we put our service hub process as "Below Normal" priority.
// normally response time is within 10s ms. at most 100ms. if priority is changed to "Normal", most of time 10s ms.
[ExportOption]
public static readonly Option<int> RequestServiceTimeoutInMS = new Option<int>(
nameof(InternalFeatureOnOffOptions), nameof(RequestServiceTimeoutInMS), defaultValue: 10 * 60 * 1000,
storageLocations: new LocalUserProfileStorageLocation(InternalFeatureOnOffOptions.LocalRegistryPath + nameof(RequestServiceTimeoutInMS)));
// This options allow users to restart OOP when it is killed by users
[ExportOption]
public static readonly Option<bool> RestartRemoteHostAllowed = new Option<bool>(
nameof(InternalFeatureOnOffOptions), nameof(RestartRemoteHostAllowed), defaultValue: false,
storageLocations: new LocalUserProfileStorageLocation(InternalFeatureOnOffOptions.LocalRegistryPath + nameof(RestartRemoteHostAllowed)));
[ExportOption]
public static readonly Option<bool> RemoteHostTest = new Option<bool>(nameof(InternalFeatureOnOffOptions), nameof(RemoteHostTest), defaultValue: false);
}
[ExportOptionProvider, Shared]
internal class RemoteHostOptionsProvider : IOptionProvider
{
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
RemoteHostOptions.RemoteHost,
RemoteHostOptions.SolutionChecksumMonitorBackOffTimeSpanInMS,
RemoteHostOptions.RequestServiceTimeoutInMS,
RemoteHostOptions.RestartRemoteHostAllowed,
RemoteHostOptions.RemoteHostTest);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// 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 System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.VisualStudio.LanguageServices.FindUsages
{
......@@ -17,9 +17,16 @@ internal static class FindUsagesOptions
/// and we want to restore the value back to its original state when the user does the
/// next FindReferences call.
/// </summary>
[ExportOption]
public static readonly Option<int> DefinitionGroupingPriority = new Option<int>(
nameof(FindUsagesOptions), nameof(DefinitionGroupingPriority), defaultValue: -1,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + nameof(DefinitionGroupingPriority)));
}
[ExportOptionProvider, Shared]
internal class FindUsagesOptionsProvider : IOptionProvider
{
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
FindUsagesOptions.DefinitionGroupingPriority);
}
}
// 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 System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Roslyn.VisualStudio.DiagnosticsWindow.Remote
{
......@@ -8,9 +11,15 @@ internal static class RemoteHostClientFactoryOptions
{
internal const string LocalRegistryPath = @"Roslyn\Internal\OnOff\Features\";
[ExportOption]
public static readonly Option<bool> RemoteHost_InProc = new Option<bool>(
"InternalFeatureOnOffOptions", nameof(RemoteHost_InProc), defaultValue: false,
storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + nameof(RemoteHost_InProc)));
}
[ExportOptionProvider, Shared]
internal class RemoteHostClientFactoryOptionsProvider : IOptionProvider
{
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
RemoteHostClientFactoryOptions.RemoteHost_InProc);
}
}
// 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 System;
using System.ComponentModel.Composition;
namespace Microsoft.CodeAnalysis.Options
{
[MetadataAttribute]
[AttributeUsage(AttributeTargets.Field)]
internal sealed class ExportOptionAttribute : ExportAttribute
{
public ExportOptionAttribute()
: base(typeof(IOption))
{
}
}
}
// 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 System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
namespace Microsoft.CodeAnalysis.Options.Providers
{
[ExportOptionProvider, Shared]
internal class ExportedOptionProvider : IOptionProvider
{
private readonly IEnumerable<Lazy<IOption>> _options;
[ImportingConstructor]
public ExportedOptionProvider([ImportMany] IEnumerable<Lazy<IOption>> options)
{
_options = options;
}
public ImmutableArray<IOption> Options
=> _options.Select(lazy => lazy.Value).ToImmutableArray();
}
}
// 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 System;
using System.Collections.Immutable;
using System.Composition;
using System.Diagnostics;
using System.IO;
using System.Text;
......@@ -9,6 +11,7 @@
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
......@@ -24,11 +27,17 @@ internal static class FileTextLoaderOptions
/// User can override default value by setting DWORD value on FileLengthThreshold in
/// "[VS HIVE]\Roslyn\Internal\Performance\Text"
/// </summary>
[ExportOption]
internal static readonly Option<long> FileLengthThreshold = new Option<long>(nameof(FileTextLoaderOptions), nameof(FileLengthThreshold), defaultValue: 100 * 1024 * 1024,
storageLocations: new LocalUserProfileStorageLocation(@"Roslyn\Internal\Performance\Text\FileLengthThreshold"));
}
[ExportOptionProvider, Shared]
internal class FileTextLoaderOptionsProvider : IOptionProvider
{
public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
FileTextLoaderOptions.FileLengthThreshold);
}
[DebuggerDisplay("{GetDebuggerDisplay(), nq}")]
public class FileTextLoader : TextLoader
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册