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/protocol.dart'; | 8 import 'package:analysis_server/src/protocol.dart'; |
9 | 9 |
10 /** | 10 /** |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 * The name of the `analysis.outline` notification. | 71 * The name of the `analysis.outline` notification. |
72 */ | 72 */ |
73 static const String OUTLINE_NOTIFICATION = 'analysis.outline'; | 73 static const String OUTLINE_NOTIFICATION = 'analysis.outline'; |
74 | 74 |
75 /** | 75 /** |
76 * The name of the `aadded` parameter. | 76 * The name of the `aadded` parameter. |
77 */ | 77 */ |
78 static const String ADDED_PARAM = 'added'; | 78 static const String ADDED_PARAM = 'added'; |
79 | 79 |
80 /** | 80 /** |
| 81 * The name of the `content` parameter. |
| 82 */ |
| 83 static const String CONTENT_PARAM = 'content'; |
| 84 |
| 85 /** |
81 * The name of the `default` parameter. | 86 * The name of the `default` parameter. |
82 */ | 87 */ |
83 static const String DEFAULT_PARAM = 'default'; | 88 static const String DEFAULT_PARAM = 'default'; |
84 | 89 |
85 /** | 90 /** |
86 * The name of the `errors` parameter. | 91 * The name of the `errors` parameter. |
87 */ | 92 */ |
88 static const String ERRORS_PARAM = 'errors'; | 93 static const String ERRORS_PARAM = 'errors'; |
89 | 94 |
90 /** | 95 /** |
(...skipping 20 matching lines...) Expand all Loading... |
111 * The name of the `included` parameter. | 116 * The name of the `included` parameter. |
112 */ | 117 */ |
113 static const String INCLUDED_PARAM = 'included'; | 118 static const String INCLUDED_PARAM = 'included'; |
114 | 119 |
115 /** | 120 /** |
116 * The name of the `length` parameter. | 121 * The name of the `length` parameter. |
117 */ | 122 */ |
118 static const String LENGTH_PARAM = 'length'; | 123 static const String LENGTH_PARAM = 'length'; |
119 | 124 |
120 /** | 125 /** |
| 126 * The name of the `newLength` parameter. |
| 127 */ |
| 128 static const String NEW_LENGTH_PARAM = 'newLength'; |
| 129 |
| 130 /** |
121 * The name of the `offset` parameter. | 131 * The name of the `offset` parameter. |
122 */ | 132 */ |
123 static const String OFFSET_PARAM = 'offset'; | 133 static const String OFFSET_PARAM = 'offset'; |
124 | 134 |
125 /** | 135 /** |
| 136 * The name of the `oldLength` parameter. |
| 137 */ |
| 138 static const String OLD_LENGTH_PARAM = 'oldLength'; |
| 139 |
| 140 /** |
126 * The name of the `options` parameter. | 141 * The name of the `options` parameter. |
127 */ | 142 */ |
128 static const String OPTIONS_PARAM = 'options'; | 143 static const String OPTIONS_PARAM = 'options'; |
129 | 144 |
130 /** | 145 /** |
131 * The name of the `outline` parameter. | 146 * The name of the `outline` parameter. |
132 */ | 147 */ |
133 static const String OUTLINE_PARAM = 'outline'; | 148 static const String OUTLINE_PARAM = 'outline'; |
134 | 149 |
135 /** | 150 /** |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // TODO(scheglov) implement | 230 // TODO(scheglov) implement |
216 return null; | 231 return null; |
217 } | 232 } |
218 | 233 |
219 Response setSubscriptions(Request request) { | 234 Response setSubscriptions(Request request) { |
220 // TODO(scheglov) implement | 235 // TODO(scheglov) implement |
221 return null; | 236 return null; |
222 } | 237 } |
223 | 238 |
224 Response updateContent(Request request) { | 239 Response updateContent(Request request) { |
225 // TODO(scheglov) implement | 240 var changes = new Map<String, ContentChange>(); |
226 return null; | 241 RequestDatum filesDatum = request.getRequiredParameter(FILES_PARAM); |
| 242 filesDatum.forEachMap((file, changeDatum) { |
| 243 var change = new ContentChange(); |
| 244 change.content = changeDatum[CONTENT_PARAM].asString(); |
| 245 if (changeDatum.hasKey(OFFSET_PARAM)) { |
| 246 change.offset = changeDatum[OFFSET_PARAM].asInt(); |
| 247 change.oldLength = changeDatum[OLD_LENGTH_PARAM].asInt(); |
| 248 change.newLength = changeDatum[NEW_LENGTH_PARAM].asInt(); |
| 249 } |
| 250 changes[file] = change; |
| 251 }); |
| 252 server.updateContent(changes); |
| 253 return new Response(request.id); |
227 } | 254 } |
228 | 255 |
229 Response updateOptions(Request request) { | 256 Response updateOptions(Request request) { |
230 // TODO(scheglov) implement | 257 // TODO(scheglov) implement |
231 return null; | 258 return null; |
232 } | 259 } |
233 | 260 |
234 Response updateSdks(Request request) { | 261 Response updateSdks(Request request) { |
235 // TODO(scheglov) implement | 262 // TODO(scheglov) implement |
236 return null; | 263 return null; |
237 } | 264 } |
238 } | 265 } |
| 266 |
| 267 |
| 268 /** |
| 269 * A description of the change to the content of a file. |
| 270 */ |
| 271 class ContentChange { |
| 272 String content; |
| 273 int offset; |
| 274 int oldLength; |
| 275 int newLength; |
| 276 } |
OLD | NEW |