| OLD | NEW |
| 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 'package:analysis_server/src/analysis_server.dart'; | 7 import 'package:analysis_server/src/analysis_server.dart'; |
| 8 import 'package:analysis_server/src/constants.dart'; | 8 import 'package:analysis_server/src/constants.dart'; |
| 9 import 'package:analysis_server/src/protocol.dart'; | 9 import 'package:analysis_server/src/protocol.dart'; |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 server.setAnalysisRoots(request.id, includedPaths, excludedPaths); | 71 server.setAnalysisRoots(request.id, includedPaths, excludedPaths); |
| 72 return new Response(request.id); | 72 return new Response(request.id); |
| 73 } | 73 } |
| 74 | 74 |
| 75 Response setPriorityFiles(Request request) { | 75 Response setPriorityFiles(Request request) { |
| 76 // TODO(scheglov) implement | 76 // TODO(scheglov) implement |
| 77 return null; | 77 return null; |
| 78 } | 78 } |
| 79 | 79 |
| 80 Response setSubscriptions(Request request) { | 80 Response setSubscriptions(Request request) { |
| 81 // TODO(scheglov) implement | 81 // parse subscriptions |
| 82 return null; | 82 Map<AnalysisService, Set<String>> subMap; |
| 83 { |
| 84 RequestDatum subDatum = request.getRequiredParameter(SUBSCRIPTIONS); |
| 85 Map<String, List<String>> subStringMap = subDatum.asStringListMap(); |
| 86 subMap = new Map<AnalysisService, Set<String>>(); |
| 87 subStringMap.forEach((String serviceName, List<String> paths) { |
| 88 AnalysisService service = Enum2.valueOf(AnalysisService.VALUES, serviceN
ame); |
| 89 if (service == null) { |
| 90 throw new RequestFailure( |
| 91 new Response.unknownAnalysisService(request, serviceName)); |
| 92 } |
| 93 subMap[service] = new Set.from(paths); |
| 94 }); |
| 95 } |
| 96 server.setAnalysisSubscriptions(subMap); |
| 97 return new Response(request.id); |
| 83 } | 98 } |
| 84 | 99 |
| 85 Response updateContent(Request request) { | 100 Response updateContent(Request request) { |
| 86 var changes = new Map<String, ContentChange>(); | 101 var changes = new Map<String, ContentChange>(); |
| 87 RequestDatum filesDatum = request.getRequiredParameter(FILES); | 102 RequestDatum filesDatum = request.getRequiredParameter(FILES); |
| 88 filesDatum.forEachMap((file, changeDatum) { | 103 filesDatum.forEachMap((file, changeDatum) { |
| 89 var change = new ContentChange(); | 104 var change = new ContentChange(); |
| 90 change.content = changeDatum[CONTENT].asString(); | 105 change.content = changeDatum[CONTENT].asString(); |
| 91 if (changeDatum.hasKey(OFFSET)) { | 106 if (changeDatum.hasKey(OFFSET)) { |
| 92 change.offset = changeDatum[OFFSET].asInt(); | 107 change.offset = changeDatum[OFFSET].asInt(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 113 | 128 |
| 114 /** | 129 /** |
| 115 * A description of the change to the content of a file. | 130 * A description of the change to the content of a file. |
| 116 */ | 131 */ |
| 117 class ContentChange { | 132 class ContentChange { |
| 118 String content; | 133 String content; |
| 119 int offset; | 134 int offset; |
| 120 int oldLength; | 135 int oldLength; |
| 121 int newLength; | 136 int newLength; |
| 122 } | 137 } |
| OLD | NEW |