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

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

Issue 1047733004: Support refresh of individual analysis roots (issue 22254) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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
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 domain.analysis; 5 library domain.analysis;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/computer/computer_hover.dart'; 10 import 'package:analysis_server/src/computer/computer_hover.dart';
11 import 'package:analysis_server/src/constants.dart'; 11 import 'package:analysis_server/src/constants.dart';
12 import 'package:analysis_server/src/protocol_server.dart'; 12 import 'package:analysis_server/src/protocol_server.dart';
13 import 'package:analysis_server/src/services/dependencies/library_dependencies.d art'; 13 import 'package:analysis_server/src/services/dependencies/library_dependencies.d art';
14 import 'package:analyzer/src/generated/ast.dart'; 14 import 'package:analyzer/src/generated/ast.dart';
15 import 'package:analyzer/src/generated/engine.dart' as engine; 15 import 'package:analyzer/src/generated/engine.dart' as engine;
16 import 'package:analyzer/file_system/file_system.dart';
16 17
17 /** 18 /**
18 * Instances of the class [AnalysisDomainHandler] implement a [RequestHandler] 19 * Instances of the class [AnalysisDomainHandler] implement a [RequestHandler]
19 * that handles requests in the `analysis` domain. 20 * that handles requests in the `analysis` domain.
20 */ 21 */
21 class AnalysisDomainHandler implements RequestHandler { 22 class AnalysisDomainHandler implements RequestHandler {
22 /** 23 /**
23 * The analysis server that is using this handler to process requests. 24 * The analysis server that is using this handler to process requests.
24 */ 25 */
25 final AnalysisServer server; 26 final AnalysisServer server;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } on RequestFailure catch (exception) { 130 } on RequestFailure catch (exception) {
130 return exception.response; 131 return exception.response;
131 } 132 }
132 return null; 133 return null;
133 } 134 }
134 135
135 /** 136 /**
136 * Implement the 'analysis.reanalyze' request. 137 * Implement the 'analysis.reanalyze' request.
137 */ 138 */
138 Response reanalyze(Request request) { 139 Response reanalyze(Request request) {
139 server.reanalyze(); 140 AnalysisReanalyzeParams params = new AnalysisReanalyzeParams.fromRequest(req uest);
141 List<String> roots = params.roots;
142 if (roots == null || roots.isNotEmpty) {
143 List<String> includedPaths = server.contextDirectoryManager.includedPaths;
144 List<Resource> rootResources = null;
145 if (roots != null) {
146 rootResources = <Resource>[];
147 for (String rootPath in roots) {
148 if (!includedPaths.contains(rootPath)) {
149 return new Response.invalidAnalysisRoot(request, rootPath);
150 }
151 rootResources.add(server.resourceProvider.getResource(rootPath));
152 }
153 }
154 server.reanalyze(rootResources);
155 }
140 return new AnalysisReanalyzeResult().toResponse(request.id); 156 return new AnalysisReanalyzeResult().toResponse(request.id);
141 } 157 }
142 158
143 /** 159 /**
144 * Implement the 'analysis.setAnalysisRoots' request. 160 * Implement the 'analysis.setAnalysisRoots' request.
145 */ 161 */
146 Response setAnalysisRoots(Request request) { 162 Response setAnalysisRoots(Request request) {
147 var params = new AnalysisSetAnalysisRootsParams.fromRequest(request); 163 var params = new AnalysisSetAnalysisRootsParams.fromRequest(request);
148 // continue in server 164 // continue in server
149 server.setAnalysisRoots(request.id, params.included, params.excluded, 165 server.setAnalysisRoots(request.id, params.included, params.excluded,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 212 }
197 if (newOptions.generateHints != null) { 213 if (newOptions.generateHints != null) {
198 updaters.add((engine.AnalysisOptionsImpl options) { 214 updaters.add((engine.AnalysisOptionsImpl options) {
199 options.hint = newOptions.generateHints; 215 options.hint = newOptions.generateHints;
200 }); 216 });
201 } 217 }
202 server.updateOptions(updaters); 218 server.updateOptions(updaters);
203 return new AnalysisUpdateOptionsResult().toResponse(request.id); 219 return new AnalysisUpdateOptionsResult().toResponse(request.id);
204 } 220 }
205 } 221 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698