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 // This file has been automatically generated. Please do not edit it manually. | 5 // This file has been automatically generated. Please do not edit it manually. |
6 // To regenerate the file, use the script | 6 // To regenerate the file, use the script |
7 // "pkg/analysis_server/tool/spec/generate_files". | 7 // "pkg/analysis_server/tool/spec/generate_files". |
8 | 8 |
9 /** | 9 /** |
10 * Convenience methods for running integration tests | 10 * Convenience methods for running integration tests |
11 */ | 11 */ |
12 library test.integration.methods; | 12 library test.integration.methods; |
13 | 13 |
14 import 'dart:async'; | 14 import 'dart:async'; |
15 | 15 |
16 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 16 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
17 import 'package:analysis_server/src/protocol/protocol_internal.dart'; | 17 import 'package:analysis_server/src/protocol/protocol_internal.dart'; |
18 import 'package:unittest/unittest.dart'; | 18 import 'package:unittest/unittest.dart'; |
19 | 19 |
20 import 'integration_tests.dart'; | 20 import 'integration_tests.dart'; |
21 import 'protocol_matchers.dart'; | 21 import 'protocol_matchers.dart'; |
22 | 22 |
| 23 |
23 /** | 24 /** |
24 * Convenience methods for running integration tests | 25 * Convenience methods for running integration tests |
25 */ | 26 */ |
26 abstract class IntegrationTestMixin { | 27 abstract class IntegrationTestMixin { |
| 28 Server get server; |
| 29 |
| 30 /** |
| 31 * Return the version number of the analysis server. |
| 32 * |
| 33 * Returns |
| 34 * |
| 35 * version ( String ) |
| 36 * |
| 37 * The version number of the analysis server. |
| 38 */ |
| 39 Future<ServerGetVersionResult> sendServerGetVersion() { |
| 40 return server.send("server.getVersion", null) |
| 41 .then((result) { |
| 42 ResponseDecoder decoder = new ResponseDecoder(null); |
| 43 return new ServerGetVersionResult.fromJson(decoder, 'result', result); |
| 44 }); |
| 45 } |
| 46 |
| 47 /** |
| 48 * Cleanly shutdown the analysis server. Requests that are received after |
| 49 * this request will not be processed. Requests that were received before |
| 50 * this request, but for which a response has not yet been sent, will not be |
| 51 * responded to. No further responses or notifications will be sent after the |
| 52 * response to this request has been sent. |
| 53 */ |
| 54 Future sendServerShutdown() { |
| 55 return server.send("server.shutdown", null) |
| 56 .then((result) { |
| 57 expect(result, isNull); |
| 58 return null; |
| 59 }); |
| 60 } |
| 61 |
| 62 /** |
| 63 * Subscribe for services. All previous subscriptions are replaced by the |
| 64 * given set of services. |
| 65 * |
| 66 * It is an error if any of the elements in the list are not valid services. |
| 67 * If there is an error, then the current subscriptions will remain |
| 68 * unchanged. |
| 69 * |
| 70 * Parameters |
| 71 * |
| 72 * subscriptions ( List<ServerService> ) |
| 73 * |
| 74 * A list of the services being subscribed to. |
| 75 */ |
| 76 Future sendServerSetSubscriptions(List<ServerService> subscriptions) { |
| 77 var params = new ServerSetSubscriptionsParams(subscriptions).toJson(); |
| 78 return server.send("server.setSubscriptions", params) |
| 79 .then((result) { |
| 80 expect(result, isNull); |
| 81 return null; |
| 82 }); |
| 83 } |
| 84 |
27 /** | 85 /** |
28 * Reports that the server is running. This notification is issued once after | 86 * Reports that the server is running. This notification is issued once after |
29 * the server has started running but before any requests are processed to | 87 * the server has started running but before any requests are processed to |
30 * let the client know that it started correctly. | 88 * let the client know that it started correctly. |
31 * | 89 * |
32 * It is not possible to subscribe to or unsubscribe from this notification. | 90 * It is not possible to subscribe to or unsubscribe from this notification. |
33 * | 91 * |
34 * Parameters | 92 * Parameters |
35 * | 93 * |
36 * version ( String ) | 94 * version ( String ) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 * running pub. | 155 * running pub. |
98 */ | 156 */ |
99 Stream<ServerStatusParams> onServerStatus; | 157 Stream<ServerStatusParams> onServerStatus; |
100 | 158 |
101 /** | 159 /** |
102 * Stream controller for [onServerStatus]. | 160 * Stream controller for [onServerStatus]. |
103 */ | 161 */ |
104 StreamController<ServerStatusParams> _onServerStatus; | 162 StreamController<ServerStatusParams> _onServerStatus; |
105 | 163 |
106 /** | 164 /** |
107 * Reports the paths of the files that are being analyzed. | |
108 * | |
109 * This notification is not subscribed to by default. Clients can subscribe | |
110 * by including the value "ANALYZED_FILES" in the list of services passed in | |
111 * an analysis.setGeneralSubscriptions request. | |
112 * | |
113 * Parameters | |
114 * | |
115 * directories ( List<FilePath> ) | |
116 * | |
117 * A list of the paths of the files that are being analyzed. | |
118 */ | |
119 Stream<AnalysisAnalyzedFilesParams> onAnalysisAnalyzedFiles; | |
120 | |
121 /** | |
122 * Stream controller for [onAnalysisAnalyzedFiles]. | |
123 */ | |
124 StreamController<AnalysisAnalyzedFilesParams> _onAnalysisAnalyzedFiles; | |
125 | |
126 /** | |
127 * Reports the errors associated with a given file. The set of errors | |
128 * included in the notification is always a complete list that supersedes any | |
129 * previously reported errors. | |
130 * | |
131 * It is only possible to unsubscribe from this notification by using the | |
132 * command-line flag --no-error-notification. | |
133 * | |
134 * Parameters | |
135 * | |
136 * file ( FilePath ) | |
137 * | |
138 * The file containing the errors. | |
139 * | |
140 * errors ( List<AnalysisError> ) | |
141 * | |
142 * The errors contained in the file. | |
143 */ | |
144 Stream<AnalysisErrorsParams> onAnalysisErrors; | |
145 | |
146 /** | |
147 * Stream controller for [onAnalysisErrors]. | |
148 */ | |
149 StreamController<AnalysisErrorsParams> _onAnalysisErrors; | |
150 | |
151 /** | |
152 * Reports that any analysis results that were previously associated with the | |
153 * given files should be considered to be invalid because those files are no | |
154 * longer being analyzed, either because the analysis root that contained it | |
155 * is no longer being analyzed or because the file no longer exists. | |
156 * | |
157 * If a file is included in this notification and at some later time a | |
158 * notification with results for the file is received, clients should assume | |
159 * that the file is once again being analyzed and the information should be | |
160 * processed. | |
161 * | |
162 * It is not possible to subscribe to or unsubscribe from this notification. | |
163 * | |
164 * Parameters | |
165 * | |
166 * files ( List<FilePath> ) | |
167 * | |
168 * The files that are no longer being analyzed. | |
169 */ | |
170 Stream<AnalysisFlushResultsParams> onAnalysisFlushResults; | |
171 | |
172 /** | |
173 * Stream controller for [onAnalysisFlushResults]. | |
174 */ | |
175 StreamController<AnalysisFlushResultsParams> _onAnalysisFlushResults; | |
176 | |
177 /** | |
178 * Reports the folding regions associated with a given file. Folding regions | |
179 * can be nested, but will not be overlapping. Nesting occurs when a foldable | |
180 * element, such as a method, is nested inside another foldable element such | |
181 * as a class. | |
182 * | |
183 * This notification is not subscribed to by default. Clients can subscribe | |
184 * by including the value "FOLDING" in the list of services passed in an | |
185 * analysis.setSubscriptions request. | |
186 * | |
187 * Parameters | |
188 * | |
189 * file ( FilePath ) | |
190 * | |
191 * The file containing the folding regions. | |
192 * | |
193 * regions ( List<FoldingRegion> ) | |
194 * | |
195 * The folding regions contained in the file. | |
196 */ | |
197 Stream<AnalysisFoldingParams> onAnalysisFolding; | |
198 | |
199 /** | |
200 * Stream controller for [onAnalysisFolding]. | |
201 */ | |
202 StreamController<AnalysisFoldingParams> _onAnalysisFolding; | |
203 | |
204 /** | |
205 * Reports the highlight regions associated with a given file. | |
206 * | |
207 * This notification is not subscribed to by default. Clients can subscribe | |
208 * by including the value "HIGHLIGHTS" in the list of services passed in an | |
209 * analysis.setSubscriptions request. | |
210 * | |
211 * Parameters | |
212 * | |
213 * file ( FilePath ) | |
214 * | |
215 * The file containing the highlight regions. | |
216 * | |
217 * regions ( List<HighlightRegion> ) | |
218 * | |
219 * The highlight regions contained in the file. Each highlight region | |
220 * represents a particular syntactic or semantic meaning associated with | |
221 * some range. Note that the highlight regions that are returned can | |
222 * overlap other highlight regions if there is more than one meaning | |
223 * associated with a particular region. | |
224 */ | |
225 Stream<AnalysisHighlightsParams> onAnalysisHighlights; | |
226 | |
227 /** | |
228 * Stream controller for [onAnalysisHighlights]. | |
229 */ | |
230 StreamController<AnalysisHighlightsParams> _onAnalysisHighlights; | |
231 | |
232 /** | |
233 * Reports the classes that are implemented or extended and class members | |
234 * that are implemented or overridden in a file. | |
235 * | |
236 * This notification is not subscribed to by default. Clients can subscribe | |
237 * by including the value "IMPLEMENTED" in the list of services passed in an | |
238 * analysis.setSubscriptions request. | |
239 * | |
240 * Parameters | |
241 * | |
242 * file ( FilePath ) | |
243 * | |
244 * The file with which the implementations are associated. | |
245 * | |
246 * classes ( List<ImplementedClass> ) | |
247 * | |
248 * The classes defined in the file that are implemented or extended. | |
249 * | |
250 * members ( List<ImplementedMember> ) | |
251 * | |
252 * The member defined in the file that are implemented or overridden. | |
253 */ | |
254 Stream<AnalysisImplementedParams> onAnalysisImplemented; | |
255 | |
256 /** | |
257 * Stream controller for [onAnalysisImplemented]. | |
258 */ | |
259 StreamController<AnalysisImplementedParams> _onAnalysisImplemented; | |
260 | |
261 /** | |
262 * Reports that the navigation information associated with a region of a | |
263 * single file has become invalid and should be re-requested. | |
264 * | |
265 * This notification is not subscribed to by default. Clients can subscribe | |
266 * by including the value "INVALIDATE" in the list of services passed in an | |
267 * analysis.setSubscriptions request. | |
268 * | |
269 * Parameters | |
270 * | |
271 * file ( FilePath ) | |
272 * | |
273 * The file whose information has been invalidated. | |
274 * | |
275 * offset ( int ) | |
276 * | |
277 * The offset of the invalidated region. | |
278 * | |
279 * length ( int ) | |
280 * | |
281 * The length of the invalidated region. | |
282 * | |
283 * delta ( int ) | |
284 * | |
285 * The delta to be applied to the offsets in information that follows the | |
286 * invalidated region in order to update it so that it doesn't need to be | |
287 * re-requested. | |
288 */ | |
289 Stream<AnalysisInvalidateParams> onAnalysisInvalidate; | |
290 | |
291 /** | |
292 * Stream controller for [onAnalysisInvalidate]. | |
293 */ | |
294 StreamController<AnalysisInvalidateParams> _onAnalysisInvalidate; | |
295 | |
296 /** | |
297 * Reports the navigation targets associated with a given file. | |
298 * | |
299 * This notification is not subscribed to by default. Clients can subscribe | |
300 * by including the value "NAVIGATION" in the list of services passed in an | |
301 * analysis.setSubscriptions request. | |
302 * | |
303 * Parameters | |
304 * | |
305 * file ( FilePath ) | |
306 * | |
307 * The file containing the navigation regions. | |
308 * | |
309 * regions ( List<NavigationRegion> ) | |
310 * | |
311 * The navigation regions contained in the file. The regions are sorted by | |
312 * their offsets. Each navigation region represents a list of targets | |
313 * associated with some range. The lists will usually contain a single | |
314 * target, but can contain more in the case of a part that is included in | |
315 * multiple libraries or in Dart code that is compiled against multiple | |
316 * versions of a package. Note that the navigation regions that are | |
317 * returned do not overlap other navigation regions. | |
318 * | |
319 * targets ( List<NavigationTarget> ) | |
320 * | |
321 * The navigation targets referenced in the file. They are referenced by | |
322 * NavigationRegions by their index in this array. | |
323 * | |
324 * files ( List<FilePath> ) | |
325 * | |
326 * The files containing navigation targets referenced in the file. They are | |
327 * referenced by NavigationTargets by their index in this array. | |
328 */ | |
329 Stream<AnalysisNavigationParams> onAnalysisNavigation; | |
330 | |
331 /** | |
332 * Stream controller for [onAnalysisNavigation]. | |
333 */ | |
334 StreamController<AnalysisNavigationParams> _onAnalysisNavigation; | |
335 | |
336 /** | |
337 * Reports the occurrences of references to elements within a single file. | |
338 * | |
339 * This notification is not subscribed to by default. Clients can subscribe | |
340 * by including the value "OCCURRENCES" in the list of services passed in an | |
341 * analysis.setSubscriptions request. | |
342 * | |
343 * Parameters | |
344 * | |
345 * file ( FilePath ) | |
346 * | |
347 * The file in which the references occur. | |
348 * | |
349 * occurrences ( List<Occurrences> ) | |
350 * | |
351 * The occurrences of references to elements within the file. | |
352 */ | |
353 Stream<AnalysisOccurrencesParams> onAnalysisOccurrences; | |
354 | |
355 /** | |
356 * Stream controller for [onAnalysisOccurrences]. | |
357 */ | |
358 StreamController<AnalysisOccurrencesParams> _onAnalysisOccurrences; | |
359 | |
360 /** | |
361 * Reports the outline associated with a single file. | |
362 * | |
363 * This notification is not subscribed to by default. Clients can subscribe | |
364 * by including the value "OUTLINE" in the list of services passed in an | |
365 * analysis.setSubscriptions request. | |
366 * | |
367 * Parameters | |
368 * | |
369 * file ( FilePath ) | |
370 * | |
371 * The file with which the outline is associated. | |
372 * | |
373 * kind ( FileKind ) | |
374 * | |
375 * The kind of the file. | |
376 * | |
377 * libraryName ( optional String ) | |
378 * | |
379 * The name of the library defined by the file using a "library" directive, | |
380 * or referenced by a "part of" directive. If both "library" and "part of" | |
381 * directives are present, then the "library" directive takes precedence. | |
382 * This field will be omitted if the file has neither "library" nor "part | |
383 * of" directives. | |
384 * | |
385 * outline ( Outline ) | |
386 * | |
387 * The outline associated with the file. | |
388 */ | |
389 Stream<AnalysisOutlineParams> onAnalysisOutline; | |
390 | |
391 /** | |
392 * Stream controller for [onAnalysisOutline]. | |
393 */ | |
394 StreamController<AnalysisOutlineParams> _onAnalysisOutline; | |
395 | |
396 /** | |
397 * Reports the overridding members in a file. | |
398 * | |
399 * This notification is not subscribed to by default. Clients can subscribe | |
400 * by including the value "OVERRIDES" in the list of services passed in an | |
401 * analysis.setSubscriptions request. | |
402 * | |
403 * Parameters | |
404 * | |
405 * file ( FilePath ) | |
406 * | |
407 * The file with which the overrides are associated. | |
408 * | |
409 * overrides ( List<Override> ) | |
410 * | |
411 * The overrides associated with the file. | |
412 */ | |
413 Stream<AnalysisOverridesParams> onAnalysisOverrides; | |
414 | |
415 /** | |
416 * Stream controller for [onAnalysisOverrides]. | |
417 */ | |
418 StreamController<AnalysisOverridesParams> _onAnalysisOverrides; | |
419 | |
420 /** | |
421 * Reports the completion suggestions that should be presented to the user. | |
422 * The set of suggestions included in the notification is always a complete | |
423 * list that supersedes any previously reported suggestions. | |
424 * | |
425 * Parameters | |
426 * | |
427 * id ( CompletionId ) | |
428 * | |
429 * The id associated with the completion. | |
430 * | |
431 * replacementOffset ( int ) | |
432 * | |
433 * The offset of the start of the text to be replaced. This will be | |
434 * different than the offset used to request the completion suggestions if | |
435 * there was a portion of an identifier before the original offset. In | |
436 * particular, the replacementOffset will be the offset of the beginning of | |
437 * said identifier. | |
438 * | |
439 * replacementLength ( int ) | |
440 * | |
441 * The length of the text to be replaced if the remainder of the identifier | |
442 * containing the cursor is to be replaced when the suggestion is applied | |
443 * (that is, the number of characters in the existing identifier). | |
444 * | |
445 * results ( List<CompletionSuggestion> ) | |
446 * | |
447 * The completion suggestions being reported. The notification contains all | |
448 * possible completions at the requested cursor position, even those that | |
449 * do not match the characters the user has already typed. This allows the | |
450 * client to respond to further keystrokes from the user without having to | |
451 * make additional requests. | |
452 * | |
453 * isLast ( bool ) | |
454 * | |
455 * True if this is that last set of results that will be returned for the | |
456 * indicated completion. | |
457 */ | |
458 Stream<CompletionResultsParams> onCompletionResults; | |
459 | |
460 /** | |
461 * Stream controller for [onCompletionResults]. | |
462 */ | |
463 StreamController<CompletionResultsParams> _onCompletionResults; | |
464 | |
465 /** | |
466 * Reports some or all of the results of performing a requested search. | |
467 * Unlike other notifications, this notification contains search results that | |
468 * should be added to any previously received search results associated with | |
469 * the same search id. | |
470 * | |
471 * Parameters | |
472 * | |
473 * id ( SearchId ) | |
474 * | |
475 * The id associated with the search. | |
476 * | |
477 * results ( List<SearchResult> ) | |
478 * | |
479 * The search results being reported. | |
480 * | |
481 * isLast ( bool ) | |
482 * | |
483 * True if this is that last set of results that will be returned for the | |
484 * indicated search. | |
485 */ | |
486 Stream<SearchResultsParams> onSearchResults; | |
487 | |
488 /** | |
489 * Stream controller for [onSearchResults]. | |
490 */ | |
491 StreamController<SearchResultsParams> _onSearchResults; | |
492 | |
493 /** | |
494 * Reports information needed to allow a single file to be launched. | |
495 * | |
496 * This notification is not subscribed to by default. Clients can subscribe | |
497 * by including the value "LAUNCH_DATA" in the list of services passed in an | |
498 * execution.setSubscriptions request. | |
499 * | |
500 * Parameters | |
501 * | |
502 * file ( FilePath ) | |
503 * | |
504 * The file for which launch data is being provided. This will either be a | |
505 * Dart library or an HTML file. | |
506 * | |
507 * kind ( optional ExecutableKind ) | |
508 * | |
509 * The kind of the executable file. This field is omitted if the file is | |
510 * not a Dart file. | |
511 * | |
512 * referencedFiles ( optional List<FilePath> ) | |
513 * | |
514 * A list of the Dart files that are referenced by the file. This field is | |
515 * omitted if the file is not an HTML file. | |
516 */ | |
517 Stream<ExecutionLaunchDataParams> onExecutionLaunchData; | |
518 | |
519 /** | |
520 * Stream controller for [onExecutionLaunchData]. | |
521 */ | |
522 StreamController<ExecutionLaunchDataParams> _onExecutionLaunchData; | |
523 | |
524 Server get server; | |
525 | |
526 /** | |
527 * Dispatch the notification named [event], and containing parameters | |
528 * [params], to the appropriate stream. | |
529 */ | |
530 void dispatchNotification(String event, params) { | |
531 ResponseDecoder decoder = new ResponseDecoder(null); | |
532 switch (event) { | |
533 case "server.connected": | |
534 expect(params, isServerConnectedParams); | |
535 _onServerConnected | |
536 .add(new ServerConnectedParams.fromJson(decoder, 'params', params)); | |
537 break; | |
538 case "server.error": | |
539 expect(params, isServerErrorParams); | |
540 _onServerError | |
541 .add(new ServerErrorParams.fromJson(decoder, 'params', params)); | |
542 break; | |
543 case "server.status": | |
544 expect(params, isServerStatusParams); | |
545 _onServerStatus | |
546 .add(new ServerStatusParams.fromJson(decoder, 'params', params)); | |
547 break; | |
548 case "analysis.analyzedFiles": | |
549 expect(params, isAnalysisAnalyzedFilesParams); | |
550 _onAnalysisAnalyzedFiles.add(new AnalysisAnalyzedFilesParams.fromJson( | |
551 decoder, 'params', params)); | |
552 break; | |
553 case "analysis.errors": | |
554 expect(params, isAnalysisErrorsParams); | |
555 _onAnalysisErrors | |
556 .add(new AnalysisErrorsParams.fromJson(decoder, 'params', params)); | |
557 break; | |
558 case "analysis.flushResults": | |
559 expect(params, isAnalysisFlushResultsParams); | |
560 _onAnalysisFlushResults.add( | |
561 new AnalysisFlushResultsParams.fromJson(decoder, 'params', params)); | |
562 break; | |
563 case "analysis.folding": | |
564 expect(params, isAnalysisFoldingParams); | |
565 _onAnalysisFolding | |
566 .add(new AnalysisFoldingParams.fromJson(decoder, 'params', params)); | |
567 break; | |
568 case "analysis.highlights": | |
569 expect(params, isAnalysisHighlightsParams); | |
570 _onAnalysisHighlights.add( | |
571 new AnalysisHighlightsParams.fromJson(decoder, 'params', params)); | |
572 break; | |
573 case "analysis.implemented": | |
574 expect(params, isAnalysisImplementedParams); | |
575 _onAnalysisImplemented.add( | |
576 new AnalysisImplementedParams.fromJson(decoder, 'params', params)); | |
577 break; | |
578 case "analysis.invalidate": | |
579 expect(params, isAnalysisInvalidateParams); | |
580 _onAnalysisInvalidate.add( | |
581 new AnalysisInvalidateParams.fromJson(decoder, 'params', params)); | |
582 break; | |
583 case "analysis.navigation": | |
584 expect(params, isAnalysisNavigationParams); | |
585 _onAnalysisNavigation.add( | |
586 new AnalysisNavigationParams.fromJson(decoder, 'params', params)); | |
587 break; | |
588 case "analysis.occurrences": | |
589 expect(params, isAnalysisOccurrencesParams); | |
590 _onAnalysisOccurrences.add( | |
591 new AnalysisOccurrencesParams.fromJson(decoder, 'params', params)); | |
592 break; | |
593 case "analysis.outline": | |
594 expect(params, isAnalysisOutlineParams); | |
595 _onAnalysisOutline | |
596 .add(new AnalysisOutlineParams.fromJson(decoder, 'params', params)); | |
597 break; | |
598 case "analysis.overrides": | |
599 expect(params, isAnalysisOverridesParams); | |
600 _onAnalysisOverrides.add( | |
601 new AnalysisOverridesParams.fromJson(decoder, 'params', params)); | |
602 break; | |
603 case "completion.results": | |
604 expect(params, isCompletionResultsParams); | |
605 _onCompletionResults.add( | |
606 new CompletionResultsParams.fromJson(decoder, 'params', params)); | |
607 break; | |
608 case "search.results": | |
609 expect(params, isSearchResultsParams); | |
610 _onSearchResults | |
611 .add(new SearchResultsParams.fromJson(decoder, 'params', params)); | |
612 break; | |
613 case "execution.launchData": | |
614 expect(params, isExecutionLaunchDataParams); | |
615 _onExecutionLaunchData.add( | |
616 new ExecutionLaunchDataParams.fromJson(decoder, 'params', params)); | |
617 break; | |
618 default: | |
619 fail('Unexpected notification: $event'); | |
620 break; | |
621 } | |
622 } | |
623 | |
624 /** | |
625 * Initialize the fields in InttestMixin, and ensure that notifications will | |
626 * be handled. | |
627 */ | |
628 void initializeInttestMixin() { | |
629 _onServerConnected = | |
630 new StreamController<ServerConnectedParams>(sync: true); | |
631 onServerConnected = _onServerConnected.stream.asBroadcastStream(); | |
632 _onServerError = new StreamController<ServerErrorParams>(sync: true); | |
633 onServerError = _onServerError.stream.asBroadcastStream(); | |
634 _onServerStatus = new StreamController<ServerStatusParams>(sync: true); | |
635 onServerStatus = _onServerStatus.stream.asBroadcastStream(); | |
636 _onAnalysisAnalyzedFiles = | |
637 new StreamController<AnalysisAnalyzedFilesParams>(sync: true); | |
638 onAnalysisAnalyzedFiles = | |
639 _onAnalysisAnalyzedFiles.stream.asBroadcastStream(); | |
640 _onAnalysisErrors = new StreamController<AnalysisErrorsParams>(sync: true); | |
641 onAnalysisErrors = _onAnalysisErrors.stream.asBroadcastStream(); | |
642 _onAnalysisFlushResults = | |
643 new StreamController<AnalysisFlushResultsParams>(sync: true); | |
644 onAnalysisFlushResults = _onAnalysisFlushResults.stream.asBroadcastStream(); | |
645 _onAnalysisFolding = | |
646 new StreamController<AnalysisFoldingParams>(sync: true); | |
647 onAnalysisFolding = _onAnalysisFolding.stream.asBroadcastStream(); | |
648 _onAnalysisHighlights = | |
649 new StreamController<AnalysisHighlightsParams>(sync: true); | |
650 onAnalysisHighlights = _onAnalysisHighlights.stream.asBroadcastStream(); | |
651 _onAnalysisImplemented = | |
652 new StreamController<AnalysisImplementedParams>(sync: true); | |
653 onAnalysisImplemented = _onAnalysisImplemented.stream.asBroadcastStream(); | |
654 _onAnalysisInvalidate = | |
655 new StreamController<AnalysisInvalidateParams>(sync: true); | |
656 onAnalysisInvalidate = _onAnalysisInvalidate.stream.asBroadcastStream(); | |
657 _onAnalysisNavigation = | |
658 new StreamController<AnalysisNavigationParams>(sync: true); | |
659 onAnalysisNavigation = _onAnalysisNavigation.stream.asBroadcastStream(); | |
660 _onAnalysisOccurrences = | |
661 new StreamController<AnalysisOccurrencesParams>(sync: true); | |
662 onAnalysisOccurrences = _onAnalysisOccurrences.stream.asBroadcastStream(); | |
663 _onAnalysisOutline = | |
664 new StreamController<AnalysisOutlineParams>(sync: true); | |
665 onAnalysisOutline = _onAnalysisOutline.stream.asBroadcastStream(); | |
666 _onAnalysisOverrides = | |
667 new StreamController<AnalysisOverridesParams>(sync: true); | |
668 onAnalysisOverrides = _onAnalysisOverrides.stream.asBroadcastStream(); | |
669 _onCompletionResults = | |
670 new StreamController<CompletionResultsParams>(sync: true); | |
671 onCompletionResults = _onCompletionResults.stream.asBroadcastStream(); | |
672 _onSearchResults = new StreamController<SearchResultsParams>(sync: true); | |
673 onSearchResults = _onSearchResults.stream.asBroadcastStream(); | |
674 _onExecutionLaunchData = | |
675 new StreamController<ExecutionLaunchDataParams>(sync: true); | |
676 onExecutionLaunchData = _onExecutionLaunchData.stream.asBroadcastStream(); | |
677 } | |
678 | |
679 /** | |
680 * Return the errors associated with the given file. If the errors for the | 165 * Return the errors associated with the given file. If the errors for the |
681 * given file have not yet been computed, or the most recently computed | 166 * given file have not yet been computed, or the most recently computed |
682 * errors for the given file are out of date, then the response for this | 167 * errors for the given file are out of date, then the response for this |
683 * request will be delayed until they have been computed. If some or all of | 168 * request will be delayed until they have been computed. If some or all of |
684 * the errors for the file cannot be computed, then the subset of the errors | 169 * the errors for the file cannot be computed, then the subset of the errors |
685 * that can be computed will be returned and the response will contain an | 170 * that can be computed will be returned and the response will contain an |
686 * error to indicate why the errors could not be computed. If the content of | 171 * error to indicate why the errors could not be computed. If the content of |
687 * the file changes after this request was received but before a response | 172 * the file changes after this request was received but before a response |
688 * could be sent, then an error of type CONTENT_MODIFIED will be generated. | 173 * could be sent, then an error of type CONTENT_MODIFIED will be generated. |
689 * | 174 * |
(...skipping 14 matching lines...) Expand all Loading... |
704 * The file for which errors are being requested. | 189 * The file for which errors are being requested. |
705 * | 190 * |
706 * Returns | 191 * Returns |
707 * | 192 * |
708 * errors ( List<AnalysisError> ) | 193 * errors ( List<AnalysisError> ) |
709 * | 194 * |
710 * The errors associated with the file. | 195 * The errors associated with the file. |
711 */ | 196 */ |
712 Future<AnalysisGetErrorsResult> sendAnalysisGetErrors(String file) { | 197 Future<AnalysisGetErrorsResult> sendAnalysisGetErrors(String file) { |
713 var params = new AnalysisGetErrorsParams(file).toJson(); | 198 var params = new AnalysisGetErrorsParams(file).toJson(); |
714 return server.send("analysis.getErrors", params).then((result) { | 199 return server.send("analysis.getErrors", params) |
| 200 .then((result) { |
715 ResponseDecoder decoder = new ResponseDecoder(null); | 201 ResponseDecoder decoder = new ResponseDecoder(null); |
716 return new AnalysisGetErrorsResult.fromJson(decoder, 'result', result); | 202 return new AnalysisGetErrorsResult.fromJson(decoder, 'result', result); |
717 }); | 203 }); |
718 } | 204 } |
719 | 205 |
720 /** | 206 /** |
721 * Return the hover information associate with the given location. If some or | 207 * Return the hover information associate with the given location. If some or |
722 * all of the hover information is not available at the time this request is | 208 * all of the hover information is not available at the time this request is |
723 * processed the information will be omitted from the response. | 209 * processed the information will be omitted from the response. |
724 * | 210 * |
(...skipping 12 matching lines...) Expand all Loading... |
737 * hovers ( List<HoverInformation> ) | 223 * hovers ( List<HoverInformation> ) |
738 * | 224 * |
739 * The hover information associated with the location. The list will be | 225 * The hover information associated with the location. The list will be |
740 * empty if no information could be determined for the location. The list | 226 * empty if no information could be determined for the location. The list |
741 * can contain multiple items if the file is being analyzed in multiple | 227 * can contain multiple items if the file is being analyzed in multiple |
742 * contexts in conflicting ways (such as a part that is included in | 228 * contexts in conflicting ways (such as a part that is included in |
743 * multiple libraries). | 229 * multiple libraries). |
744 */ | 230 */ |
745 Future<AnalysisGetHoverResult> sendAnalysisGetHover(String file, int offset) { | 231 Future<AnalysisGetHoverResult> sendAnalysisGetHover(String file, int offset) { |
746 var params = new AnalysisGetHoverParams(file, offset).toJson(); | 232 var params = new AnalysisGetHoverParams(file, offset).toJson(); |
747 return server.send("analysis.getHover", params).then((result) { | 233 return server.send("analysis.getHover", params) |
| 234 .then((result) { |
748 ResponseDecoder decoder = new ResponseDecoder(null); | 235 ResponseDecoder decoder = new ResponseDecoder(null); |
749 return new AnalysisGetHoverResult.fromJson(decoder, 'result', result); | 236 return new AnalysisGetHoverResult.fromJson(decoder, 'result', result); |
750 }); | 237 }); |
751 } | 238 } |
752 | 239 |
753 /** | 240 /** |
754 * Return library dependency information for use in client-side indexing and | 241 * Return library dependency information for use in client-side indexing and |
755 * package URI resolution. | 242 * package URI resolution. |
756 * | 243 * |
757 * Clients that are only using the libraries field should consider using the | 244 * Clients that are only using the libraries field should consider using the |
758 * analyzedFiles notification instead. | 245 * analyzedFiles notification instead. |
759 * | 246 * |
760 * Returns | 247 * Returns |
761 * | 248 * |
762 * libraries ( List<FilePath> ) | 249 * libraries ( List<FilePath> ) |
763 * | 250 * |
764 * A list of the paths of library elements referenced by files in existing | 251 * A list of the paths of library elements referenced by files in existing |
765 * analysis roots. | 252 * analysis roots. |
766 * | 253 * |
767 * packageMap ( Map<String, Map<String, List<FilePath>>> ) | 254 * packageMap ( Map<String, Map<String, List<FilePath>>> ) |
768 * | 255 * |
769 * A mapping from context source roots to package maps which map package | 256 * A mapping from context source roots to package maps which map package |
770 * names to source directories for use in client-side package URI | 257 * names to source directories for use in client-side package URI |
771 * resolution. | 258 * resolution. |
772 */ | 259 */ |
773 Future< | 260 Future<AnalysisGetLibraryDependenciesResult> sendAnalysisGetLibraryDependencie
s() { |
774 AnalysisGetLibraryDependenciesResult> sendAnalysisGetLibraryDependencies()
{ | 261 return server.send("analysis.getLibraryDependencies", null) |
775 return server.send("analysis.getLibraryDependencies", null).then((result) { | 262 .then((result) { |
776 ResponseDecoder decoder = new ResponseDecoder(null); | 263 ResponseDecoder decoder = new ResponseDecoder(null); |
777 return new AnalysisGetLibraryDependenciesResult.fromJson( | 264 return new AnalysisGetLibraryDependenciesResult.fromJson(decoder, 'result'
, result); |
778 decoder, 'result', result); | |
779 }); | 265 }); |
780 } | 266 } |
781 | 267 |
782 /** | 268 /** |
783 * Return the navigation information associated with the given region of the | 269 * Return the navigation information associated with the given region of the |
784 * given file. If the navigation information for the given file has not yet | 270 * given file. If the navigation information for the given file has not yet |
785 * been computed, or the most recently computed navigation information for | 271 * been computed, or the most recently computed navigation information for |
786 * the given file is out of date, then the response for this request will be | 272 * the given file is out of date, then the response for this request will be |
787 * delayed until it has been computed. If the content of the file changes | 273 * delayed until it has been computed. If the content of the file changes |
788 * after this request was received but before a response could be sent, then | 274 * after this request was received but before a response could be sent, then |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 * targets ( List<NavigationTarget> ) | 312 * targets ( List<NavigationTarget> ) |
827 * | 313 * |
828 * A list of the navigation targets that are referenced by the navigation | 314 * A list of the navigation targets that are referenced by the navigation |
829 * regions. | 315 * regions. |
830 * | 316 * |
831 * regions ( List<NavigationRegion> ) | 317 * regions ( List<NavigationRegion> ) |
832 * | 318 * |
833 * A list of the navigation regions within the requested region of the | 319 * A list of the navigation regions within the requested region of the |
834 * file. | 320 * file. |
835 */ | 321 */ |
836 Future<AnalysisGetNavigationResult> sendAnalysisGetNavigation( | 322 Future<AnalysisGetNavigationResult> sendAnalysisGetNavigation(String file, int
offset, int length) { |
837 String file, int offset, int length) { | |
838 var params = new AnalysisGetNavigationParams(file, offset, length).toJson(); | 323 var params = new AnalysisGetNavigationParams(file, offset, length).toJson(); |
839 return server.send("analysis.getNavigation", params).then((result) { | 324 return server.send("analysis.getNavigation", params) |
| 325 .then((result) { |
840 ResponseDecoder decoder = new ResponseDecoder(null); | 326 ResponseDecoder decoder = new ResponseDecoder(null); |
841 return new AnalysisGetNavigationResult.fromJson( | 327 return new AnalysisGetNavigationResult.fromJson(decoder, 'result', result)
; |
842 decoder, 'result', result); | |
843 }); | 328 }); |
844 } | 329 } |
845 | 330 |
846 /** | 331 /** |
847 * Force the re-analysis of everything contained in the specified analysis | 332 * Force the re-analysis of everything contained in the specified analysis |
848 * roots. This will cause all previously computed analysis results to be | 333 * roots. This will cause all previously computed analysis results to be |
849 * discarded and recomputed, and will cause all subscribed notifications to | 334 * discarded and recomputed, and will cause all subscribed notifications to |
850 * be re-sent. | 335 * be re-sent. |
851 * | 336 * |
852 * If no analysis roots are provided, then all current analysis roots will be | 337 * If no analysis roots are provided, then all current analysis roots will be |
853 * re-analyzed. If an empty list of analysis roots is provided, then nothing | 338 * re-analyzed. If an empty list of analysis roots is provided, then nothing |
854 * will be re-analyzed. If the list contains one or more paths that are not | 339 * will be re-analyzed. If the list contains one or more paths that are not |
855 * currently analysis roots, then an error of type INVALID_ANALYSIS_ROOT will | 340 * currently analysis roots, then an error of type INVALID_ANALYSIS_ROOT will |
856 * be generated. | 341 * be generated. |
857 * | 342 * |
858 * Parameters | 343 * Parameters |
859 * | 344 * |
860 * roots ( optional List<FilePath> ) | 345 * roots ( optional List<FilePath> ) |
861 * | 346 * |
862 * A list of the analysis roots that are to be re-analyzed. | 347 * A list of the analysis roots that are to be re-analyzed. |
863 */ | 348 */ |
864 Future sendAnalysisReanalyze({List<String> roots}) { | 349 Future sendAnalysisReanalyze({List<String> roots}) { |
865 var params = new AnalysisReanalyzeParams(roots: roots).toJson(); | 350 var params = new AnalysisReanalyzeParams(roots: roots).toJson(); |
866 return server.send("analysis.reanalyze", params).then((result) { | 351 return server.send("analysis.reanalyze", params) |
| 352 .then((result) { |
867 expect(result, isNull); | 353 expect(result, isNull); |
868 return null; | 354 return null; |
869 }); | 355 }); |
870 } | 356 } |
871 | 357 |
872 /** | 358 /** |
873 * Sets the root paths used to determine which files to analyze. The set of | 359 * Sets the root paths used to determine which files to analyze. The set of |
874 * files to be analyzed are all of the files in one of the root paths that | 360 * files to be analyzed are all of the files in one of the root paths that |
875 * are not either explicitly or implicitly excluded. A file is explicitly | 361 * are not either explicitly or implicitly excluded. A file is explicitly |
876 * excluded if it is in one of the excluded paths. A file is implicitly | 362 * excluded if it is in one of the excluded paths. A file is implicitly |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 * pubspec.yaml file which resolves any package: URI to the corresponding | 400 * pubspec.yaml file which resolves any package: URI to the corresponding |
915 * path within the target directory. The effect is the same as specifying | 401 * path within the target directory. The effect is the same as specifying |
916 * the target directory as a "--package_root" parameter to the Dart VM when | 402 * the target directory as a "--package_root" parameter to the Dart VM when |
917 * executing any Dart file inside the source directory. | 403 * executing any Dart file inside the source directory. |
918 * | 404 * |
919 * Files in any directories that are not overridden by this mapping have | 405 * Files in any directories that are not overridden by this mapping have |
920 * their package: URI's resolved using the normal pubspec.yaml mechanism. | 406 * their package: URI's resolved using the normal pubspec.yaml mechanism. |
921 * If this field is absent, or the empty map is specified, that indicates | 407 * If this field is absent, or the empty map is specified, that indicates |
922 * that the normal pubspec.yaml mechanism should always be used. | 408 * that the normal pubspec.yaml mechanism should always be used. |
923 */ | 409 */ |
924 Future sendAnalysisSetAnalysisRoots( | 410 Future sendAnalysisSetAnalysisRoots(List<String> included, List<String> exclud
ed, {Map<String, String> packageRoots}) { |
925 List<String> included, List<String> excluded, | 411 var params = new AnalysisSetAnalysisRootsParams(included, excluded, packageR
oots: packageRoots).toJson(); |
926 {Map<String, String> packageRoots}) { | 412 return server.send("analysis.setAnalysisRoots", params) |
927 var params = new AnalysisSetAnalysisRootsParams(included, excluded, | 413 .then((result) { |
928 packageRoots: packageRoots).toJson(); | |
929 return server.send("analysis.setAnalysisRoots", params).then((result) { | |
930 expect(result, isNull); | 414 expect(result, isNull); |
931 return null; | 415 return null; |
932 }); | 416 }); |
933 } | 417 } |
934 | 418 |
935 /** | 419 /** |
936 * Subscribe for general services (that is, services that are not specific to | 420 * Subscribe for general services (that is, services that are not specific to |
937 * individual files). All previous subscriptions are replaced by the given | 421 * individual files). All previous subscriptions are replaced by the given |
938 * set of services. | 422 * set of services. |
939 * | 423 * |
940 * It is an error if any of the elements in the list are not valid services. | 424 * It is an error if any of the elements in the list are not valid services. |
941 * If there is an error, then the current subscriptions will remain | 425 * If there is an error, then the current subscriptions will remain |
942 * unchanged. | 426 * unchanged. |
943 * | 427 * |
944 * Parameters | 428 * Parameters |
945 * | 429 * |
946 * subscriptions ( List<GeneralAnalysisService> ) | 430 * subscriptions ( List<GeneralAnalysisService> ) |
947 * | 431 * |
948 * A list of the services being subscribed to. | 432 * A list of the services being subscribed to. |
949 */ | 433 */ |
950 Future sendAnalysisSetGeneralSubscriptions( | 434 Future sendAnalysisSetGeneralSubscriptions(List<GeneralAnalysisService> subscr
iptions) { |
951 List<GeneralAnalysisService> subscriptions) { | 435 var params = new AnalysisSetGeneralSubscriptionsParams(subscriptions).toJson
(); |
952 var params = | 436 return server.send("analysis.setGeneralSubscriptions", params) |
953 new AnalysisSetGeneralSubscriptionsParams(subscriptions).toJson(); | |
954 return server | |
955 .send("analysis.setGeneralSubscriptions", params) | |
956 .then((result) { | 437 .then((result) { |
957 expect(result, isNull); | 438 expect(result, isNull); |
958 return null; | 439 return null; |
959 }); | 440 }); |
960 } | 441 } |
961 | 442 |
962 /** | 443 /** |
963 * Set the priority files to the files in the given list. A priority file is | 444 * Set the priority files to the files in the given list. A priority file is |
964 * a file that is given priority when scheduling which analysis work to do | 445 * a file that is given priority when scheduling which analysis work to do |
965 * first. The list typically contains those files that are visible to the | 446 * first. The list typically contains those files that are visible to the |
(...skipping 13 matching lines...) Expand all Loading... |
979 * can be included in the set of actual priority files. | 460 * can be included in the set of actual priority files. |
980 * | 461 * |
981 * Parameters | 462 * Parameters |
982 * | 463 * |
983 * files ( List<FilePath> ) | 464 * files ( List<FilePath> ) |
984 * | 465 * |
985 * The files that are to be a priority for analysis. | 466 * The files that are to be a priority for analysis. |
986 */ | 467 */ |
987 Future sendAnalysisSetPriorityFiles(List<String> files) { | 468 Future sendAnalysisSetPriorityFiles(List<String> files) { |
988 var params = new AnalysisSetPriorityFilesParams(files).toJson(); | 469 var params = new AnalysisSetPriorityFilesParams(files).toJson(); |
989 return server.send("analysis.setPriorityFiles", params).then((result) { | 470 return server.send("analysis.setPriorityFiles", params) |
| 471 .then((result) { |
990 expect(result, isNull); | 472 expect(result, isNull); |
991 return null; | 473 return null; |
992 }); | 474 }); |
993 } | 475 } |
994 | 476 |
995 /** | 477 /** |
996 * Subscribe for services that are specific to individual files. All previous | 478 * Subscribe for services that are specific to individual files. All previous |
997 * subscriptions are replaced by the current set of subscriptions. If a given | 479 * subscriptions are replaced by the current set of subscriptions. If a given |
998 * service is not included as a key in the map then no files will be | 480 * service is not included as a key in the map then no files will be |
999 * subscribed to the service, exactly as if the service had been included in | 481 * subscribed to the service, exactly as if the service had been included in |
(...skipping 17 matching lines...) Expand all Loading... |
1017 * It is an error if any of the keys in the map are not valid services. If | 499 * It is an error if any of the keys in the map are not valid services. If |
1018 * there is an error, then the existing subscriptions will remain unchanged. | 500 * there is an error, then the existing subscriptions will remain unchanged. |
1019 * | 501 * |
1020 * Parameters | 502 * Parameters |
1021 * | 503 * |
1022 * subscriptions ( Map<AnalysisService, List<FilePath>> ) | 504 * subscriptions ( Map<AnalysisService, List<FilePath>> ) |
1023 * | 505 * |
1024 * A table mapping services to a list of the files being subscribed to the | 506 * A table mapping services to a list of the files being subscribed to the |
1025 * service. | 507 * service. |
1026 */ | 508 */ |
1027 Future sendAnalysisSetSubscriptions( | 509 Future sendAnalysisSetSubscriptions(Map<AnalysisService, List<String>> subscri
ptions) { |
1028 Map<AnalysisService, List<String>> subscriptions) { | |
1029 var params = new AnalysisSetSubscriptionsParams(subscriptions).toJson(); | 510 var params = new AnalysisSetSubscriptionsParams(subscriptions).toJson(); |
1030 return server.send("analysis.setSubscriptions", params).then((result) { | 511 return server.send("analysis.setSubscriptions", params) |
| 512 .then((result) { |
1031 expect(result, isNull); | 513 expect(result, isNull); |
1032 return null; | 514 return null; |
1033 }); | 515 }); |
1034 } | 516 } |
1035 | 517 |
1036 /** | 518 /** |
1037 * Update the content of one or more files. Files that were previously | 519 * Update the content of one or more files. Files that were previously |
1038 * updated but not included in this update remain unchanged. This effectively | 520 * updated but not included in this update remain unchanged. This effectively |
1039 * represents an overlay of the filesystem. The files whose content is | 521 * represents an overlay of the filesystem. The files whose content is |
1040 * overridden are therefore seen by server as being files with the given | 522 * overridden are therefore seen by server as being files with the given |
1041 * content, even if the files do not exist on the filesystem or if the file | 523 * content, even if the files do not exist on the filesystem or if the file |
1042 * path represents the path to a directory on the filesystem. | 524 * path represents the path to a directory on the filesystem. |
1043 * | 525 * |
1044 * Parameters | 526 * Parameters |
1045 * | 527 * |
1046 * files ( Map<FilePath, AddContentOverlay | ChangeContentOverlay | | 528 * files ( Map<FilePath, AddContentOverlay | ChangeContentOverlay | |
1047 * RemoveContentOverlay> ) | 529 * RemoveContentOverlay> ) |
1048 * | 530 * |
1049 * A table mapping the files whose content has changed to a description of | 531 * A table mapping the files whose content has changed to a description of |
1050 * the content change. | 532 * the content change. |
1051 * | 533 * |
1052 * Returns | 534 * Returns |
1053 */ | 535 */ |
1054 Future<AnalysisUpdateContentResult> sendAnalysisUpdateContent( | 536 Future<AnalysisUpdateContentResult> sendAnalysisUpdateContent(Map<String, dyna
mic> files) { |
1055 Map<String, dynamic> files) { | |
1056 var params = new AnalysisUpdateContentParams(files).toJson(); | 537 var params = new AnalysisUpdateContentParams(files).toJson(); |
1057 return server.send("analysis.updateContent", params).then((result) { | 538 return server.send("analysis.updateContent", params) |
| 539 .then((result) { |
1058 ResponseDecoder decoder = new ResponseDecoder(null); | 540 ResponseDecoder decoder = new ResponseDecoder(null); |
1059 return new AnalysisUpdateContentResult.fromJson( | 541 return new AnalysisUpdateContentResult.fromJson(decoder, 'result', result)
; |
1060 decoder, 'result', result); | |
1061 }); | 542 }); |
1062 } | 543 } |
1063 | 544 |
1064 /** | 545 /** |
1065 * Update the options controlling analysis based on the given set of options. | 546 * Update the options controlling analysis based on the given set of options. |
1066 * Any options that are not included in the analysis options will not be | 547 * Any options that are not included in the analysis options will not be |
1067 * changed. If there are options in the analysis options that are not valid, | 548 * changed. If there are options in the analysis options that are not valid, |
1068 * they will be silently ignored. | 549 * they will be silently ignored. |
1069 * | 550 * |
1070 * Parameters | 551 * Parameters |
1071 * | 552 * |
1072 * options ( AnalysisOptions ) | 553 * options ( AnalysisOptions ) |
1073 * | 554 * |
1074 * The options that are to be used to control analysis. | 555 * The options that are to be used to control analysis. |
1075 */ | 556 */ |
1076 Future sendAnalysisUpdateOptions(AnalysisOptions options) { | 557 Future sendAnalysisUpdateOptions(AnalysisOptions options) { |
1077 var params = new AnalysisUpdateOptionsParams(options).toJson(); | 558 var params = new AnalysisUpdateOptionsParams(options).toJson(); |
1078 return server.send("analysis.updateOptions", params).then((result) { | 559 return server.send("analysis.updateOptions", params) |
| 560 .then((result) { |
1079 expect(result, isNull); | 561 expect(result, isNull); |
1080 return null; | 562 return null; |
1081 }); | 563 }); |
1082 } | 564 } |
1083 | 565 |
1084 /** | 566 /** |
| 567 * Reports the paths of the files that are being analyzed. |
| 568 * |
| 569 * This notification is not subscribed to by default. Clients can subscribe |
| 570 * by including the value "ANALYZED_FILES" in the list of services passed in |
| 571 * an analysis.setGeneralSubscriptions request. |
| 572 * |
| 573 * Parameters |
| 574 * |
| 575 * directories ( List<FilePath> ) |
| 576 * |
| 577 * A list of the paths of the files that are being analyzed. |
| 578 */ |
| 579 Stream<AnalysisAnalyzedFilesParams> onAnalysisAnalyzedFiles; |
| 580 |
| 581 /** |
| 582 * Stream controller for [onAnalysisAnalyzedFiles]. |
| 583 */ |
| 584 StreamController<AnalysisAnalyzedFilesParams> _onAnalysisAnalyzedFiles; |
| 585 |
| 586 /** |
| 587 * Reports the errors associated with a given file. The set of errors |
| 588 * included in the notification is always a complete list that supersedes any |
| 589 * previously reported errors. |
| 590 * |
| 591 * It is only possible to unsubscribe from this notification by using the |
| 592 * command-line flag --no-error-notification. |
| 593 * |
| 594 * Parameters |
| 595 * |
| 596 * file ( FilePath ) |
| 597 * |
| 598 * The file containing the errors. |
| 599 * |
| 600 * errors ( List<AnalysisError> ) |
| 601 * |
| 602 * The errors contained in the file. |
| 603 */ |
| 604 Stream<AnalysisErrorsParams> onAnalysisErrors; |
| 605 |
| 606 /** |
| 607 * Stream controller for [onAnalysisErrors]. |
| 608 */ |
| 609 StreamController<AnalysisErrorsParams> _onAnalysisErrors; |
| 610 |
| 611 /** |
| 612 * Reports that any analysis results that were previously associated with the |
| 613 * given files should be considered to be invalid because those files are no |
| 614 * longer being analyzed, either because the analysis root that contained it |
| 615 * is no longer being analyzed or because the file no longer exists. |
| 616 * |
| 617 * If a file is included in this notification and at some later time a |
| 618 * notification with results for the file is received, clients should assume |
| 619 * that the file is once again being analyzed and the information should be |
| 620 * processed. |
| 621 * |
| 622 * It is not possible to subscribe to or unsubscribe from this notification. |
| 623 * |
| 624 * Parameters |
| 625 * |
| 626 * files ( List<FilePath> ) |
| 627 * |
| 628 * The files that are no longer being analyzed. |
| 629 */ |
| 630 Stream<AnalysisFlushResultsParams> onAnalysisFlushResults; |
| 631 |
| 632 /** |
| 633 * Stream controller for [onAnalysisFlushResults]. |
| 634 */ |
| 635 StreamController<AnalysisFlushResultsParams> _onAnalysisFlushResults; |
| 636 |
| 637 /** |
| 638 * Reports the folding regions associated with a given file. Folding regions |
| 639 * can be nested, but will not be overlapping. Nesting occurs when a foldable |
| 640 * element, such as a method, is nested inside another foldable element such |
| 641 * as a class. |
| 642 * |
| 643 * This notification is not subscribed to by default. Clients can subscribe |
| 644 * by including the value "FOLDING" in the list of services passed in an |
| 645 * analysis.setSubscriptions request. |
| 646 * |
| 647 * Parameters |
| 648 * |
| 649 * file ( FilePath ) |
| 650 * |
| 651 * The file containing the folding regions. |
| 652 * |
| 653 * regions ( List<FoldingRegion> ) |
| 654 * |
| 655 * The folding regions contained in the file. |
| 656 */ |
| 657 Stream<AnalysisFoldingParams> onAnalysisFolding; |
| 658 |
| 659 /** |
| 660 * Stream controller for [onAnalysisFolding]. |
| 661 */ |
| 662 StreamController<AnalysisFoldingParams> _onAnalysisFolding; |
| 663 |
| 664 /** |
| 665 * Reports the highlight regions associated with a given file. |
| 666 * |
| 667 * This notification is not subscribed to by default. Clients can subscribe |
| 668 * by including the value "HIGHLIGHTS" in the list of services passed in an |
| 669 * analysis.setSubscriptions request. |
| 670 * |
| 671 * Parameters |
| 672 * |
| 673 * file ( FilePath ) |
| 674 * |
| 675 * The file containing the highlight regions. |
| 676 * |
| 677 * regions ( List<HighlightRegion> ) |
| 678 * |
| 679 * The highlight regions contained in the file. Each highlight region |
| 680 * represents a particular syntactic or semantic meaning associated with |
| 681 * some range. Note that the highlight regions that are returned can |
| 682 * overlap other highlight regions if there is more than one meaning |
| 683 * associated with a particular region. |
| 684 */ |
| 685 Stream<AnalysisHighlightsParams> onAnalysisHighlights; |
| 686 |
| 687 /** |
| 688 * Stream controller for [onAnalysisHighlights]. |
| 689 */ |
| 690 StreamController<AnalysisHighlightsParams> _onAnalysisHighlights; |
| 691 |
| 692 /** |
| 693 * Reports the classes that are implemented or extended and class members |
| 694 * that are implemented or overridden in a file. |
| 695 * |
| 696 * This notification is not subscribed to by default. Clients can subscribe |
| 697 * by including the value "IMPLEMENTED" in the list of services passed in an |
| 698 * analysis.setSubscriptions request. |
| 699 * |
| 700 * Parameters |
| 701 * |
| 702 * file ( FilePath ) |
| 703 * |
| 704 * The file with which the implementations are associated. |
| 705 * |
| 706 * classes ( List<ImplementedClass> ) |
| 707 * |
| 708 * The classes defined in the file that are implemented or extended. |
| 709 * |
| 710 * members ( List<ImplementedMember> ) |
| 711 * |
| 712 * The member defined in the file that are implemented or overridden. |
| 713 */ |
| 714 Stream<AnalysisImplementedParams> onAnalysisImplemented; |
| 715 |
| 716 /** |
| 717 * Stream controller for [onAnalysisImplemented]. |
| 718 */ |
| 719 StreamController<AnalysisImplementedParams> _onAnalysisImplemented; |
| 720 |
| 721 /** |
| 722 * Reports that the navigation information associated with a region of a |
| 723 * single file has become invalid and should be re-requested. |
| 724 * |
| 725 * This notification is not subscribed to by default. Clients can subscribe |
| 726 * by including the value "INVALIDATE" in the list of services passed in an |
| 727 * analysis.setSubscriptions request. |
| 728 * |
| 729 * Parameters |
| 730 * |
| 731 * file ( FilePath ) |
| 732 * |
| 733 * The file whose information has been invalidated. |
| 734 * |
| 735 * offset ( int ) |
| 736 * |
| 737 * The offset of the invalidated region. |
| 738 * |
| 739 * length ( int ) |
| 740 * |
| 741 * The length of the invalidated region. |
| 742 * |
| 743 * delta ( int ) |
| 744 * |
| 745 * The delta to be applied to the offsets in information that follows the |
| 746 * invalidated region in order to update it so that it doesn't need to be |
| 747 * re-requested. |
| 748 */ |
| 749 Stream<AnalysisInvalidateParams> onAnalysisInvalidate; |
| 750 |
| 751 /** |
| 752 * Stream controller for [onAnalysisInvalidate]. |
| 753 */ |
| 754 StreamController<AnalysisInvalidateParams> _onAnalysisInvalidate; |
| 755 |
| 756 /** |
| 757 * Reports the navigation targets associated with a given file. |
| 758 * |
| 759 * This notification is not subscribed to by default. Clients can subscribe |
| 760 * by including the value "NAVIGATION" in the list of services passed in an |
| 761 * analysis.setSubscriptions request. |
| 762 * |
| 763 * Parameters |
| 764 * |
| 765 * file ( FilePath ) |
| 766 * |
| 767 * The file containing the navigation regions. |
| 768 * |
| 769 * regions ( List<NavigationRegion> ) |
| 770 * |
| 771 * The navigation regions contained in the file. The regions are sorted by |
| 772 * their offsets. Each navigation region represents a list of targets |
| 773 * associated with some range. The lists will usually contain a single |
| 774 * target, but can contain more in the case of a part that is included in |
| 775 * multiple libraries or in Dart code that is compiled against multiple |
| 776 * versions of a package. Note that the navigation regions that are |
| 777 * returned do not overlap other navigation regions. |
| 778 * |
| 779 * targets ( List<NavigationTarget> ) |
| 780 * |
| 781 * The navigation targets referenced in the file. They are referenced by |
| 782 * NavigationRegions by their index in this array. |
| 783 * |
| 784 * files ( List<FilePath> ) |
| 785 * |
| 786 * The files containing navigation targets referenced in the file. They are |
| 787 * referenced by NavigationTargets by their index in this array. |
| 788 */ |
| 789 Stream<AnalysisNavigationParams> onAnalysisNavigation; |
| 790 |
| 791 /** |
| 792 * Stream controller for [onAnalysisNavigation]. |
| 793 */ |
| 794 StreamController<AnalysisNavigationParams> _onAnalysisNavigation; |
| 795 |
| 796 /** |
| 797 * Reports the occurrences of references to elements within a single file. |
| 798 * |
| 799 * This notification is not subscribed to by default. Clients can subscribe |
| 800 * by including the value "OCCURRENCES" in the list of services passed in an |
| 801 * analysis.setSubscriptions request. |
| 802 * |
| 803 * Parameters |
| 804 * |
| 805 * file ( FilePath ) |
| 806 * |
| 807 * The file in which the references occur. |
| 808 * |
| 809 * occurrences ( List<Occurrences> ) |
| 810 * |
| 811 * The occurrences of references to elements within the file. |
| 812 */ |
| 813 Stream<AnalysisOccurrencesParams> onAnalysisOccurrences; |
| 814 |
| 815 /** |
| 816 * Stream controller for [onAnalysisOccurrences]. |
| 817 */ |
| 818 StreamController<AnalysisOccurrencesParams> _onAnalysisOccurrences; |
| 819 |
| 820 /** |
| 821 * Reports the outline associated with a single file. |
| 822 * |
| 823 * This notification is not subscribed to by default. Clients can subscribe |
| 824 * by including the value "OUTLINE" in the list of services passed in an |
| 825 * analysis.setSubscriptions request. |
| 826 * |
| 827 * Parameters |
| 828 * |
| 829 * file ( FilePath ) |
| 830 * |
| 831 * The file with which the outline is associated. |
| 832 * |
| 833 * kind ( FileKind ) |
| 834 * |
| 835 * The kind of the file. |
| 836 * |
| 837 * libraryName ( optional String ) |
| 838 * |
| 839 * The name of the library defined by the file using a "library" directive, |
| 840 * or referenced by a "part of" directive. If both "library" and "part of" |
| 841 * directives are present, then the "library" directive takes precedence. |
| 842 * This field will be omitted if the file has neither "library" nor "part |
| 843 * of" directives. |
| 844 * |
| 845 * outline ( Outline ) |
| 846 * |
| 847 * The outline associated with the file. |
| 848 */ |
| 849 Stream<AnalysisOutlineParams> onAnalysisOutline; |
| 850 |
| 851 /** |
| 852 * Stream controller for [onAnalysisOutline]. |
| 853 */ |
| 854 StreamController<AnalysisOutlineParams> _onAnalysisOutline; |
| 855 |
| 856 /** |
| 857 * Reports the overridding members in a file. |
| 858 * |
| 859 * This notification is not subscribed to by default. Clients can subscribe |
| 860 * by including the value "OVERRIDES" in the list of services passed in an |
| 861 * analysis.setSubscriptions request. |
| 862 * |
| 863 * Parameters |
| 864 * |
| 865 * file ( FilePath ) |
| 866 * |
| 867 * The file with which the overrides are associated. |
| 868 * |
| 869 * overrides ( List<Override> ) |
| 870 * |
| 871 * The overrides associated with the file. |
| 872 */ |
| 873 Stream<AnalysisOverridesParams> onAnalysisOverrides; |
| 874 |
| 875 /** |
| 876 * Stream controller for [onAnalysisOverrides]. |
| 877 */ |
| 878 StreamController<AnalysisOverridesParams> _onAnalysisOverrides; |
| 879 |
| 880 /** |
1085 * Request that completion suggestions for the given offset in the given file | 881 * Request that completion suggestions for the given offset in the given file |
1086 * be returned. | 882 * be returned. |
1087 * | 883 * |
1088 * Parameters | 884 * Parameters |
1089 * | 885 * |
1090 * file ( FilePath ) | 886 * file ( FilePath ) |
1091 * | 887 * |
1092 * The file containing the point at which suggestions are to be made. | 888 * The file containing the point at which suggestions are to be made. |
1093 * | 889 * |
1094 * offset ( int ) | 890 * offset ( int ) |
1095 * | 891 * |
1096 * The offset within the file at which suggestions are to be made. | 892 * The offset within the file at which suggestions are to be made. |
1097 * | 893 * |
1098 * Returns | 894 * Returns |
1099 * | 895 * |
1100 * id ( CompletionId ) | 896 * id ( CompletionId ) |
1101 * | 897 * |
1102 * The identifier used to associate results with this completion request. | 898 * The identifier used to associate results with this completion request. |
1103 */ | 899 */ |
1104 Future<CompletionGetSuggestionsResult> sendCompletionGetSuggestions( | 900 Future<CompletionGetSuggestionsResult> sendCompletionGetSuggestions(String fil
e, int offset) { |
1105 String file, int offset) { | |
1106 var params = new CompletionGetSuggestionsParams(file, offset).toJson(); | 901 var params = new CompletionGetSuggestionsParams(file, offset).toJson(); |
1107 return server.send("completion.getSuggestions", params).then((result) { | 902 return server.send("completion.getSuggestions", params) |
| 903 .then((result) { |
1108 ResponseDecoder decoder = new ResponseDecoder(null); | 904 ResponseDecoder decoder = new ResponseDecoder(null); |
1109 return new CompletionGetSuggestionsResult.fromJson( | 905 return new CompletionGetSuggestionsResult.fromJson(decoder, 'result', resu
lt); |
1110 decoder, 'result', result); | 906 }); |
1111 }); | 907 } |
1112 } | 908 |
| 909 /** |
| 910 * Reports the completion suggestions that should be presented to the user. |
| 911 * The set of suggestions included in the notification is always a complete |
| 912 * list that supersedes any previously reported suggestions. |
| 913 * |
| 914 * Parameters |
| 915 * |
| 916 * id ( CompletionId ) |
| 917 * |
| 918 * The id associated with the completion. |
| 919 * |
| 920 * replacementOffset ( int ) |
| 921 * |
| 922 * The offset of the start of the text to be replaced. This will be |
| 923 * different than the offset used to request the completion suggestions if |
| 924 * there was a portion of an identifier before the original offset. In |
| 925 * particular, the replacementOffset will be the offset of the beginning of |
| 926 * said identifier. |
| 927 * |
| 928 * replacementLength ( int ) |
| 929 * |
| 930 * The length of the text to be replaced if the remainder of the identifier |
| 931 * containing the cursor is to be replaced when the suggestion is applied |
| 932 * (that is, the number of characters in the existing identifier). |
| 933 * |
| 934 * results ( List<CompletionSuggestion> ) |
| 935 * |
| 936 * The completion suggestions being reported. The notification contains all |
| 937 * possible completions at the requested cursor position, even those that |
| 938 * do not match the characters the user has already typed. This allows the |
| 939 * client to respond to further keystrokes from the user without having to |
| 940 * make additional requests. |
| 941 * |
| 942 * isLast ( bool ) |
| 943 * |
| 944 * True if this is that last set of results that will be returned for the |
| 945 * indicated completion. |
| 946 */ |
| 947 Stream<CompletionResultsParams> onCompletionResults; |
| 948 |
| 949 /** |
| 950 * Stream controller for [onCompletionResults]. |
| 951 */ |
| 952 StreamController<CompletionResultsParams> _onCompletionResults; |
| 953 |
| 954 /** |
| 955 * Perform a search for references to the element defined or referenced at |
| 956 * the given offset in the given file. |
| 957 * |
| 958 * An identifier is returned immediately, and individual results will be |
| 959 * returned via the search.results notification as they become available. |
| 960 * |
| 961 * Parameters |
| 962 * |
| 963 * file ( FilePath ) |
| 964 * |
| 965 * The file containing the declaration of or reference to the element used |
| 966 * to define the search. |
| 967 * |
| 968 * offset ( int ) |
| 969 * |
| 970 * The offset within the file of the declaration of or reference to the |
| 971 * element. |
| 972 * |
| 973 * includePotential ( bool ) |
| 974 * |
| 975 * True if potential matches are to be included in the results. |
| 976 * |
| 977 * Returns |
| 978 * |
| 979 * id ( optional SearchId ) |
| 980 * |
| 981 * The identifier used to associate results with this search request. |
| 982 * |
| 983 * If no element was found at the given location, this field will be |
| 984 * absent, and no results will be reported via the search.results |
| 985 * notification. |
| 986 * |
| 987 * element ( optional Element ) |
| 988 * |
| 989 * The element referenced or defined at the given offset and whose |
| 990 * references will be returned in the search results. |
| 991 * |
| 992 * If no element was found at the given location, this field will be |
| 993 * absent. |
| 994 */ |
| 995 Future<SearchFindElementReferencesResult> sendSearchFindElementReferences(Stri
ng file, int offset, bool includePotential) { |
| 996 var params = new SearchFindElementReferencesParams(file, offset, includePote
ntial).toJson(); |
| 997 return server.send("search.findElementReferences", params) |
| 998 .then((result) { |
| 999 ResponseDecoder decoder = new ResponseDecoder(null); |
| 1000 return new SearchFindElementReferencesResult.fromJson(decoder, 'result', r
esult); |
| 1001 }); |
| 1002 } |
| 1003 |
| 1004 /** |
| 1005 * Perform a search for declarations of members whose name is equal to the |
| 1006 * given name. |
| 1007 * |
| 1008 * An identifier is returned immediately, and individual results will be |
| 1009 * returned via the search.results notification as they become available. |
| 1010 * |
| 1011 * Parameters |
| 1012 * |
| 1013 * name ( String ) |
| 1014 * |
| 1015 * The name of the declarations to be found. |
| 1016 * |
| 1017 * Returns |
| 1018 * |
| 1019 * id ( SearchId ) |
| 1020 * |
| 1021 * The identifier used to associate results with this search request. |
| 1022 */ |
| 1023 Future<SearchFindMemberDeclarationsResult> sendSearchFindMemberDeclarations(St
ring name) { |
| 1024 var params = new SearchFindMemberDeclarationsParams(name).toJson(); |
| 1025 return server.send("search.findMemberDeclarations", params) |
| 1026 .then((result) { |
| 1027 ResponseDecoder decoder = new ResponseDecoder(null); |
| 1028 return new SearchFindMemberDeclarationsResult.fromJson(decoder, 'result',
result); |
| 1029 }); |
| 1030 } |
| 1031 |
| 1032 /** |
| 1033 * Perform a search for references to members whose name is equal to the |
| 1034 * given name. This search does not check to see that there is a member |
| 1035 * defined with the given name, so it is able to find references to undefined |
| 1036 * members as well. |
| 1037 * |
| 1038 * An identifier is returned immediately, and individual results will be |
| 1039 * returned via the search.results notification as they become available. |
| 1040 * |
| 1041 * Parameters |
| 1042 * |
| 1043 * name ( String ) |
| 1044 * |
| 1045 * The name of the references to be found. |
| 1046 * |
| 1047 * Returns |
| 1048 * |
| 1049 * id ( SearchId ) |
| 1050 * |
| 1051 * The identifier used to associate results with this search request. |
| 1052 */ |
| 1053 Future<SearchFindMemberReferencesResult> sendSearchFindMemberReferences(String
name) { |
| 1054 var params = new SearchFindMemberReferencesParams(name).toJson(); |
| 1055 return server.send("search.findMemberReferences", params) |
| 1056 .then((result) { |
| 1057 ResponseDecoder decoder = new ResponseDecoder(null); |
| 1058 return new SearchFindMemberReferencesResult.fromJson(decoder, 'result', re
sult); |
| 1059 }); |
| 1060 } |
| 1061 |
| 1062 /** |
| 1063 * Perform a search for declarations of top-level elements (classes, |
| 1064 * typedefs, getters, setters, functions and fields) whose name matches the |
| 1065 * given pattern. |
| 1066 * |
| 1067 * An identifier is returned immediately, and individual results will be |
| 1068 * returned via the search.results notification as they become available. |
| 1069 * |
| 1070 * Parameters |
| 1071 * |
| 1072 * pattern ( String ) |
| 1073 * |
| 1074 * The regular expression used to match the names of the declarations to be |
| 1075 * found. |
| 1076 * |
| 1077 * Returns |
| 1078 * |
| 1079 * id ( SearchId ) |
| 1080 * |
| 1081 * The identifier used to associate results with this search request. |
| 1082 */ |
| 1083 Future<SearchFindTopLevelDeclarationsResult> sendSearchFindTopLevelDeclaration
s(String pattern) { |
| 1084 var params = new SearchFindTopLevelDeclarationsParams(pattern).toJson(); |
| 1085 return server.send("search.findTopLevelDeclarations", params) |
| 1086 .then((result) { |
| 1087 ResponseDecoder decoder = new ResponseDecoder(null); |
| 1088 return new SearchFindTopLevelDeclarationsResult.fromJson(decoder, 'result'
, result); |
| 1089 }); |
| 1090 } |
| 1091 |
| 1092 /** |
| 1093 * Return the type hierarchy of the class declared or referenced at the given |
| 1094 * location. |
| 1095 * |
| 1096 * Parameters |
| 1097 * |
| 1098 * file ( FilePath ) |
| 1099 * |
| 1100 * The file containing the declaration or reference to the type for which a |
| 1101 * hierarchy is being requested. |
| 1102 * |
| 1103 * offset ( int ) |
| 1104 * |
| 1105 * The offset of the name of the type within the file. |
| 1106 * |
| 1107 * superOnly ( optional bool ) |
| 1108 * |
| 1109 * True if the client is only requesting superclasses and interfaces |
| 1110 * hierarchy. |
| 1111 * |
| 1112 * Returns |
| 1113 * |
| 1114 * hierarchyItems ( optional List<TypeHierarchyItem> ) |
| 1115 * |
| 1116 * A list of the types in the requested hierarchy. The first element of the |
| 1117 * list is the item representing the type for which the hierarchy was |
| 1118 * requested. The index of other elements of the list is unspecified, but |
| 1119 * correspond to the integers used to reference supertype and subtype items |
| 1120 * within the items. |
| 1121 * |
| 1122 * This field will be absent if the code at the given file and offset does |
| 1123 * not represent a type, or if the file has not been sufficiently analyzed |
| 1124 * to allow a type hierarchy to be produced. |
| 1125 */ |
| 1126 Future<SearchGetTypeHierarchyResult> sendSearchGetTypeHierarchy(String file, i
nt offset, {bool superOnly}) { |
| 1127 var params = new SearchGetTypeHierarchyParams(file, offset, superOnly: super
Only).toJson(); |
| 1128 return server.send("search.getTypeHierarchy", params) |
| 1129 .then((result) { |
| 1130 ResponseDecoder decoder = new ResponseDecoder(null); |
| 1131 return new SearchGetTypeHierarchyResult.fromJson(decoder, 'result', result
); |
| 1132 }); |
| 1133 } |
| 1134 |
| 1135 /** |
| 1136 * Reports some or all of the results of performing a requested search. |
| 1137 * Unlike other notifications, this notification contains search results that |
| 1138 * should be added to any previously received search results associated with |
| 1139 * the same search id. |
| 1140 * |
| 1141 * Parameters |
| 1142 * |
| 1143 * id ( SearchId ) |
| 1144 * |
| 1145 * The id associated with the search. |
| 1146 * |
| 1147 * results ( List<SearchResult> ) |
| 1148 * |
| 1149 * The search results being reported. |
| 1150 * |
| 1151 * isLast ( bool ) |
| 1152 * |
| 1153 * True if this is that last set of results that will be returned for the |
| 1154 * indicated search. |
| 1155 */ |
| 1156 Stream<SearchResultsParams> onSearchResults; |
| 1157 |
| 1158 /** |
| 1159 * Stream controller for [onSearchResults]. |
| 1160 */ |
| 1161 StreamController<SearchResultsParams> _onSearchResults; |
1113 | 1162 |
1114 /** | 1163 /** |
1115 * Format the contents of a single file. The currently selected region of | 1164 * Format the contents of a single file. The currently selected region of |
1116 * text is passed in so that the selection can be preserved across the | 1165 * text is passed in so that the selection can be preserved across the |
1117 * formatting operation. The updated selection will be as close to matching | 1166 * formatting operation. The updated selection will be as close to matching |
1118 * the original as possible, but whitespace at the beginning or end of the | 1167 * the original as possible, but whitespace at the beginning or end of the |
1119 * selected region will be ignored. If preserving selection information is | 1168 * selected region will be ignored. If preserving selection information is |
1120 * not required, zero (0) can be specified for both the selection offset and | 1169 * not required, zero (0) can be specified for both the selection offset and |
1121 * selection length. | 1170 * selection length. |
1122 * | 1171 * |
(...skipping 29 matching lines...) Expand all Loading... |
1152 * empty if the code was already formatted (there are no changes). | 1201 * empty if the code was already formatted (there are no changes). |
1153 * | 1202 * |
1154 * selectionOffset ( int ) | 1203 * selectionOffset ( int ) |
1155 * | 1204 * |
1156 * The offset of the selection after formatting the code. | 1205 * The offset of the selection after formatting the code. |
1157 * | 1206 * |
1158 * selectionLength ( int ) | 1207 * selectionLength ( int ) |
1159 * | 1208 * |
1160 * The length of the selection after formatting the code. | 1209 * The length of the selection after formatting the code. |
1161 */ | 1210 */ |
1162 Future<EditFormatResult> sendEditFormat( | 1211 Future<EditFormatResult> sendEditFormat(String file, int selectionOffset, int
selectionLength, {int lineLength}) { |
1163 String file, int selectionOffset, int selectionLength, | 1212 var params = new EditFormatParams(file, selectionOffset, selectionLength, li
neLength: lineLength).toJson(); |
1164 {int lineLength}) { | 1213 return server.send("edit.format", params) |
1165 var params = new EditFormatParams(file, selectionOffset, selectionLength, | 1214 .then((result) { |
1166 lineLength: lineLength).toJson(); | |
1167 return server.send("edit.format", params).then((result) { | |
1168 ResponseDecoder decoder = new ResponseDecoder(null); | 1215 ResponseDecoder decoder = new ResponseDecoder(null); |
1169 return new EditFormatResult.fromJson(decoder, 'result', result); | 1216 return new EditFormatResult.fromJson(decoder, 'result', result); |
1170 }); | 1217 }); |
1171 } | 1218 } |
1172 | 1219 |
1173 /** | 1220 /** |
1174 * Return the set of assists that are available at the given location. An | 1221 * Return the set of assists that are available at the given location. An |
1175 * assist is distinguished from a refactoring primarily by the fact that it | 1222 * assist is distinguished from a refactoring primarily by the fact that it |
1176 * affects a single file and does not require user input in order to be | 1223 * affects a single file and does not require user input in order to be |
1177 * performed. | 1224 * performed. |
(...skipping 11 matching lines...) Expand all Loading... |
1189 * length ( int ) | 1236 * length ( int ) |
1190 * | 1237 * |
1191 * The length of the code for which assists are being requested. | 1238 * The length of the code for which assists are being requested. |
1192 * | 1239 * |
1193 * Returns | 1240 * Returns |
1194 * | 1241 * |
1195 * assists ( List<SourceChange> ) | 1242 * assists ( List<SourceChange> ) |
1196 * | 1243 * |
1197 * The assists that are available at the given location. | 1244 * The assists that are available at the given location. |
1198 */ | 1245 */ |
1199 Future<EditGetAssistsResult> sendEditGetAssists( | 1246 Future<EditGetAssistsResult> sendEditGetAssists(String file, int offset, int l
ength) { |
1200 String file, int offset, int length) { | |
1201 var params = new EditGetAssistsParams(file, offset, length).toJson(); | 1247 var params = new EditGetAssistsParams(file, offset, length).toJson(); |
1202 return server.send("edit.getAssists", params).then((result) { | 1248 return server.send("edit.getAssists", params) |
| 1249 .then((result) { |
1203 ResponseDecoder decoder = new ResponseDecoder(null); | 1250 ResponseDecoder decoder = new ResponseDecoder(null); |
1204 return new EditGetAssistsResult.fromJson(decoder, 'result', result); | 1251 return new EditGetAssistsResult.fromJson(decoder, 'result', result); |
1205 }); | 1252 }); |
1206 } | 1253 } |
1207 | 1254 |
1208 /** | 1255 /** |
1209 * Get a list of the kinds of refactorings that are valid for the given | 1256 * Get a list of the kinds of refactorings that are valid for the given |
1210 * selection in the given file. | 1257 * selection in the given file. |
1211 * | 1258 * |
1212 * Parameters | 1259 * Parameters |
1213 * | 1260 * |
1214 * file ( FilePath ) | 1261 * file ( FilePath ) |
1215 * | 1262 * |
1216 * The file containing the code on which the refactoring would be based. | 1263 * The file containing the code on which the refactoring would be based. |
1217 * | 1264 * |
1218 * offset ( int ) | 1265 * offset ( int ) |
1219 * | 1266 * |
1220 * The offset of the code on which the refactoring would be based. | 1267 * The offset of the code on which the refactoring would be based. |
1221 * | 1268 * |
1222 * length ( int ) | 1269 * length ( int ) |
1223 * | 1270 * |
1224 * The length of the code on which the refactoring would be based. | 1271 * The length of the code on which the refactoring would be based. |
1225 * | 1272 * |
1226 * Returns | 1273 * Returns |
1227 * | 1274 * |
1228 * kinds ( List<RefactoringKind> ) | 1275 * kinds ( List<RefactoringKind> ) |
1229 * | 1276 * |
1230 * The kinds of refactorings that are valid for the given selection. | 1277 * The kinds of refactorings that are valid for the given selection. |
1231 */ | 1278 */ |
1232 Future<EditGetAvailableRefactoringsResult> sendEditGetAvailableRefactorings( | 1279 Future<EditGetAvailableRefactoringsResult> sendEditGetAvailableRefactorings(St
ring file, int offset, int length) { |
1233 String file, int offset, int length) { | 1280 var params = new EditGetAvailableRefactoringsParams(file, offset, length).to
Json(); |
1234 var params = | 1281 return server.send("edit.getAvailableRefactorings", params) |
1235 new EditGetAvailableRefactoringsParams(file, offset, length).toJson(); | 1282 .then((result) { |
1236 return server.send("edit.getAvailableRefactorings", params).then((result) { | |
1237 ResponseDecoder decoder = new ResponseDecoder(null); | 1283 ResponseDecoder decoder = new ResponseDecoder(null); |
1238 return new EditGetAvailableRefactoringsResult.fromJson( | 1284 return new EditGetAvailableRefactoringsResult.fromJson(decoder, 'result',
result); |
1239 decoder, 'result', result); | |
1240 }); | 1285 }); |
1241 } | 1286 } |
1242 | 1287 |
1243 /** | 1288 /** |
1244 * Return the set of fixes that are available for the errors at a given | 1289 * Return the set of fixes that are available for the errors at a given |
1245 * offset in a given file. | 1290 * offset in a given file. |
1246 * | 1291 * |
1247 * Parameters | 1292 * Parameters |
1248 * | 1293 * |
1249 * file ( FilePath ) | 1294 * file ( FilePath ) |
1250 * | 1295 * |
1251 * The file containing the errors for which fixes are being requested. | 1296 * The file containing the errors for which fixes are being requested. |
1252 * | 1297 * |
1253 * offset ( int ) | 1298 * offset ( int ) |
1254 * | 1299 * |
1255 * The offset used to select the errors for which fixes will be returned. | 1300 * The offset used to select the errors for which fixes will be returned. |
1256 * | 1301 * |
1257 * Returns | 1302 * Returns |
1258 * | 1303 * |
1259 * fixes ( List<AnalysisErrorFixes> ) | 1304 * fixes ( List<AnalysisErrorFixes> ) |
1260 * | 1305 * |
1261 * The fixes that are available for the errors at the given offset. | 1306 * The fixes that are available for the errors at the given offset. |
1262 */ | 1307 */ |
1263 Future<EditGetFixesResult> sendEditGetFixes(String file, int offset) { | 1308 Future<EditGetFixesResult> sendEditGetFixes(String file, int offset) { |
1264 var params = new EditGetFixesParams(file, offset).toJson(); | 1309 var params = new EditGetFixesParams(file, offset).toJson(); |
1265 return server.send("edit.getFixes", params).then((result) { | 1310 return server.send("edit.getFixes", params) |
| 1311 .then((result) { |
1266 ResponseDecoder decoder = new ResponseDecoder(null); | 1312 ResponseDecoder decoder = new ResponseDecoder(null); |
1267 return new EditGetFixesResult.fromJson(decoder, 'result', result); | 1313 return new EditGetFixesResult.fromJson(decoder, 'result', result); |
1268 }); | 1314 }); |
1269 } | 1315 } |
1270 | 1316 |
1271 /** | 1317 /** |
1272 * Get the changes required to perform a refactoring. | 1318 * Get the changes required to perform a refactoring. |
1273 * | 1319 * |
1274 * If another refactoring request is received during the processing of this | 1320 * If another refactoring request is received during the processing of this |
1275 * one, an error of type REFACTORING_REQUEST_CANCELLED will be generated. | 1321 * one, an error of type REFACTORING_REQUEST_CANCELLED will be generated. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 * potentialEdits ( optional List<String> ) | 1388 * potentialEdits ( optional List<String> ) |
1343 * | 1389 * |
1344 * The ids of source edits that are not known to be valid. An edit is not | 1390 * The ids of source edits that are not known to be valid. An edit is not |
1345 * known to be valid if there was insufficient type information for the | 1391 * known to be valid if there was insufficient type information for the |
1346 * server to be able to determine whether or not the code needs to be | 1392 * server to be able to determine whether or not the code needs to be |
1347 * modified, such as when a member is being renamed and there is a | 1393 * modified, such as when a member is being renamed and there is a |
1348 * reference to a member from an unknown type. This field will be omitted | 1394 * reference to a member from an unknown type. This field will be omitted |
1349 * if the change field is omitted or if there are no potential edits for | 1395 * if the change field is omitted or if there are no potential edits for |
1350 * the refactoring. | 1396 * the refactoring. |
1351 */ | 1397 */ |
1352 Future<EditGetRefactoringResult> sendEditGetRefactoring(RefactoringKind kind, | 1398 Future<EditGetRefactoringResult> sendEditGetRefactoring(RefactoringKind kind,
String file, int offset, int length, bool validateOnly, {RefactoringOptions opti
ons}) { |
1353 String file, int offset, int length, bool validateOnly, | 1399 var params = new EditGetRefactoringParams(kind, file, offset, length, valida
teOnly, options: options).toJson(); |
1354 {RefactoringOptions options}) { | 1400 return server.send("edit.getRefactoring", params) |
1355 var params = new EditGetRefactoringParams( | 1401 .then((result) { |
1356 kind, file, offset, length, validateOnly, | |
1357 options: options).toJson(); | |
1358 return server.send("edit.getRefactoring", params).then((result) { | |
1359 ResponseDecoder decoder = new ResponseDecoder(kind); | 1402 ResponseDecoder decoder = new ResponseDecoder(kind); |
1360 return new EditGetRefactoringResult.fromJson(decoder, 'result', result); | 1403 return new EditGetRefactoringResult.fromJson(decoder, 'result', result); |
1361 }); | 1404 }); |
1362 } | 1405 } |
1363 | 1406 |
1364 /** | 1407 /** |
1365 * Organizes all of the directives - removes unused imports and sorts | |
1366 * directives of the given Dart file according to the Dart Style Guide. | |
1367 * | |
1368 * If a request is made for a file that does not exist, does not belong to an | |
1369 * analysis root or is not a Dart file, FILE_NOT_ANALYZED will be generated. | |
1370 * | |
1371 * If directives of the Dart file cannot be organized, for example because it | |
1372 * has scan or parse errors, or by other reasons, ORGANIZE_DIRECTIVES_ERROR | |
1373 * will be generated. The message will provide datails about the reason. | |
1374 * | |
1375 * Parameters | |
1376 * | |
1377 * file ( FilePath ) | |
1378 * | |
1379 * The Dart file to organize directives in. | |
1380 * | |
1381 * Returns | |
1382 * | |
1383 * edit ( SourceFileEdit ) | |
1384 * | |
1385 * The file edit that is to be applied to the given file to effect the | |
1386 * organizing. | |
1387 */ | |
1388 Future<EditOrganizeDirectivesResult> sendEditOrganizeDirectives(String file) { | |
1389 var params = new EditOrganizeDirectivesParams(file).toJson(); | |
1390 return server.send("edit.organizeDirectives", params).then((result) { | |
1391 ResponseDecoder decoder = new ResponseDecoder(null); | |
1392 return new EditOrganizeDirectivesResult.fromJson( | |
1393 decoder, 'result', result); | |
1394 }); | |
1395 } | |
1396 | |
1397 /** | |
1398 * Sort all of the directives, unit and class members of the given Dart file. | 1408 * Sort all of the directives, unit and class members of the given Dart file. |
1399 * | 1409 * |
1400 * If a request is made for a file that does not exist, does not belong to an | 1410 * If a request is made for a file that does not exist, does not belong to an |
1401 * analysis root or is not a Dart file, SORT_MEMBERS_INVALID_FILE will be | 1411 * analysis root or is not a Dart file, SORT_MEMBERS_INVALID_FILE will be |
1402 * generated. | 1412 * generated. |
1403 * | 1413 * |
1404 * If the Dart file has scan or parse errors, SORT_MEMBERS_PARSE_ERRORS will | 1414 * If the Dart file has scan or parse errors, SORT_MEMBERS_PARSE_ERRORS will |
1405 * be generated. | 1415 * be generated. |
1406 * | 1416 * |
1407 * Parameters | 1417 * Parameters |
1408 * | 1418 * |
1409 * file ( FilePath ) | 1419 * file ( FilePath ) |
1410 * | 1420 * |
1411 * The Dart file to sort. | 1421 * The Dart file to sort. |
1412 * | 1422 * |
1413 * Returns | 1423 * Returns |
1414 * | 1424 * |
1415 * edit ( SourceFileEdit ) | 1425 * edit ( SourceFileEdit ) |
1416 * | 1426 * |
1417 * The file edit that is to be applied to the given file to effect the | 1427 * The file edit that is to be applied to the given file to effect the |
1418 * sorting. | 1428 * sorting. |
1419 */ | 1429 */ |
1420 Future<EditSortMembersResult> sendEditSortMembers(String file) { | 1430 Future<EditSortMembersResult> sendEditSortMembers(String file) { |
1421 var params = new EditSortMembersParams(file).toJson(); | 1431 var params = new EditSortMembersParams(file).toJson(); |
1422 return server.send("edit.sortMembers", params).then((result) { | 1432 return server.send("edit.sortMembers", params) |
| 1433 .then((result) { |
1423 ResponseDecoder decoder = new ResponseDecoder(null); | 1434 ResponseDecoder decoder = new ResponseDecoder(null); |
1424 return new EditSortMembersResult.fromJson(decoder, 'result', result); | 1435 return new EditSortMembersResult.fromJson(decoder, 'result', result); |
1425 }); | 1436 }); |
1426 } | 1437 } |
1427 | 1438 |
1428 /** | 1439 /** |
| 1440 * Organizes all of the directives - removes unused imports and sorts |
| 1441 * directives of the given Dart file according to the Dart Style Guide. |
| 1442 * |
| 1443 * If a request is made for a file that does not exist, does not belong to an |
| 1444 * analysis root or is not a Dart file, FILE_NOT_ANALYZED will be generated. |
| 1445 * |
| 1446 * If directives of the Dart file cannot be organized, for example because it |
| 1447 * has scan or parse errors, or by other reasons, ORGANIZE_DIRECTIVES_ERROR |
| 1448 * will be generated. The message will provide datails about the reason. |
| 1449 * |
| 1450 * Parameters |
| 1451 * |
| 1452 * file ( FilePath ) |
| 1453 * |
| 1454 * The Dart file to organize directives in. |
| 1455 * |
| 1456 * Returns |
| 1457 * |
| 1458 * edit ( SourceFileEdit ) |
| 1459 * |
| 1460 * The file edit that is to be applied to the given file to effect the |
| 1461 * organizing. |
| 1462 */ |
| 1463 Future<EditOrganizeDirectivesResult> sendEditOrganizeDirectives(String file) { |
| 1464 var params = new EditOrganizeDirectivesParams(file).toJson(); |
| 1465 return server.send("edit.organizeDirectives", params) |
| 1466 .then((result) { |
| 1467 ResponseDecoder decoder = new ResponseDecoder(null); |
| 1468 return new EditOrganizeDirectivesResult.fromJson(decoder, 'result', result
); |
| 1469 }); |
| 1470 } |
| 1471 |
| 1472 /** |
1429 * Create an execution context for the executable file with the given path. | 1473 * Create an execution context for the executable file with the given path. |
1430 * The context that is created will persist until execution.deleteContext is | 1474 * The context that is created will persist until execution.deleteContext is |
1431 * used to delete it. Clients, therefore, are responsible for managing the | 1475 * used to delete it. Clients, therefore, are responsible for managing the |
1432 * lifetime of execution contexts. | 1476 * lifetime of execution contexts. |
1433 * | 1477 * |
1434 * Parameters | 1478 * Parameters |
1435 * | 1479 * |
1436 * contextRoot ( FilePath ) | 1480 * contextRoot ( FilePath ) |
1437 * | 1481 * |
1438 * The path of the Dart or HTML file that will be launched, or the path of | 1482 * The path of the Dart or HTML file that will be launched, or the path of |
1439 * the directory containing the file. | 1483 * the directory containing the file. |
1440 * | 1484 * |
1441 * Returns | 1485 * Returns |
1442 * | 1486 * |
1443 * id ( ExecutionContextId ) | 1487 * id ( ExecutionContextId ) |
1444 * | 1488 * |
1445 * The identifier used to refer to the execution context that was created. | 1489 * The identifier used to refer to the execution context that was created. |
1446 */ | 1490 */ |
1447 Future<ExecutionCreateContextResult> sendExecutionCreateContext( | 1491 Future<ExecutionCreateContextResult> sendExecutionCreateContext(String context
Root) { |
1448 String contextRoot) { | |
1449 var params = new ExecutionCreateContextParams(contextRoot).toJson(); | 1492 var params = new ExecutionCreateContextParams(contextRoot).toJson(); |
1450 return server.send("execution.createContext", params).then((result) { | 1493 return server.send("execution.createContext", params) |
| 1494 .then((result) { |
1451 ResponseDecoder decoder = new ResponseDecoder(null); | 1495 ResponseDecoder decoder = new ResponseDecoder(null); |
1452 return new ExecutionCreateContextResult.fromJson( | 1496 return new ExecutionCreateContextResult.fromJson(decoder, 'result', result
); |
1453 decoder, 'result', result); | |
1454 }); | 1497 }); |
1455 } | 1498 } |
1456 | 1499 |
1457 /** | 1500 /** |
1458 * Delete the execution context with the given identifier. The context id is | 1501 * Delete the execution context with the given identifier. The context id is |
1459 * no longer valid after this command. The server is allowed to re-use ids | 1502 * no longer valid after this command. The server is allowed to re-use ids |
1460 * when they are no longer valid. | 1503 * when they are no longer valid. |
1461 * | 1504 * |
1462 * Parameters | 1505 * Parameters |
1463 * | 1506 * |
1464 * id ( ExecutionContextId ) | 1507 * id ( ExecutionContextId ) |
1465 * | 1508 * |
1466 * The identifier of the execution context that is to be deleted. | 1509 * The identifier of the execution context that is to be deleted. |
1467 */ | 1510 */ |
1468 Future sendExecutionDeleteContext(String id) { | 1511 Future sendExecutionDeleteContext(String id) { |
1469 var params = new ExecutionDeleteContextParams(id).toJson(); | 1512 var params = new ExecutionDeleteContextParams(id).toJson(); |
1470 return server.send("execution.deleteContext", params).then((result) { | 1513 return server.send("execution.deleteContext", params) |
| 1514 .then((result) { |
1471 expect(result, isNull); | 1515 expect(result, isNull); |
1472 return null; | 1516 return null; |
1473 }); | 1517 }); |
1474 } | 1518 } |
1475 | 1519 |
1476 /** | 1520 /** |
1477 * Map a URI from the execution context to the file that it corresponds to, | 1521 * Map a URI from the execution context to the file that it corresponds to, |
1478 * or map a file to the URI that it corresponds to in the execution context. | 1522 * or map a file to the URI that it corresponds to in the execution context. |
1479 * | 1523 * |
1480 * Exactly one of the file and uri fields must be provided. If both fields | 1524 * Exactly one of the file and uri fields must be provided. If both fields |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 * file ( optional FilePath ) | 1558 * file ( optional FilePath ) |
1515 * | 1559 * |
1516 * The file to which the URI was mapped. This field is omitted if the uri | 1560 * The file to which the URI was mapped. This field is omitted if the uri |
1517 * field was not given in the request. | 1561 * field was not given in the request. |
1518 * | 1562 * |
1519 * uri ( optional String ) | 1563 * uri ( optional String ) |
1520 * | 1564 * |
1521 * The URI to which the file path was mapped. This field is omitted if the | 1565 * The URI to which the file path was mapped. This field is omitted if the |
1522 * file field was not given in the request. | 1566 * file field was not given in the request. |
1523 */ | 1567 */ |
1524 Future<ExecutionMapUriResult> sendExecutionMapUri(String id, | 1568 Future<ExecutionMapUriResult> sendExecutionMapUri(String id, {String file, Str
ing uri}) { |
1525 {String file, String uri}) { | |
1526 var params = new ExecutionMapUriParams(id, file: file, uri: uri).toJson(); | 1569 var params = new ExecutionMapUriParams(id, file: file, uri: uri).toJson(); |
1527 return server.send("execution.mapUri", params).then((result) { | 1570 return server.send("execution.mapUri", params) |
| 1571 .then((result) { |
1528 ResponseDecoder decoder = new ResponseDecoder(null); | 1572 ResponseDecoder decoder = new ResponseDecoder(null); |
1529 return new ExecutionMapUriResult.fromJson(decoder, 'result', result); | 1573 return new ExecutionMapUriResult.fromJson(decoder, 'result', result); |
1530 }); | 1574 }); |
1531 } | 1575 } |
1532 | 1576 |
1533 /** | |
1534 * Subscribe for services. All previous subscriptions are replaced by the | |
1535 * given set of services. | |
1536 * | |
1537 * It is an error if any of the elements in the list are not valid services. | |
1538 * If there is an error, then the current subscriptions will remain | |
1539 * unchanged. | |
1540 * | |
1541 * Parameters | |
1542 * | |
1543 * subscriptions ( List<ExecutionService> ) | |
1544 * | |
1545 * A list of the services being subscribed to. | |
1546 */ | |
1547 Future sendExecutionSetSubscriptions(List<ExecutionService> subscriptions) { | |
1548 var params = new ExecutionSetSubscriptionsParams(subscriptions).toJson(); | |
1549 return server.send("execution.setSubscriptions", params).then((result) { | |
1550 expect(result, isNull); | |
1551 return null; | |
1552 }); | |
1553 } | |
1554 | |
1555 /** | |
1556 * Perform a search for references to the element defined or referenced at | |
1557 * the given offset in the given file. | |
1558 * | |
1559 * An identifier is returned immediately, and individual results will be | |
1560 * returned via the search.results notification as they become available. | |
1561 * | |
1562 * Parameters | |
1563 * | |
1564 * file ( FilePath ) | |
1565 * | |
1566 * The file containing the declaration of or reference to the element used | |
1567 * to define the search. | |
1568 * | |
1569 * offset ( int ) | |
1570 * | |
1571 * The offset within the file of the declaration of or reference to the | |
1572 * element. | |
1573 * | |
1574 * includePotential ( bool ) | |
1575 * | |
1576 * True if potential matches are to be included in the results. | |
1577 * | |
1578 * Returns | |
1579 * | |
1580 * id ( optional SearchId ) | |
1581 * | |
1582 * The identifier used to associate results with this search request. | |
1583 * | |
1584 * If no element was found at the given location, this field will be | |
1585 * absent, and no results will be reported via the search.results | |
1586 * notification. | |
1587 * | |
1588 * element ( optional Element ) | |
1589 * | |
1590 * The element referenced or defined at the given offset and whose | |
1591 * references will be returned in the search results. | |
1592 * | |
1593 * If no element was found at the given location, this field will be | |
1594 * absent. | |
1595 */ | |
1596 Future<SearchFindElementReferencesResult> sendSearchFindElementReferences( | |
1597 String file, int offset, bool includePotential) { | |
1598 var params = new SearchFindElementReferencesParams( | |
1599 file, offset, includePotential).toJson(); | |
1600 return server.send("search.findElementReferences", params).then((result) { | |
1601 ResponseDecoder decoder = new ResponseDecoder(null); | |
1602 return new SearchFindElementReferencesResult.fromJson( | |
1603 decoder, 'result', result); | |
1604 }); | |
1605 } | |
1606 | |
1607 /** | |
1608 * Perform a search for declarations of members whose name is equal to the | |
1609 * given name. | |
1610 * | |
1611 * An identifier is returned immediately, and individual results will be | |
1612 * returned via the search.results notification as they become available. | |
1613 * | |
1614 * Parameters | |
1615 * | |
1616 * name ( String ) | |
1617 * | |
1618 * The name of the declarations to be found. | |
1619 * | |
1620 * Returns | |
1621 * | |
1622 * id ( SearchId ) | |
1623 * | |
1624 * The identifier used to associate results with this search request. | |
1625 */ | |
1626 Future<SearchFindMemberDeclarationsResult> sendSearchFindMemberDeclarations( | |
1627 String name) { | |
1628 var params = new SearchFindMemberDeclarationsParams(name).toJson(); | |
1629 return server.send("search.findMemberDeclarations", params).then((result) { | |
1630 ResponseDecoder decoder = new ResponseDecoder(null); | |
1631 return new SearchFindMemberDeclarationsResult.fromJson( | |
1632 decoder, 'result', result); | |
1633 }); | |
1634 } | |
1635 | |
1636 /** | |
1637 * Perform a search for references to members whose name is equal to the | |
1638 * given name. This search does not check to see that there is a member | |
1639 * defined with the given name, so it is able to find references to undefined | |
1640 * members as well. | |
1641 * | |
1642 * An identifier is returned immediately, and individual results will be | |
1643 * returned via the search.results notification as they become available. | |
1644 * | |
1645 * Parameters | |
1646 * | |
1647 * name ( String ) | |
1648 * | |
1649 * The name of the references to be found. | |
1650 * | |
1651 * Returns | |
1652 * | |
1653 * id ( SearchId ) | |
1654 * | |
1655 * The identifier used to associate results with this search request. | |
1656 */ | |
1657 Future<SearchFindMemberReferencesResult> sendSearchFindMemberReferences( | |
1658 String name) { | |
1659 var params = new SearchFindMemberReferencesParams(name).toJson(); | |
1660 return server.send("search.findMemberReferences", params).then((result) { | |
1661 ResponseDecoder decoder = new ResponseDecoder(null); | |
1662 return new SearchFindMemberReferencesResult.fromJson( | |
1663 decoder, 'result', result); | |
1664 }); | |
1665 } | |
1666 | |
1667 /** | |
1668 * Perform a search for declarations of top-level elements (classes, | |
1669 * typedefs, getters, setters, functions and fields) whose name matches the | |
1670 * given pattern. | |
1671 * | |
1672 * An identifier is returned immediately, and individual results will be | |
1673 * returned via the search.results notification as they become available. | |
1674 * | |
1675 * Parameters | |
1676 * | |
1677 * pattern ( String ) | |
1678 * | |
1679 * The regular expression used to match the names of the declarations to be | |
1680 * found. | |
1681 * | |
1682 * Returns | |
1683 * | |
1684 * id ( SearchId ) | |
1685 * | |
1686 * The identifier used to associate results with this search request. | |
1687 */ | |
1688 Future< | |
1689 SearchFindTopLevelDeclarationsResult> sendSearchFindTopLevelDeclarations( | |
1690 String pattern) { | |
1691 var params = new SearchFindTopLevelDeclarationsParams(pattern).toJson(); | |
1692 return server | |
1693 .send("search.findTopLevelDeclarations", params) | |
1694 .then((result) { | |
1695 ResponseDecoder decoder = new ResponseDecoder(null); | |
1696 return new SearchFindTopLevelDeclarationsResult.fromJson( | |
1697 decoder, 'result', result); | |
1698 }); | |
1699 } | |
1700 | |
1701 /** | |
1702 * Return the type hierarchy of the class declared or referenced at the given | |
1703 * location. | |
1704 * | |
1705 * Parameters | |
1706 * | |
1707 * file ( FilePath ) | |
1708 * | |
1709 * The file containing the declaration or reference to the type for which a | |
1710 * hierarchy is being requested. | |
1711 * | |
1712 * offset ( int ) | |
1713 * | |
1714 * The offset of the name of the type within the file. | |
1715 * | |
1716 * superOnly ( optional bool ) | |
1717 * | |
1718 * True if the client is only requesting superclasses and interfaces | |
1719 * hierarchy. | |
1720 * | |
1721 * Returns | |
1722 * | |
1723 * hierarchyItems ( optional List<TypeHierarchyItem> ) | |
1724 * | |
1725 * A list of the types in the requested hierarchy. The first element of the | |
1726 * list is the item representing the type for which the hierarchy was | |
1727 * requested. The index of other elements of the list is unspecified, but | |
1728 * correspond to the integers used to reference supertype and subtype items | |
1729 * within the items. | |
1730 * | |
1731 * This field will be absent if the code at the given file and offset does | |
1732 * not represent a type, or if the file has not been sufficiently analyzed | |
1733 * to allow a type hierarchy to be produced. | |
1734 */ | |
1735 Future<SearchGetTypeHierarchyResult> sendSearchGetTypeHierarchy( | |
1736 String file, int offset, | |
1737 {bool superOnly}) { | |
1738 var params = new SearchGetTypeHierarchyParams(file, offset, | |
1739 superOnly: superOnly).toJson(); | |
1740 return server.send("search.getTypeHierarchy", params).then((result) { | |
1741 ResponseDecoder decoder = new ResponseDecoder(null); | |
1742 return new SearchGetTypeHierarchyResult.fromJson( | |
1743 decoder, 'result', result); | |
1744 }); | |
1745 } | |
1746 | |
1747 /** | |
1748 * Return the version number of the analysis server. | |
1749 * | |
1750 * Returns | |
1751 * | |
1752 * version ( String ) | |
1753 * | |
1754 * The version number of the analysis server. | |
1755 */ | |
1756 Future<ServerGetVersionResult> sendServerGetVersion() { | |
1757 return server.send("server.getVersion", null).then((result) { | |
1758 ResponseDecoder decoder = new ResponseDecoder(null); | |
1759 return new ServerGetVersionResult.fromJson(decoder, 'result', result); | |
1760 }); | |
1761 } | |
1762 | |
1763 /** | 1577 /** |
1764 * Subscribe for services. All previous subscriptions are replaced by the | 1578 * Subscribe for services. All previous subscriptions are replaced by the |
1765 * given set of services. | 1579 * given set of services. |
1766 * | 1580 * |
1767 * It is an error if any of the elements in the list are not valid services. | 1581 * It is an error if any of the elements in the list are not valid services. |
1768 * If there is an error, then the current subscriptions will remain | 1582 * If there is an error, then the current subscriptions will remain |
1769 * unchanged. | 1583 * unchanged. |
1770 * | 1584 * |
1771 * Parameters | 1585 * Parameters |
1772 * | 1586 * |
1773 * subscriptions ( List<ServerService> ) | 1587 * subscriptions ( List<ExecutionService> ) |
1774 * | 1588 * |
1775 * A list of the services being subscribed to. | 1589 * A list of the services being subscribed to. |
1776 */ | 1590 */ |
1777 Future sendServerSetSubscriptions(List<ServerService> subscriptions) { | 1591 Future sendExecutionSetSubscriptions(List<ExecutionService> subscriptions) { |
1778 var params = new ServerSetSubscriptionsParams(subscriptions).toJson(); | 1592 var params = new ExecutionSetSubscriptionsParams(subscriptions).toJson(); |
1779 return server.send("server.setSubscriptions", params).then((result) { | 1593 return server.send("execution.setSubscriptions", params) |
| 1594 .then((result) { |
1780 expect(result, isNull); | 1595 expect(result, isNull); |
1781 return null; | 1596 return null; |
1782 }); | 1597 }); |
1783 } | 1598 } |
1784 | 1599 |
1785 /** | 1600 /** |
1786 * Cleanly shutdown the analysis server. Requests that are received after | 1601 * Reports information needed to allow a single file to be launched. |
1787 * this request will not be processed. Requests that were received before | 1602 * |
1788 * this request, but for which a response has not yet been sent, will not be | 1603 * This notification is not subscribed to by default. Clients can subscribe |
1789 * responded to. No further responses or notifications will be sent after the | 1604 * by including the value "LAUNCH_DATA" in the list of services passed in an |
1790 * response to this request has been sent. | 1605 * execution.setSubscriptions request. |
| 1606 * |
| 1607 * Parameters |
| 1608 * |
| 1609 * file ( FilePath ) |
| 1610 * |
| 1611 * The file for which launch data is being provided. This will either be a |
| 1612 * Dart library or an HTML file. |
| 1613 * |
| 1614 * kind ( optional ExecutableKind ) |
| 1615 * |
| 1616 * The kind of the executable file. This field is omitted if the file is |
| 1617 * not a Dart file. |
| 1618 * |
| 1619 * referencedFiles ( optional List<FilePath> ) |
| 1620 * |
| 1621 * A list of the Dart files that are referenced by the file. This field is |
| 1622 * omitted if the file is not an HTML file. |
1791 */ | 1623 */ |
1792 Future sendServerShutdown() { | 1624 Stream<ExecutionLaunchDataParams> onExecutionLaunchData; |
1793 return server.send("server.shutdown", null).then((result) { | 1625 |
1794 expect(result, isNull); | 1626 /** |
1795 return null; | 1627 * Stream controller for [onExecutionLaunchData]. |
1796 }); | 1628 */ |
| 1629 StreamController<ExecutionLaunchDataParams> _onExecutionLaunchData; |
| 1630 |
| 1631 /** |
| 1632 * Initialize the fields in InttestMixin, and ensure that notifications will |
| 1633 * be handled. |
| 1634 */ |
| 1635 void initializeInttestMixin() { |
| 1636 _onServerConnected = new StreamController<ServerConnectedParams>(sync: true)
; |
| 1637 onServerConnected = _onServerConnected.stream.asBroadcastStream(); |
| 1638 _onServerError = new StreamController<ServerErrorParams>(sync: true); |
| 1639 onServerError = _onServerError.stream.asBroadcastStream(); |
| 1640 _onServerStatus = new StreamController<ServerStatusParams>(sync: true); |
| 1641 onServerStatus = _onServerStatus.stream.asBroadcastStream(); |
| 1642 _onAnalysisAnalyzedFiles = new StreamController<AnalysisAnalyzedFilesParams>
(sync: true); |
| 1643 onAnalysisAnalyzedFiles = _onAnalysisAnalyzedFiles.stream.asBroadcastStream(
); |
| 1644 _onAnalysisErrors = new StreamController<AnalysisErrorsParams>(sync: true); |
| 1645 onAnalysisErrors = _onAnalysisErrors.stream.asBroadcastStream(); |
| 1646 _onAnalysisFlushResults = new StreamController<AnalysisFlushResultsParams>(s
ync: true); |
| 1647 onAnalysisFlushResults = _onAnalysisFlushResults.stream.asBroadcastStream(); |
| 1648 _onAnalysisFolding = new StreamController<AnalysisFoldingParams>(sync: true)
; |
| 1649 onAnalysisFolding = _onAnalysisFolding.stream.asBroadcastStream(); |
| 1650 _onAnalysisHighlights = new StreamController<AnalysisHighlightsParams>(sync:
true); |
| 1651 onAnalysisHighlights = _onAnalysisHighlights.stream.asBroadcastStream(); |
| 1652 _onAnalysisImplemented = new StreamController<AnalysisImplementedParams>(syn
c: true); |
| 1653 onAnalysisImplemented = _onAnalysisImplemented.stream.asBroadcastStream(); |
| 1654 _onAnalysisInvalidate = new StreamController<AnalysisInvalidateParams>(sync:
true); |
| 1655 onAnalysisInvalidate = _onAnalysisInvalidate.stream.asBroadcastStream(); |
| 1656 _onAnalysisNavigation = new StreamController<AnalysisNavigationParams>(sync:
true); |
| 1657 onAnalysisNavigation = _onAnalysisNavigation.stream.asBroadcastStream(); |
| 1658 _onAnalysisOccurrences = new StreamController<AnalysisOccurrencesParams>(syn
c: true); |
| 1659 onAnalysisOccurrences = _onAnalysisOccurrences.stream.asBroadcastStream(); |
| 1660 _onAnalysisOutline = new StreamController<AnalysisOutlineParams>(sync: true)
; |
| 1661 onAnalysisOutline = _onAnalysisOutline.stream.asBroadcastStream(); |
| 1662 _onAnalysisOverrides = new StreamController<AnalysisOverridesParams>(sync: t
rue); |
| 1663 onAnalysisOverrides = _onAnalysisOverrides.stream.asBroadcastStream(); |
| 1664 _onCompletionResults = new StreamController<CompletionResultsParams>(sync: t
rue); |
| 1665 onCompletionResults = _onCompletionResults.stream.asBroadcastStream(); |
| 1666 _onSearchResults = new StreamController<SearchResultsParams>(sync: true); |
| 1667 onSearchResults = _onSearchResults.stream.asBroadcastStream(); |
| 1668 _onExecutionLaunchData = new StreamController<ExecutionLaunchDataParams>(syn
c: true); |
| 1669 onExecutionLaunchData = _onExecutionLaunchData.stream.asBroadcastStream(); |
| 1670 } |
| 1671 |
| 1672 /** |
| 1673 * Dispatch the notification named [event], and containing parameters |
| 1674 * [params], to the appropriate stream. |
| 1675 */ |
| 1676 void dispatchNotification(String event, params) { |
| 1677 ResponseDecoder decoder = new ResponseDecoder(null); |
| 1678 switch (event) { |
| 1679 case "server.connected": |
| 1680 expect(params, isServerConnectedParams); |
| 1681 _onServerConnected.add(new ServerConnectedParams.fromJson(decoder, 'para
ms', params)); |
| 1682 break; |
| 1683 case "server.error": |
| 1684 expect(params, isServerErrorParams); |
| 1685 _onServerError.add(new ServerErrorParams.fromJson(decoder, 'params', par
ams)); |
| 1686 break; |
| 1687 case "server.status": |
| 1688 expect(params, isServerStatusParams); |
| 1689 _onServerStatus.add(new ServerStatusParams.fromJson(decoder, 'params', p
arams)); |
| 1690 break; |
| 1691 case "analysis.analyzedFiles": |
| 1692 expect(params, isAnalysisAnalyzedFilesParams); |
| 1693 _onAnalysisAnalyzedFiles.add(new AnalysisAnalyzedFilesParams.fromJson(de
coder, 'params', params)); |
| 1694 break; |
| 1695 case "analysis.errors": |
| 1696 expect(params, isAnalysisErrorsParams); |
| 1697 _onAnalysisErrors.add(new AnalysisErrorsParams.fromJson(decoder, 'params
', params)); |
| 1698 break; |
| 1699 case "analysis.flushResults": |
| 1700 expect(params, isAnalysisFlushResultsParams); |
| 1701 _onAnalysisFlushResults.add(new AnalysisFlushResultsParams.fromJson(deco
der, 'params', params)); |
| 1702 break; |
| 1703 case "analysis.folding": |
| 1704 expect(params, isAnalysisFoldingParams); |
| 1705 _onAnalysisFolding.add(new AnalysisFoldingParams.fromJson(decoder, 'para
ms', params)); |
| 1706 break; |
| 1707 case "analysis.highlights": |
| 1708 expect(params, isAnalysisHighlightsParams); |
| 1709 _onAnalysisHighlights.add(new AnalysisHighlightsParams.fromJson(decoder,
'params', params)); |
| 1710 break; |
| 1711 case "analysis.implemented": |
| 1712 expect(params, isAnalysisImplementedParams); |
| 1713 _onAnalysisImplemented.add(new AnalysisImplementedParams.fromJson(decode
r, 'params', params)); |
| 1714 break; |
| 1715 case "analysis.invalidate": |
| 1716 expect(params, isAnalysisInvalidateParams); |
| 1717 _onAnalysisInvalidate.add(new AnalysisInvalidateParams.fromJson(decoder,
'params', params)); |
| 1718 break; |
| 1719 case "analysis.navigation": |
| 1720 expect(params, isAnalysisNavigationParams); |
| 1721 _onAnalysisNavigation.add(new AnalysisNavigationParams.fromJson(decoder,
'params', params)); |
| 1722 break; |
| 1723 case "analysis.occurrences": |
| 1724 expect(params, isAnalysisOccurrencesParams); |
| 1725 _onAnalysisOccurrences.add(new AnalysisOccurrencesParams.fromJson(decode
r, 'params', params)); |
| 1726 break; |
| 1727 case "analysis.outline": |
| 1728 expect(params, isAnalysisOutlineParams); |
| 1729 _onAnalysisOutline.add(new AnalysisOutlineParams.fromJson(decoder, 'para
ms', params)); |
| 1730 break; |
| 1731 case "analysis.overrides": |
| 1732 expect(params, isAnalysisOverridesParams); |
| 1733 _onAnalysisOverrides.add(new AnalysisOverridesParams.fromJson(decoder, '
params', params)); |
| 1734 break; |
| 1735 case "completion.results": |
| 1736 expect(params, isCompletionResultsParams); |
| 1737 _onCompletionResults.add(new CompletionResultsParams.fromJson(decoder, '
params', params)); |
| 1738 break; |
| 1739 case "search.results": |
| 1740 expect(params, isSearchResultsParams); |
| 1741 _onSearchResults.add(new SearchResultsParams.fromJson(decoder, 'params',
params)); |
| 1742 break; |
| 1743 case "execution.launchData": |
| 1744 expect(params, isExecutionLaunchDataParams); |
| 1745 _onExecutionLaunchData.add(new ExecutionLaunchDataParams.fromJson(decode
r, 'params', params)); |
| 1746 break; |
| 1747 default: |
| 1748 fail('Unexpected notification: $event'); |
| 1749 break; |
| 1750 } |
1797 } | 1751 } |
1798 } | 1752 } |
OLD | NEW |