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

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

Issue 854493002: Have the analysis server not send error notifications when NO_ERROR_NOTIFICATION has been set to tr… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: update flag description Created 5 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/server/driver.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9
10 import 'package:analysis_server/src/analysis_logger.dart'; 10 import 'package:analysis_server/src/analysis_logger.dart';
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 new HashMap<AnalysisService, Set<String>>(); 147 new HashMap<AnalysisService, Set<String>>();
148 148
149 /** 149 /**
150 * A table mapping [AnalysisContext]s to the completers that should be 150 * A table mapping [AnalysisContext]s to the completers that should be
151 * completed when analysis of this context is finished. 151 * completed when analysis of this context is finished.
152 */ 152 */
153 Map<AnalysisContext, Completer<AnalysisDoneReason>> contextAnalysisDoneComplet ers = 153 Map<AnalysisContext, Completer<AnalysisDoneReason>> contextAnalysisDoneComplet ers =
154 new HashMap<AnalysisContext, Completer<AnalysisDoneReason>>(); 154 new HashMap<AnalysisContext, Completer<AnalysisDoneReason>>();
155 155
156 /** 156 /**
157 * The option possibly set from the server initialization which disables error notifications.
158 */
159 bool _noErrorNotification;
160
161 /**
157 * The controller that is notified when analysis is started. 162 * The controller that is notified when analysis is started.
158 */ 163 */
159 StreamController<AnalysisContext> _onAnalysisStartedController; 164 StreamController<AnalysisContext> _onAnalysisStartedController;
160 165
161 /** 166 /**
162 * The controller that is notified when analysis is complete. 167 * The controller that is notified when analysis is complete.
163 */ 168 */
164 StreamController _onAnalysisCompleteController; 169 StreamController _onAnalysisCompleteController;
165 170
166 /** 171 /**
(...skipping 27 matching lines...) Expand all
194 this.instrumentationService, {this.rethrowExceptions: true}) { 199 this.instrumentationService, {this.rethrowExceptions: true}) {
195 searchEngine = createSearchEngine(index); 200 searchEngine = createSearchEngine(index);
196 operationQueue = new ServerOperationQueue(this); 201 operationQueue = new ServerOperationQueue(this);
197 contextDirectoryManager = 202 contextDirectoryManager =
198 new ServerContextManager(this, resourceProvider, packageMapProvider); 203 new ServerContextManager(this, resourceProvider, packageMapProvider);
199 contextDirectoryManager.defaultOptions.incremental = true; 204 contextDirectoryManager.defaultOptions.incremental = true;
200 contextDirectoryManager.defaultOptions.incrementalApi = 205 contextDirectoryManager.defaultOptions.incrementalApi =
201 analysisServerOptions.enableIncrementalResolutionApi; 206 analysisServerOptions.enableIncrementalResolutionApi;
202 contextDirectoryManager.defaultOptions.incrementalValidation = 207 contextDirectoryManager.defaultOptions.incrementalValidation =
203 analysisServerOptions.enableIncrementalResolutionValidation; 208 analysisServerOptions.enableIncrementalResolutionValidation;
209 _noErrorNotification = analysisServerOptions.noErrorNotification;
204 AnalysisEngine.instance.logger = new AnalysisLogger(); 210 AnalysisEngine.instance.logger = new AnalysisLogger();
205 _onAnalysisStartedController = new StreamController.broadcast(); 211 _onAnalysisStartedController = new StreamController.broadcast();
206 _onAnalysisCompleteController = new StreamController.broadcast(); 212 _onAnalysisCompleteController = new StreamController.broadcast();
207 _onFileAnalyzedController = new StreamController.broadcast(); 213 _onFileAnalyzedController = new StreamController.broadcast();
208 _onPriorityChangeController = 214 _onPriorityChangeController =
209 new StreamController<PriorityChangeEvent>.broadcast(); 215 new StreamController<PriorityChangeEvent>.broadcast();
210 running = true; 216 running = true;
211 Notification notification = new ServerConnectedParams().toNotification(); 217 Notification notification = new ServerConnectedParams().toNotification();
212 channel.sendNotification(notification); 218 channel.sendNotification(notification);
213 channel.listen(handleRequest, onDone: done, onError: error); 219 channel.listen(handleRequest, onDone: done, onError: error);
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 }); 838 });
833 Source firstSource = files.length > 0 ? getSource(files[0]) : null; 839 Source firstSource = files.length > 0 ? getSource(files[0]) : null;
834 _onPriorityChangeController.add(new PriorityChangeEvent(firstSource)); 840 _onPriorityChangeController.add(new PriorityChangeEvent(firstSource));
835 } 841 }
836 842
837 /** 843 /**
838 * Returns `true` if errors should be reported for [file] with the given 844 * Returns `true` if errors should be reported for [file] with the given
839 * absolute path. 845 * absolute path.
840 */ 846 */
841 bool shouldSendErrorsNotificationFor(String file) { 847 bool shouldSendErrorsNotificationFor(String file) {
842 // TODO(scheglov) add support for the "--no-error-notification" flag. 848 return !_noErrorNotification &&
843 return contextDirectoryManager.isInAnalysisRoot(file); 849 contextDirectoryManager.isInAnalysisRoot(file);
844 } 850 }
845 851
846 void shutdown() { 852 void shutdown() {
847 running = false; 853 running = false;
848 if (index != null) { 854 if (index != null) {
849 index.clear(); 855 index.clear();
850 index.stop(); 856 index.stop();
851 } 857 }
852 // Defer closing the channel and shutting down the instrumentation server so 858 // Defer closing the channel and shutting down the instrumentation server so
853 // that the shutdown response can be sent and logged. 859 // that the shutdown response can be sent and logged.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 assert(!performOperationPending); 940 assert(!performOperationPending);
935 new Future(performOperation); 941 new Future(performOperation);
936 performOperationPending = true; 942 performOperationPending = true;
937 } 943 }
938 } 944 }
939 945
940 946
941 class AnalysisServerOptions { 947 class AnalysisServerOptions {
942 bool enableIncrementalResolutionApi = false; 948 bool enableIncrementalResolutionApi = false;
943 bool enableIncrementalResolutionValidation = false; 949 bool enableIncrementalResolutionValidation = false;
950 bool noErrorNotification = false;
944 } 951 }
945 952
946 /** 953 /**
947 * A [ContextsChangedEvent] indicate what contexts were added or removed. 954 * A [ContextsChangedEvent] indicate what contexts were added or removed.
948 * 955 *
949 * No context should be added to the event more than once. It does not make 956 * No context should be added to the event more than once. It does not make
950 * sense, for example, for a context to be both added and removed. 957 * sense, for example, for a context to be both added and removed.
951 */ 958 */
952 class ContextsChangedEvent { 959 class ContextsChangedEvent {
953 960
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 * [packageUriResolver]. 1080 * [packageUriResolver].
1074 */ 1081 */
1075 SourceFactory _createSourceFactory(UriResolver packageUriResolver) { 1082 SourceFactory _createSourceFactory(UriResolver packageUriResolver) {
1076 List<UriResolver> resolvers = <UriResolver>[ 1083 List<UriResolver> resolvers = <UriResolver>[
1077 new DartUriResolver(analysisServer.defaultSdk), 1084 new DartUriResolver(analysisServer.defaultSdk),
1078 new ResourceUriResolver(resourceProvider), 1085 new ResourceUriResolver(resourceProvider),
1079 packageUriResolver]; 1086 packageUriResolver];
1080 return new SourceFactory(resolvers); 1087 return new SourceFactory(resolvers);
1081 } 1088 }
1082 } 1089 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/server/driver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698