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

Unified Diff: pkg/analysis_server/lib/src/domain_analysis.dart

Issue 300023004: Partial implementation of the 'setAnalysisRoots' API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
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 d83c1d31bbe712df4b510ec11156c9e6edef7c9b..5b9ced729a443eb0576572c888f4de474fa7b4c0 100644
--- a/pkg/analysis_server/lib/src/domain_analysis.dart
+++ b/pkg/analysis_server/lib/src/domain_analysis.dart
@@ -6,6 +6,7 @@ library domain.analysis;
import 'package:analysis_server/src/analysis_server.dart';
import 'package:analysis_server/src/protocol.dart';
+import 'package:analysis_server/src/resource.dart';
/**
* Instances of the class [AnalysisDomainHandler] implement a [RequestHandler]
@@ -200,8 +201,36 @@ class AnalysisDomainHandler implements RequestHandler {
}
Response setAnalysisRoots(Request request) {
- // TODO(scheglov) implement
- return null;
+ // included
+ RequestDatum includedDatum = request.getRequiredParameter(INCLUDED_PARAM);
+ List<String> includedPaths = includedDatum.asStringList();
+ Set<Folder> includedFolders = new Set<Folder>();
+ for (int i = 0; i < includedPaths.length; i++) {
+ String path = includedPaths[i];
+ Resource resource = server.resourceProvider.getResource(path);
+ if (resource is Folder) {
+ includedFolders.add(resource);
+ } else {
+ throw new RequestFailure(
Brian Wilkerson 2014/05/27 14:09:57 The specification says that files can be included.
scheglov 2014/05/27 18:24:24 I have changed the message and moved it into Analy
+ new Response.unsupportedFeature(
+ request,
+ '$path is not a folder. Only folders can be analysis roots.'));
+ }
+ }
+ // excluded
+ RequestDatum excludedDatum = request.getRequiredParameter(EXCLUDED_PARAM);
+ List<String> excludedPaths = excludedDatum.asStringList();
+ // TODO(scheglov) remove when implemented
+ if (excludedPaths.isNotEmpty) {
Brian Wilkerson 2014/05/27 14:09:57 Seems like the better place to fail would be in se
scheglov 2014/05/27 18:24:24 Done.
+ throw new RequestFailure(
+ new Response.unsupportedFeature(
+ request,
+ 'Excluded paths are not supported yet'));
+ }
+ Set<Folder> excludedFolders = new Set<Folder>();
+ // continue in server
+ server.setAnalysisRoots(includedFolders, excludedFolders);
+ return new Response(request.id);
}
Response setPriorityFiles(Request request) {

Powered by Google App Engine
This is Rietveld 408576698