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

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: Address more comments 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/file_system/file_system.dart';
14 import 'package:analyzer/src/generated/ast.dart'; 15 import 'package:analyzer/src/generated/ast.dart';
15 import 'package:analyzer/src/generated/engine.dart' as engine; 16 import 'package:analyzer/src/generated/engine.dart' as engine;
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.
(...skipping 105 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 =
141 new AnalysisReanalyzeParams.fromRequest(request);
142 List<String> roots = params.roots;
143 if (roots == null || roots.isNotEmpty) {
144 List<String> includedPaths = server.contextDirectoryManager.includedPaths;
145 List<Resource> rootResources = null;
146 if (roots != null) {
147 rootResources = <Resource>[];
148 for (String rootPath in roots) {
149 if (!includedPaths.contains(rootPath)) {
150 return new Response.invalidAnalysisRoot(request, rootPath);
151 }
152 rootResources.add(server.resourceProvider.getResource(rootPath));
153 }
154 }
155 server.reanalyze(rootResources);
156 }
140 return new AnalysisReanalyzeResult().toResponse(request.id); 157 return new AnalysisReanalyzeResult().toResponse(request.id);
141 } 158 }
142 159
143 /** 160 /**
144 * Implement the 'analysis.setAnalysisRoots' request. 161 * Implement the 'analysis.setAnalysisRoots' request.
145 */ 162 */
146 Response setAnalysisRoots(Request request) { 163 Response setAnalysisRoots(Request request) {
147 var params = new AnalysisSetAnalysisRootsParams.fromRequest(request); 164 var params = new AnalysisSetAnalysisRootsParams.fromRequest(request);
148 // continue in server 165 // continue in server
149 server.setAnalysisRoots(request.id, params.included, params.excluded, 166 server.setAnalysisRoots(request.id, params.included, params.excluded,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 213 }
197 if (newOptions.generateHints != null) { 214 if (newOptions.generateHints != null) {
198 updaters.add((engine.AnalysisOptionsImpl options) { 215 updaters.add((engine.AnalysisOptionsImpl options) {
199 options.hint = newOptions.generateHints; 216 options.hint = newOptions.generateHints;
200 }); 217 });
201 } 218 }
202 server.updateOptions(updaters); 219 server.updateOptions(updaters);
203 return new AnalysisUpdateOptionsResult().toResponse(request.id); 220 return new AnalysisUpdateOptionsResult().toResponse(request.id);
204 } 221 }
205 } 222 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | pkg/analysis_server/lib/src/generated_protocol.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698