Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1123)

Side by Side Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 2382053002: Remove unused option in server API (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analysis.server; 5 library analysis.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:core'; 9 import 'dart:core';
10 import 'dart:io' as io; 10 import 'dart:io' as io;
(...skipping 12 matching lines...) Expand all
23 import 'package:analysis_server/src/services/index/index.dart'; 23 import 'package:analysis_server/src/services/index/index.dart';
24 import 'package:analysis_server/src/services/search/search_engine.dart'; 24 import 'package:analysis_server/src/services/search/search_engine.dart';
25 import 'package:analysis_server/src/services/search/search_engine_internal.dart' ; 25 import 'package:analysis_server/src/services/search/search_engine_internal.dart' ;
26 import 'package:analysis_server/src/single_context_manager.dart'; 26 import 'package:analysis_server/src/single_context_manager.dart';
27 import 'package:analyzer/dart/ast/ast.dart'; 27 import 'package:analyzer/dart/ast/ast.dart';
28 import 'package:analyzer/dart/element/element.dart'; 28 import 'package:analyzer/dart/element/element.dart';
29 import 'package:analyzer/exception/exception.dart'; 29 import 'package:analyzer/exception/exception.dart';
30 import 'package:analyzer/file_system/file_system.dart'; 30 import 'package:analyzer/file_system/file_system.dart';
31 import 'package:analyzer/instrumentation/instrumentation.dart'; 31 import 'package:analyzer/instrumentation/instrumentation.dart';
32 import 'package:analyzer/plugin/resolver_provider.dart'; 32 import 'package:analyzer/plugin/resolver_provider.dart';
33 import 'package:analyzer/source/pub_package_map_provider.dart';
34 import 'package:analyzer/src/context/builder.dart'; 33 import 'package:analyzer/src/context/builder.dart';
35 import 'package:analyzer/src/dart/ast/utilities.dart'; 34 import 'package:analyzer/src/dart/ast/utilities.dart';
36 import 'package:analyzer/src/generated/engine.dart'; 35 import 'package:analyzer/src/generated/engine.dart';
37 import 'package:analyzer/src/generated/sdk.dart'; 36 import 'package:analyzer/src/generated/sdk.dart';
38 import 'package:analyzer/src/generated/source.dart'; 37 import 'package:analyzer/src/generated/source.dart';
39 import 'package:analyzer/src/generated/source_io.dart'; 38 import 'package:analyzer/src/generated/source_io.dart';
40 import 'package:analyzer/src/generated/utilities_general.dart'; 39 import 'package:analyzer/src/generated/utilities_general.dart';
41 import 'package:analyzer/src/summary/package_bundle_reader.dart';
42 import 'package:analyzer/src/summary/pub_summary.dart'; 40 import 'package:analyzer/src/summary/pub_summary.dart';
43 import 'package:analyzer/src/task/dart.dart'; 41 import 'package:analyzer/src/task/dart.dart';
44 import 'package:analyzer/src/util/glob.dart'; 42 import 'package:analyzer/src/util/glob.dart';
45 import 'package:analyzer/task/dart.dart'; 43 import 'package:analyzer/task/dart.dart';
46 import 'package:plugin/plugin.dart'; 44 import 'package:plugin/plugin.dart';
47 45
48 typedef void OptionUpdater(AnalysisOptionsImpl options); 46 typedef void OptionUpdater(AnalysisOptionsImpl options);
49 47
50 /** 48 /**
51 * Enum representing reasons why analysis might be done for a given file. 49 * Enum representing reasons why analysis might be done for a given file.
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 * responses to the given [channel]. 311 * responses to the given [channel].
314 * 312 *
315 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are 313 * If [rethrowExceptions] is true, then any exceptions thrown by analysis are
316 * propagated up the call stack. The default is true to allow analysis 314 * propagated up the call stack. The default is true to allow analysis
317 * exceptions to show up in unit tests, but it should be set to false when 315 * exceptions to show up in unit tests, but it should be set to false when
318 * running a full analysis server. 316 * running a full analysis server.
319 */ 317 */
320 AnalysisServer( 318 AnalysisServer(
321 this.channel, 319 this.channel,
322 this.resourceProvider, 320 this.resourceProvider,
323 PubPackageMapProvider packageMapProvider,
324 Index _index, 321 Index _index,
325 this.serverPlugin, 322 this.serverPlugin,
326 this.options, 323 this.options,
327 this.sdkManager, 324 this.sdkManager,
328 this.instrumentationService, 325 this.instrumentationService,
329 {ResolverProvider fileResolverProvider: null, 326 {ResolverProvider fileResolverProvider: null,
330 ResolverProvider packageResolverProvider: null, 327 ResolverProvider packageResolverProvider: null,
331 bool useSingleContextManager: false, 328 bool useSingleContextManager: false,
332 this.rethrowExceptions: true}) 329 this.rethrowExceptions: true})
333 : index = _index, 330 : index = _index,
334 searchEngine = _index != null ? new SearchEngineImpl(_index) : null { 331 searchEngine = _index != null ? new SearchEngineImpl(_index) : null {
335 _performance = performanceDuringStartup; 332 _performance = performanceDuringStartup;
336 defaultContextOptions.incremental = true; 333 defaultContextOptions.incremental = true;
337 defaultContextOptions.incrementalApi = 334 defaultContextOptions.incrementalApi =
338 options.enableIncrementalResolutionApi; 335 options.enableIncrementalResolutionApi;
339 defaultContextOptions.incrementalValidation = 336 defaultContextOptions.incrementalValidation =
340 options.enableIncrementalResolutionValidation; 337 options.enableIncrementalResolutionValidation;
341 defaultContextOptions.finerGrainedInvalidation = 338 defaultContextOptions.finerGrainedInvalidation =
342 options.finerGrainedInvalidation; 339 options.finerGrainedInvalidation;
343 defaultContextOptions.generateImplicitErrors = false; 340 defaultContextOptions.generateImplicitErrors = false;
344 operationQueue = new ServerOperationQueue(); 341 operationQueue = new ServerOperationQueue();
345 if (useSingleContextManager) { 342 if (useSingleContextManager) {
346 contextManager = new SingleContextManager(resourceProvider, sdkManager, 343 contextManager = new SingleContextManager(resourceProvider, sdkManager,
347 packageResolverProvider, analyzedFilesGlobs, defaultContextOptions); 344 packageResolverProvider, analyzedFilesGlobs, defaultContextOptions);
348 } else { 345 } else {
349 contextManager = new ContextManagerImpl( 346 contextManager = new ContextManagerImpl(
350 resourceProvider, 347 resourceProvider,
351 sdkManager, 348 sdkManager,
352 packageResolverProvider, 349 packageResolverProvider,
353 packageMapProvider,
354 analyzedFilesGlobs, 350 analyzedFilesGlobs,
355 instrumentationService, 351 instrumentationService,
356 defaultContextOptions); 352 defaultContextOptions);
357 } 353 }
358 this.fileResolverProvider = fileResolverProvider; 354 this.fileResolverProvider = fileResolverProvider;
359 this.packageResolverProvider = packageResolverProvider; 355 this.packageResolverProvider = packageResolverProvider;
360 ServerContextManagerCallbacks contextManagerCallbacks = 356 ServerContextManagerCallbacks contextManagerCallbacks =
361 new ServerContextManagerCallbacks(this, resourceProvider); 357 new ServerContextManagerCallbacks(this, resourceProvider);
362 contextManager.callbacks = contextManagerCallbacks; 358 contextManager.callbacks = contextManagerCallbacks;
363 _noErrorNotification = options.noErrorNotification; 359 _noErrorNotification = options.noErrorNotification;
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 // to be scheduled for this context. 1417 // to be scheduled for this context.
1422 } 1418 }
1423 // 1419 //
1424 // Update the defaults used to create new contexts. 1420 // Update the defaults used to create new contexts.
1425 // 1421 //
1426 optionUpdaters.forEach((OptionUpdater optionUpdater) { 1422 optionUpdaters.forEach((OptionUpdater optionUpdater) {
1427 optionUpdater(defaultContextOptions); 1423 optionUpdater(defaultContextOptions);
1428 }); 1424 });
1429 } 1425 }
1430 1426
1431 void _computingPackageMap(bool computing) {
1432 if (serverServices.contains(ServerService.STATUS)) {
1433 PubStatus pubStatus = new PubStatus(computing);
1434 ServerStatusParams params = new ServerStatusParams(pub: pubStatus);
1435 sendNotification(params.toNotification());
1436 }
1437 }
1438
1439 /** 1427 /**
1440 * Return a set of all contexts whose associated folder is contained within, 1428 * Return a set of all contexts whose associated folder is contained within,
1441 * or equal to, one of the resources in the given list of [resources]. 1429 * or equal to, one of the resources in the given list of [resources].
1442 */ 1430 */
1443 Set<AnalysisContext> _getContexts(List<Resource> resources) { 1431 Set<AnalysisContext> _getContexts(List<Resource> resources) {
1444 Set<AnalysisContext> contexts = new HashSet<AnalysisContext>(); 1432 Set<AnalysisContext> contexts = new HashSet<AnalysisContext>();
1445 resources.forEach((Resource resource) { 1433 resources.forEach((Resource resource) {
1446 if (resource is Folder) { 1434 if (resource is Folder) {
1447 contexts.addAll(contextManager.contextsInAnalysisRoot(resource)); 1435 contexts.addAll(contextManager.contextsInAnalysisRoot(resource));
1448 } 1436 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 analysisServer.schedulePerformAnalysisOperation(context); 1607 analysisServer.schedulePerformAnalysisOperation(context);
1620 List<String> flushedFiles = new List<String>(); 1608 List<String> flushedFiles = new List<String>();
1621 for (Source source in changeSet.removedSources) { 1609 for (Source source in changeSet.removedSources) {
1622 flushedFiles.add(source.fullName); 1610 flushedFiles.add(source.fullName);
1623 } 1611 }
1624 sendAnalysisNotificationFlushResults(analysisServer, flushedFiles); 1612 sendAnalysisNotificationFlushResults(analysisServer, flushedFiles);
1625 } 1613 }
1626 } 1614 }
1627 1615
1628 @override 1616 @override
1629 void computingPackageMap(bool computing) =>
1630 analysisServer._computingPackageMap(computing);
1631
1632 @override
1633 ContextBuilder createContextBuilder(Folder folder, AnalysisOptions options) { 1617 ContextBuilder createContextBuilder(Folder folder, AnalysisOptions options) {
1634 String defaultPackageFilePath = null; 1618 String defaultPackageFilePath = null;
1635 String defaultPackagesDirectoryPath = null; 1619 String defaultPackagesDirectoryPath = null;
1636 String path = (analysisServer.contextManager as ContextManagerImpl) 1620 String path = (analysisServer.contextManager as ContextManagerImpl)
1637 .normalizedPackageRoots[folder.path]; 1621 .normalizedPackageRoots[folder.path];
1638 if (path != null) { 1622 if (path != null) {
1639 Resource resource = resourceProvider.getResource(path); 1623 Resource resource = resourceProvider.getResource(path);
1640 if (resource.exists) { 1624 if (resource.exists) {
1641 if (resource is File) { 1625 if (resource is File) {
1642 defaultPackageFilePath = path; 1626 defaultPackageFilePath = path;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 /** 1765 /**
1782 * The [PerformanceTag] for time spent in server request handlers. 1766 * The [PerformanceTag] for time spent in server request handlers.
1783 */ 1767 */
1784 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); 1768 static PerformanceTag serverRequests = new PerformanceTag('serverRequests');
1785 1769
1786 /** 1770 /**
1787 * The [PerformanceTag] for time spent in split store microtasks. 1771 * The [PerformanceTag] for time spent in split store microtasks.
1788 */ 1772 */
1789 static PerformanceTag splitStore = new PerformanceTag('splitStore'); 1773 static PerformanceTag splitStore = new PerformanceTag('splitStore');
1790 } 1774 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/plugin/protocol/generated_protocol.dart ('k') | pkg/analysis_server/lib/src/context_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698