| Index: pkg/analysis_server/lib/src/analysis_server.dart
|
| diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
|
| index 6e7f35d45d2812fcc38d8e7333e4eba6b3449dbc..fe0b55f11713b65024f15464749615bd3c350b06 100644
|
| --- a/pkg/analysis_server/lib/src/analysis_server.dart
|
| +++ b/pkg/analysis_server/lib/src/analysis_server.dart
|
| @@ -36,6 +36,11 @@ final DirectoryBasedDartSdk SHARED_SDK = DirectoryBasedDartSdk.defaultSdk;
|
| class AnalysisServerContextDirectoryManager extends ContextDirectoryManager {
|
| final AnalysisServer analysisServer;
|
|
|
| + /**
|
| + * The default options used to create new analysis contexts.
|
| + */
|
| + AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl();
|
| +
|
| AnalysisServerContextDirectoryManager(this.analysisServer, ResourceProvider resourceProvider)
|
| : super(resourceProvider);
|
|
|
| @@ -44,7 +49,9 @@ class AnalysisServerContextDirectoryManager extends ContextDirectoryManager {
|
| ContextDirectory contextDirectory = new ContextDirectory(
|
| analysisServer.defaultSdk, folder, pubspecFile);
|
| analysisServer.folderMap[folder] = contextDirectory;
|
| - analysisServer.schedulePerformAnalysisOperation(contextDirectory.context);
|
| + AnalysisContext context = contextDirectory.context;
|
| + context.analysisOptions = new AnalysisOptionsImpl.con1(defaultOptions);
|
| + analysisServer.schedulePerformAnalysisOperation(context);
|
| }
|
|
|
| @override
|
| @@ -210,6 +217,31 @@ class AnalysisServer {
|
| }
|
|
|
| /**
|
| + * Use the given updaters to update the values of the options in every
|
| + * existing analysis context.
|
| + */
|
| + void updateOptions(List<OptionUpdater> optionUpdaters) {
|
| + //
|
| + // Update existing contexts.
|
| + //
|
| + folderMap.forEach((Folder folder, ContextDirectory directory) {
|
| + AnalysisContext context = directory.context;
|
| + AnalysisOptionsImpl options = new AnalysisOptionsImpl.con1(context.analysisOptions);
|
| + optionUpdaters.forEach((OptionUpdater optionUpdater) {
|
| + optionUpdater(options);
|
| + });
|
| + context.analysisOptions = options;
|
| + });
|
| + //
|
| + // Update the defaults used to create new contexts.
|
| + //
|
| + AnalysisOptionsImpl options = contextDirectoryManager.defaultOptions;
|
| + optionUpdaters.forEach((OptionUpdater optionUpdater) {
|
| + optionUpdater(options);
|
| + });
|
| + }
|
| +
|
| + /**
|
| * Adds the given [ServerOperation] to the queue, but does not schedule
|
| * operations execution.
|
| */
|
| @@ -540,6 +572,7 @@ class ContextDirectory {
|
| AnalysisContext get context => _context;
|
| }
|
|
|
| +typedef void OptionUpdater(AnalysisOptionsImpl options);
|
|
|
| /**
|
| * An enumeration of the services provided by the server domain.
|
|
|