提交 94e1d263 编写于 作者: D Dustin Campbell

Remove Features dependency on Workspaces.Desktop

Several options in the Features layer were still defined as static fields attributed with ExportOption, which is located in Workspaces.Desktop. Portable MEF does not support static fields for exports so it's necessary to implement IOptionsProviders for each set of options.
上级 289c7c1d
......@@ -8,16 +8,9 @@ internal static class CompletionOptions
{
public const string FeatureName = "Completion";
[ExportOption]
public static readonly PerLanguageOption<bool> HideAdvancedMembers = new PerLanguageOption<bool>(FeatureName, "HideAdvancedMembers", defaultValue: false);
[ExportOption]
public static readonly PerLanguageOption<bool> IncludeKeywords = new PerLanguageOption<bool>(FeatureName, "IncludeKeywords", defaultValue: true);
[ExportOption]
public static readonly PerLanguageOption<bool> TriggerOnTyping = new PerLanguageOption<bool>(FeatureName, "TriggerOnTyping", defaultValue: true);
[ExportOption]
public static readonly PerLanguageOption<bool> TriggerOnTypingLetters = new PerLanguageOption<bool>(FeatureName, "TriggerOnTypingLetters", defaultValue: true);
}
}
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Completion
{
[ExportOptionProvider, Shared]
internal class CompletionOptionsProvider : IOptionProvider
{
private readonly IEnumerable<IOption> _options = new List<IOption>
{
CompletionOptions.HideAdvancedMembers,
CompletionOptions.IncludeKeywords,
CompletionOptions.TriggerOnTyping,
CompletionOptions.TriggerOnTypingLetters
}.ToImmutableArray();
public IEnumerable<IOption> GetOptions()
{
return _options;
}
}
}
......@@ -8,28 +8,13 @@ internal static class InternalDiagnosticsOptions
{
public const string OptionName = "InternalDiagnosticsOptions";
[ExportOption]
public static readonly Option<bool> BlueSquiggleForBuildDiagnostic = new Option<bool>(OptionName, "Blue Squiggle For Build Diagnostic", defaultValue: false);
[ExportOption]
public static readonly Option<bool> UseDiagnosticEngineV2 = new Option<bool>(OptionName, "Use Diagnostic Engine V2", defaultValue: false);
[ExportOption]
public static readonly Option<bool> CompilationEndCodeFix = new Option<bool>(OptionName, "Enable Compilation End Code Fix", defaultValue: true);
[ExportOption]
public static readonly Option<bool> UseCompilationEndCodeFixHeuristic = new Option<bool>(OptionName, "Enable Compilation End Code Fix With Heuristic", defaultValue: true);
[ExportOption]
public static readonly Option<bool> BuildErrorIsTheGod = new Option<bool>(OptionName, "Make build errors to take over everything", defaultValue: false);
[ExportOption]
public static readonly Option<bool> ClearLiveErrorsForProjectBuilt = new Option<bool>(OptionName, "Clear all live errors of projects that got built", defaultValue: false);
[ExportOption]
public static readonly Option<bool> PreferLiveErrorsOnOpenedFiles = new Option<bool>(OptionName, "Live errors will be preferred over errors from build on opened files from same analyzer", defaultValue: true);
[ExportOption]
public static readonly Option<bool> PreferBuildErrorsOverLiveErrors = new Option<bool>(OptionName, "Errors from build will be preferred over live errors from same analyzer", defaultValue: true);
}
}
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Diagnostics
{
[ExportOptionProvider, Shared]
internal class InternalDiagnosticsOptionsProvider : IOptionProvider
{
private readonly IEnumerable<IOption> _options = new List<IOption>
{
InternalDiagnosticsOptions.BlueSquiggleForBuildDiagnostic,
InternalDiagnosticsOptions.UseDiagnosticEngineV2,
InternalDiagnosticsOptions.CompilationEndCodeFix,
InternalDiagnosticsOptions.UseCompilationEndCodeFixHeuristic,
InternalDiagnosticsOptions.BuildErrorIsTheGod,
InternalDiagnosticsOptions.ClearLiveErrorsForProjectBuilt,
InternalDiagnosticsOptions.PreferLiveErrorsOnOpenedFiles,
InternalDiagnosticsOptions.PreferBuildErrorsOverLiveErrors
}.ToImmutableArray();
public IEnumerable<IOption> GetOptions()
{
return _options;
}
}
}
......@@ -8,13 +8,8 @@ internal static class ExtractMethodOptions
{
public const string FeatureName = "ExtractMethod";
[ExportOption]
public static readonly PerLanguageOption<bool> AllowBestEffort = new PerLanguageOption<bool>(FeatureName, "Allow Best Effort", defaultValue: false);
[ExportOption]
public static readonly PerLanguageOption<bool> DontPutOutOrRefOnStruct = new PerLanguageOption<bool>(FeatureName, "Don't Put Out Or Ref On Strcut", defaultValue: true);
[ExportOption]
public static readonly PerLanguageOption<bool> AllowMovingDeclaration = new PerLanguageOption<bool>(FeatureName, "Allow Moving Declaration", defaultValue: false);
}
}
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.ExtractMethod
{
[ExportOptionProvider, Shared]
internal class ExtractMethodOptionsProvider : IOptionProvider
{
private readonly IEnumerable<IOption> _options = new List<IOption>
{
ExtractMethodOptions.AllowBestEffort,
ExtractMethodOptions.DontPutOutOrRefOnStruct,
ExtractMethodOptions.AllowMovingDeclaration
}.ToImmutableArray();
public IEnumerable<IOption> GetOptions()
{
return _options;
}
}
}
......@@ -47,10 +47,6 @@
<Project>{1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}</Project>
<Name>CodeAnalysis</Name>
</ProjectReference>
<ProjectReference Include="..\..\Workspaces\Core\Desktop\Workspaces.Desktop.csproj">
<Project>{2e87fa96-50bb-4607-8676-46521599f998}</Project>
<Name>Workspaces.Desktop</Name>
</ProjectReference>
<ProjectReference Include="..\..\Workspaces\Core\Portable\Workspaces.csproj">
<Project>{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}</Project>
<Name>Workspaces</Name>
......@@ -159,6 +155,7 @@
<Compile Include="Completion\CompletionList.cs" />
<Compile Include="Completion\CompletionListContext.cs" />
<Compile Include="Completion\CompletionOptions.cs" />
<Compile Include="Completion\CompletionOptionsProvider.cs" />
<Compile Include="Completion\CompletionService.cs" />
<Compile Include="Completion\CompletionTriggerInfo.cs" />
<Compile Include="Completion\CompletionTriggerReason.cs" />
......@@ -187,6 +184,7 @@
<Compile Include="Diagnostics\AnalyzerUpdateArgsId.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.SolutionCrawlerAnalysisState.cs" />
<Compile Include="Diagnostics\HostDiagnosticAnalyzerPackage.cs" />
<Compile Include="Diagnostics\InternalDiagnosticsOptionsProvider.cs" />
<Compile Include="Diagnostics\PredefinedBuildTools.cs" />
<Compile Include="Diagnostics\DiagnosticAnalyzerService_BuildSynchronization.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.ProjectAnalyzerReferenceChangedEventArgs.cs" />
......@@ -235,6 +233,7 @@
<Compile Include="EditAndContinue\BidirectionalMap.cs" />
<Compile Include="EditAndContinue\StateMachineKind.cs" />
<Compile Include="EditAndContinue\TraceLog.cs" />
<Compile Include="ExtractMethod\ExtractMethodOptionsProvider.cs" />
<Compile Include="FeaturesResources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
......@@ -252,7 +251,10 @@
<Compile Include="IntroduceVariable\AbstractIntroduceVariableService.IntroduceVariableAllOccurrenceCodeAction.cs" />
<Compile Include="LanguageServices\ProjectInfoService\IProjectInfoService.cs" />
<Compile Include="QuickInfo\QuickInfoUtilities.cs" />
<Compile Include="Shared\Options\OrganizerOptionsProvider.cs" />
<Compile Include="Shared\Options\ServiceComponentOnOffOptionsProvider.cs" />
<Compile Include="Shared\Options\ServiceFeatureOnOffOptions.cs" />
<Compile Include="Shared\Options\ServiceFeatureOnOffOptionsProvider.cs" />
<Compile Include="Shared\Utilities\LinkedFilesSymbolEquivalenceComparer.cs" />
<Compile Include="Shared\Utilities\SupportedPlatformData.cs" />
<Compile Include="Completion\Providers\SymbolCompletionItem.cs" />
......@@ -512,6 +514,7 @@
<Compile Include="SolutionCrawler\IIncrementalAnalyzer.cs" />
<Compile Include="SolutionCrawler\IncrementalAnalyzerBase.cs" />
<Compile Include="SolutionCrawler\IncrementalAnalyzerProviderBase.cs" />
<Compile Include="SolutionCrawler\InternalSolutionCrawlerOptionsProvider.cs" />
<Compile Include="SolutionCrawler\InvocationReasons.cs" />
<Compile Include="SolutionCrawler\InvocationReasons_Constants.cs" />
<Compile Include="SolutionCrawler\ISolutionCrawlerProgressReporter.cs" />
......
......@@ -11,7 +11,7 @@ internal partial class OrganizerOptions
public static PerLanguageOption<bool> PlaceSystemNamespaceFirst
{
get { return Microsoft.CodeAnalysis.Editing.GenerationOptions.PlaceSystemNamespaceFirst; }
get { return Editing.GenerationOptions.PlaceSystemNamespaceFirst; }
}
/// <summary>
......@@ -20,7 +20,6 @@ public static PerLanguageOption<bool> PlaceSystemNamespaceFirst
/// maintain any customized value for this setting, even through versions that have not
/// implemented this feature yet.
/// </summary>
[ExportOption]
public static readonly PerLanguageOption<bool> WarnOnBuildErrors = new PerLanguageOption<bool>(FeatureName, "WarnOnBuildErrors", defaultValue: true);
}
}
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Shared.Options
{
[ExportOptionProvider, Shared]
internal class OrganizerOptionsProvider : IOptionProvider
{
private readonly IEnumerable<IOption> _options = new List<IOption>
{
OrganizerOptions.WarnOnBuildErrors
}.ToImmutableArray();
public IEnumerable<IOption> GetOptions()
{
return _options;
}
}
}
......@@ -11,7 +11,6 @@ internal static class ServiceComponentOnOffOptions
{
public const string OptionName = "FeatureManager/Components";
[ExportOption]
public static readonly Option<bool> DiagnosticProvider = new Option<bool>(OptionName, "Diagnostic Provider", defaultValue: true);
}
}
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Shared.Options
{
[ExportOptionProvider, Shared]
internal class ServiceComponentOnOffOptionsProvider : IOptionProvider
{
private readonly IEnumerable<IOption> _options = new List<IOption>
{
ServiceComponentOnOffOptions.DiagnosticProvider
}.ToImmutableArray();
public IEnumerable<IOption> GetOptions()
{
return _options;
}
}
}
......@@ -8,7 +8,6 @@ internal static class ServiceFeatureOnOffOptions
{
public const string OptionName = "ServiceFeaturesOnOff";
[ExportOption]
public static readonly PerLanguageOption<bool> ClosedFileDiagnostic = new PerLanguageOption<bool>(OptionName, "Closed File Diagnostic", defaultValue: true);
}
}
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.Shared.Options
{
[ExportOptionProvider, Shared]
internal class ServiceFeatureOnOffOptionsProvider : IOptionProvider
{
private readonly IEnumerable<IOption> _options = new List<IOption>
{
ServiceFeatureOnOffOptions.ClosedFileDiagnostic
}.ToImmutableArray();
public IEnumerable<IOption> GetOptions()
{
return _options;
}
}
}
......@@ -8,25 +8,12 @@ internal static class InternalSolutionCrawlerOptions
{
public const string OptionName = "SolutionCrawler";
[ExportOption]
public static readonly Option<bool> SolutionCrawler = new Option<bool>("FeatureManager/Components", "Solution Crawler", defaultValue: true);
[ExportOption]
public static readonly Option<int> ActiveFileWorkerBackOffTimeSpanInMS = new Option<int>(OptionName, "Active file worker backoff timespan in ms", defaultValue: 800);
[ExportOption]
public static readonly Option<int> AllFilesWorkerBackOffTimeSpanInMS = new Option<int>(OptionName, "All files worker backoff timespan in ms", defaultValue: 1500);
[ExportOption]
public static readonly Option<int> EntireProjectWorkerBackOffTimeSpanInMS = new Option<int>(OptionName, "Entire project analysis worker backoff timespan in ms", defaultValue: 5000);
[ExportOption]
public static readonly Option<int> SemanticChangeBackOffTimeSpanInMS = new Option<int>(OptionName, "Semantic change backoff timespan in ms", defaultValue: 100);
[ExportOption]
public static readonly Option<int> ProjectPropagationBackOffTimeSpanInMS = new Option<int>(OptionName, "Project propagation backoff timespan in ms", defaultValue: 500);
[ExportOption]
public static readonly Option<int> PreviewBackOffTimeSpanInMS = new Option<int>(OptionName, "Preview backoff timespan in ms", defaultValue: 500);
}
}
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Options.Providers;
namespace Microsoft.CodeAnalysis.SolutionCrawler
{
[ExportOptionProvider, Shared]
internal class InternalSolutionCrawlerOptionsProvider : IOptionProvider
{
private readonly IEnumerable<IOption> _options = new List<IOption>
{
InternalSolutionCrawlerOptions.SolutionCrawler,
InternalSolutionCrawlerOptions.ActiveFileWorkerBackOffTimeSpanInMS,
InternalSolutionCrawlerOptions.AllFilesWorkerBackOffTimeSpanInMS,
InternalSolutionCrawlerOptions.EntireProjectWorkerBackOffTimeSpanInMS,
InternalSolutionCrawlerOptions.SemanticChangeBackOffTimeSpanInMS,
InternalSolutionCrawlerOptions.ProjectPropagationBackOffTimeSpanInMS,
InternalSolutionCrawlerOptions.PreviewBackOffTimeSpanInMS
}.ToImmutableArray();
public IEnumerable<IOption> GetOptions()
{
return _options;
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册