Index: pkg/analysis_server/lib/src/domain_analysis.dart |
diff --git a/pkg/analysis_server/lib/src/domain_analysis.dart b/pkg/analysis_server/lib/src/domain_analysis.dart |
index 5b461079773318456229eaf979e910950662b165..4a3d28f0bdb42be464ad21cca9b63b3d628a850a 100644 |
--- a/pkg/analysis_server/lib/src/domain_analysis.dart |
+++ b/pkg/analysis_server/lib/src/domain_analysis.dart |
@@ -11,6 +11,7 @@ import 'package:analysis_server/src/computer/computer_hover.dart'; |
import 'package:analysis_server/src/constants.dart'; |
import 'package:analysis_server/src/protocol_server.dart'; |
import 'package:analysis_server/src/services/dependencies/library_dependencies.dart'; |
+import 'package:analyzer/file_system/file_system.dart'; |
import 'package:analyzer/src/generated/ast.dart'; |
import 'package:analyzer/src/generated/engine.dart' as engine; |
@@ -136,7 +137,23 @@ class AnalysisDomainHandler implements RequestHandler { |
* Implement the 'analysis.reanalyze' request. |
*/ |
Response reanalyze(Request request) { |
- server.reanalyze(); |
+ AnalysisReanalyzeParams params = |
+ new AnalysisReanalyzeParams.fromRequest(request); |
+ List<String> roots = params.roots; |
+ if (roots == null || roots.isNotEmpty) { |
+ List<String> includedPaths = server.contextDirectoryManager.includedPaths; |
+ List<Resource> rootResources = null; |
+ if (roots != null) { |
+ rootResources = <Resource>[]; |
+ for (String rootPath in roots) { |
+ if (!includedPaths.contains(rootPath)) { |
+ return new Response.invalidAnalysisRoot(request, rootPath); |
+ } |
+ rootResources.add(server.resourceProvider.getResource(rootPath)); |
+ } |
+ } |
+ server.reanalyze(rootResources); |
+ } |
return new AnalysisReanalyzeResult().toResponse(request.id); |
} |