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

Side by Side Diff: pkg/analyzer_plugin/lib/plugin/plugin.dart

Issue 2988743002: Remove the analysus.reanalyze request from the plugin API (Closed)
Patch Set: Restart plugins Created 3 years, 5 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:analyzer/file_system/file_system.dart'; 7 import 'package:analyzer/file_system/file_system.dart';
8 import 'package:analyzer/file_system/physical_file_system.dart'; 8 import 'package:analyzer/file_system/physical_file_system.dart';
9 import 'package:analyzer/src/dart/analysis/driver.dart' 9 import 'package:analyzer/src/dart/analysis/driver.dart'
10 show AnalysisDriverGeneric, AnalysisDriverScheduler; 10 show AnalysisDriverGeneric, AnalysisDriverScheduler;
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 break; 228 break;
229 default: 229 default:
230 // Ignore unhandled watch event types. 230 // Ignore unhandled watch event types.
231 break; 231 break;
232 } 232 }
233 } 233 }
234 return new AnalysisHandleWatchEventsResult(); 234 return new AnalysisHandleWatchEventsResult();
235 } 235 }
236 236
237 /** 237 /**
238 * Handle an 'analysis.reanalyze' request.
239 */
240 Future<AnalysisReanalyzeResult> handleAnalysisReanalyze(
241 AnalysisReanalyzeParams parameters) async {
242 List<String> rootPaths = parameters.roots;
243 if (rootPaths == null) {
244 //
245 // Reanalyze everything.
246 //
247 List<ContextRoot> roots = driverMap.keys.toList();
248 for (ContextRoot contextRoot in roots) {
249 AnalysisDriverGeneric driver = driverMap[contextRoot];
250 driver.dispose();
251 driver = createAnalysisDriver(contextRoot);
252 driverMap[contextRoot] = driver;
253 }
254 return new AnalysisReanalyzeResult();
255 } else {
256 //
257 // Reanalyze a specific set of files.
258 //
259 // TODO(brianwilkerson) There is no API for telling a driver that we need
260 // to have some files reanalyzed.
261 // for (String rootPath in rootPaths) {
262 // ContextRoot contextRoot = contextRootContaining(rootPath);
263 // AnalysisDriverGeneric driver = driverMap[contextRoot];
264 // driver.reanalyze(rootPath);
265 // }
266 return null;
267 }
268 }
269
270 /**
271 * Handle an 'analysis.setContextRoots' request. 238 * Handle an 'analysis.setContextRoots' request.
272 */ 239 */
273 Future<AnalysisSetContextRootsResult> handleAnalysisSetContextRoots( 240 Future<AnalysisSetContextRootsResult> handleAnalysisSetContextRoots(
274 AnalysisSetContextRootsParams parameters) async { 241 AnalysisSetContextRootsParams parameters) async {
275 List<ContextRoot> contextRoots = parameters.roots; 242 List<ContextRoot> contextRoots = parameters.roots;
276 List<ContextRoot> oldRoots = driverMap.keys.toList(); 243 List<ContextRoot> oldRoots = driverMap.keys.toList();
277 for (ContextRoot contextRoot in contextRoots) { 244 for (ContextRoot contextRoot in contextRoots) {
278 if (!oldRoots.remove(contextRoot)) { 245 if (!oldRoots.remove(contextRoot)) {
279 // The context is new, so we create a driver for it. Creating the driver 246 // The context is new, so we create a driver for it. Creating the driver
280 // has the side-effect of adding it to the analysis driver scheduler. 247 // has the side-effect of adding it to the analysis driver scheduler.
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 ResponseResult result = null; 467 ResponseResult result = null;
501 switch (request.method) { 468 switch (request.method) {
502 case ANALYSIS_REQUEST_GET_NAVIGATION: 469 case ANALYSIS_REQUEST_GET_NAVIGATION:
503 var params = new AnalysisGetNavigationParams.fromRequest(request); 470 var params = new AnalysisGetNavigationParams.fromRequest(request);
504 result = await handleAnalysisGetNavigation(params); 471 result = await handleAnalysisGetNavigation(params);
505 break; 472 break;
506 case ANALYSIS_REQUEST_HANDLE_WATCH_EVENTS: 473 case ANALYSIS_REQUEST_HANDLE_WATCH_EVENTS:
507 var params = new AnalysisHandleWatchEventsParams.fromRequest(request); 474 var params = new AnalysisHandleWatchEventsParams.fromRequest(request);
508 result = await handleAnalysisHandleWatchEvents(params); 475 result = await handleAnalysisHandleWatchEvents(params);
509 break; 476 break;
510 case ANALYSIS_REQUEST_REANALYZE:
511 var params = new AnalysisReanalyzeParams.fromRequest(request);
512 result = await handleAnalysisReanalyze(params);
513 break;
514 case ANALYSIS_REQUEST_SET_CONTEXT_ROOTS: 477 case ANALYSIS_REQUEST_SET_CONTEXT_ROOTS:
515 var params = new AnalysisSetContextRootsParams.fromRequest(request); 478 var params = new AnalysisSetContextRootsParams.fromRequest(request);
516 result = await handleAnalysisSetContextRoots(params); 479 result = await handleAnalysisSetContextRoots(params);
517 break; 480 break;
518 case ANALYSIS_REQUEST_SET_PRIORITY_FILES: 481 case ANALYSIS_REQUEST_SET_PRIORITY_FILES:
519 var params = new AnalysisSetPriorityFilesParams.fromRequest(request); 482 var params = new AnalysisSetPriorityFilesParams.fromRequest(request);
520 result = await handleAnalysisSetPriorityFiles(params); 483 result = await handleAnalysisSetPriorityFiles(params);
521 break; 484 break;
522 case ANALYSIS_REQUEST_SET_SUBSCRIPTIONS: 485 case ANALYSIS_REQUEST_SET_SUBSCRIPTIONS:
523 var params = new AnalysisSetSubscriptionsParams.fromRequest(request); 486 var params = new AnalysisSetSubscriptionsParams.fromRequest(request);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 response = new Response(id, requestTime, 545 response = new Response(id, requestTime,
583 error: new RequestError( 546 error: new RequestError(
584 RequestErrorCode.PLUGIN_ERROR, exception.toString(), 547 RequestErrorCode.PLUGIN_ERROR, exception.toString(),
585 stackTrace: stackTrace.toString())); 548 stackTrace: stackTrace.toString()));
586 } 549 }
587 if (response != null) { 550 if (response != null) {
588 _channel.sendResponse(response); 551 _channel.sendResponse(response);
589 } 552 }
590 } 553 }
591 } 554 }
OLDNEW
« no previous file with comments | « pkg/analyzer_plugin/doc/api.html ('k') | pkg/analyzer_plugin/lib/protocol/protocol_constants.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698