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

Side by Side Diff: pkg/analysis_server/test/integration/protocol_matchers.dart

Issue 439313003: Add more matchers for use in analysis server integration testing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /**
6 * Matchers for data types defined in the analysis server API
7 */
8 library test.integration.protocol.matchers;
9
10 import 'package:unittest/unittest.dart';
11
12 import 'integration_tests.dart';
13
14 /**
15 * server.getVersion params
16 */
17 final Matcher isServerGetVersionParams = isNull;
18
19 /**
20 * server.getVersion result
21 *
22 * {
23 * "version": String
24 * }
25 */
26 final Matcher isServerGetVersionResult = new MatchesJsonObject(
27 "server.getVersion result", {
28 "version": isString
29 });
30
31 /**
32 * server.shutdown params
33 */
34 final Matcher isServerShutdownParams = isNull;
35
36 /**
37 * server.shutdown result
38 */
39 final Matcher isServerShutdownResult = isNull;
40
41 /**
42 * server.setSubscriptions params
43 *
44 * {
45 * "subscriptions": List<ServerService>
46 * }
47 */
48 final Matcher isServerSetSubscriptionsParams = new MatchesJsonObject(
49 "server.setSubscriptions params", {
50 "subscriptions": isListOf(isServerService)
51 });
52
53 /**
54 * server.setSubscriptions result
55 */
56 final Matcher isServerSetSubscriptionsResult = isNull;
57
58 /**
59 * server.connected params
60 */
61 final Matcher isServerConnectedParams = isNull;
62
63 /**
64 * server.error params
65 *
66 * {
67 * "fatal": bool
68 * "message": String
69 * "stackTrace": String
70 * }
71 */
72 final Matcher isServerErrorParams = new MatchesJsonObject(
73 "server.error params", {
74 "fatal": isBool,
75 "message": isString,
76 "stackTrace": isString
77 });
78
79 /**
80 * server.status params
81 *
82 * {
83 * "analysis": optional AnalysisStatus
84 * }
85 */
86 final Matcher isServerStatusParams = new MatchesJsonObject(
87 "server.status params", null, optionalFields: {
88 "analysis": isAnalysisStatus
89 });
90
91 /**
92 * analysis.getErrors params
93 *
94 * {
95 * "file": FilePath
96 * }
97 */
98 final Matcher isAnalysisGetErrorsParams = new MatchesJsonObject(
99 "analysis.getErrors params", {
100 "file": isFilePath
101 });
102
103 /**
104 * analysis.getErrors result
105 *
106 * {
107 * "errors": List<AnalysisError>
108 * }
109 */
110 final Matcher isAnalysisGetErrorsResult = new MatchesJsonObject(
111 "analysis.getErrors result", {
112 "errors": isListOf(isAnalysisError)
113 });
114
115 /**
116 * analysis.getHover params
117 *
118 * {
119 * "file": FilePath
120 * "offset": int
121 * }
122 */
123 final Matcher isAnalysisGetHoverParams = new MatchesJsonObject(
124 "analysis.getHover params", {
125 "file": isFilePath,
126 "offset": isInt
127 });
128
129 /**
130 * analysis.getHover result
131 *
132 * {
133 * "hovers": List<HoverInformation>
134 * }
135 */
136 final Matcher isAnalysisGetHoverResult = new MatchesJsonObject(
137 "analysis.getHover result", {
138 "hovers": isListOf(isHoverInformation)
139 });
140
141 /**
142 * analysis.reanalyze params
143 */
144 final Matcher isAnalysisReanalyzeParams = isNull;
145
146 /**
147 * analysis.reanalyze result
148 */
149 final Matcher isAnalysisReanalyzeResult = isNull;
150
151 /**
152 * analysis.setAnalysisRoots params
153 *
154 * {
155 * "included": List<FilePath>
156 * "excluded": List<FilePath>
157 * }
158 */
159 final Matcher isAnalysisSetAnalysisRootsParams = new MatchesJsonObject(
160 "analysis.setAnalysisRoots params", {
161 "included": isListOf(isFilePath),
162 "excluded": isListOf(isFilePath)
163 });
164
165 /**
166 * analysis.setAnalysisRoots result
167 */
168 final Matcher isAnalysisSetAnalysisRootsResult = isNull;
169
170 /**
171 * analysis.setPriorityFiles params
172 *
173 * {
174 * "files": List<FilePath>
175 * }
176 */
177 final Matcher isAnalysisSetPriorityFilesParams = new MatchesJsonObject(
178 "analysis.setPriorityFiles params", {
179 "files": isListOf(isFilePath)
180 });
181
182 /**
183 * analysis.setPriorityFiles result
184 */
185 final Matcher isAnalysisSetPriorityFilesResult = isNull;
186
187 /**
188 * analysis.setSubscriptions params
189 *
190 * {
191 * "subscriptions": Map<AnalysisService, List<FilePath>>
192 * }
193 */
194 final Matcher isAnalysisSetSubscriptionsParams = new MatchesJsonObject(
195 "analysis.setSubscriptions params", {
196 "subscriptions": isMapOf(isAnalysisService, isListOf(isFilePath))
197 });
198
199 /**
200 * analysis.setSubscriptions result
201 */
202 final Matcher isAnalysisSetSubscriptionsResult = isNull;
203
204 /**
205 * analysis.updateContent params
206 *
207 * {
208 * "files": Map<FilePath, ContentChange>
209 * }
210 */
211 final Matcher isAnalysisUpdateContentParams = new MatchesJsonObject(
212 "analysis.updateContent params", {
213 "files": isMapOf(isFilePath, isContentChange)
214 });
215
216 /**
217 * analysis.updateContent result
218 */
219 final Matcher isAnalysisUpdateContentResult = isNull;
220
221 /**
222 * analysis.updateOptions params
223 *
224 * {
225 * "options": AnalysisOptions
226 * }
227 */
228 final Matcher isAnalysisUpdateOptionsParams = new MatchesJsonObject(
229 "analysis.updateOptions params", {
230 "options": isAnalysisOptions
231 });
232
233 /**
234 * analysis.updateOptions result
235 */
236 final Matcher isAnalysisUpdateOptionsResult = isNull;
237
238 /**
239 * analysis.updateSdks params
240 *
241 * {
242 * "added": List<FilePath>
243 * "removed": List<FilePath>
244 * "default": optional FilePath
245 * }
246 */
247 final Matcher isAnalysisUpdateSdksParams = new MatchesJsonObject(
248 "analysis.updateSdks params", {
249 "added": isListOf(isFilePath),
250 "removed": isListOf(isFilePath)
251 }, optionalFields: {
252 "default": isFilePath
253 });
254
255 /**
256 * analysis.updateSdks result
257 */
258 final Matcher isAnalysisUpdateSdksResult = isNull;
259
260 /**
261 * analysis.errors params
262 *
263 * {
264 * "file": FilePath
265 * "errors": List<AnalysisError>
266 * }
267 */
268 final Matcher isAnalysisErrorsParams = new MatchesJsonObject(
269 "analysis.errors params", {
270 "file": isFilePath,
271 "errors": isListOf(isAnalysisError)
272 });
273
274 /**
275 * analysis.folding params
276 *
277 * {
278 * "file": FilePath
279 * "regions": List<FoldingRegion>
280 * }
281 */
282 final Matcher isAnalysisFoldingParams = new MatchesJsonObject(
283 "analysis.folding params", {
284 "file": isFilePath,
285 "regions": isListOf(isFoldingRegion)
286 });
287
288 /**
289 * analysis.highlights params
290 *
291 * {
292 * "file": FilePath
293 * "regions": List<HighlightRegion>
294 * }
295 */
296 final Matcher isAnalysisHighlightsParams = new MatchesJsonObject(
297 "analysis.highlights params", {
298 "file": isFilePath,
299 "regions": isListOf(isHighlightRegion)
300 });
301
302 /**
303 * analysis.navigation params
304 *
305 * {
306 * "file": FilePath
307 * "regions": List<NavigationRegion>
308 * }
309 */
310 final Matcher isAnalysisNavigationParams = new MatchesJsonObject(
311 "analysis.navigation params", {
312 "file": isFilePath,
313 "regions": isListOf(isNavigationRegion)
314 });
315
316 /**
317 * analysis.occurrences params
318 *
319 * {
320 * "file": FilePath
321 * "occurrences": List<Occurrences>
322 * }
323 */
324 final Matcher isAnalysisOccurrencesParams = new MatchesJsonObject(
325 "analysis.occurrences params", {
326 "file": isFilePath,
327 "occurrences": isListOf(isOccurrences)
328 });
329
330 /**
331 * analysis.outline params
332 *
333 * {
334 * "file": FilePath
335 * "outline": Outline
336 * }
337 */
338 final Matcher isAnalysisOutlineParams = new MatchesJsonObject(
339 "analysis.outline params", {
340 "file": isFilePath,
341 "outline": isOutline
342 });
343
344 /**
345 * analysis.overrides params
346 *
347 * {
348 * "file": FilePath
349 * "overrides": List<Override>
350 * }
351 */
352 final Matcher isAnalysisOverridesParams = new MatchesJsonObject(
353 "analysis.overrides params", {
354 "file": isFilePath,
355 "overrides": isListOf(isOverride)
356 });
357
358 /**
359 * completion.getSuggestions params
360 *
361 * {
362 * "file": FilePath
363 * "offset": int
364 * }
365 */
366 final Matcher isCompletionGetSuggestionsParams = new MatchesJsonObject(
367 "completion.getSuggestions params", {
368 "file": isFilePath,
369 "offset": isInt
370 });
371
372 /**
373 * completion.getSuggestions result
374 *
375 * {
376 * "id": CompletionId
377 * }
378 */
379 final Matcher isCompletionGetSuggestionsResult = new MatchesJsonObject(
380 "completion.getSuggestions result", {
381 "id": isCompletionId
382 });
383
384 /**
385 * completion.results params
386 *
387 * {
388 * "id": CompletionId
389 * "replacementOffset": int
390 * "replacementLength": int
391 * "results": List<CompletionSuggestion>
392 * "last": bool
393 * }
394 */
395 final Matcher isCompletionResultsParams = new MatchesJsonObject(
396 "completion.results params", {
397 "id": isCompletionId,
398 "replacementOffset": isInt,
399 "replacementLength": isInt,
400 "results": isListOf(isCompletionSuggestion),
401 "last": isBool
402 });
403
404 /**
405 * search.findElementReferences params
406 *
407 * {
408 * "file": FilePath
409 * "offset": int
410 * "includePotential": bool
411 * }
412 */
413 final Matcher isSearchFindElementReferencesParams = new MatchesJsonObject(
414 "search.findElementReferences params", {
415 "file": isFilePath,
416 "offset": isInt,
417 "includePotential": isBool
418 });
419
420 /**
421 * search.findElementReferences result
422 *
423 * {
424 * "id": SearchId
425 * "element": Element
426 * }
427 */
428 final Matcher isSearchFindElementReferencesResult = new MatchesJsonObject(
429 "search.findElementReferences result", {
430 "id": isSearchId,
431 "element": isElement
432 });
433
434 /**
435 * search.findMemberDeclarations params
436 *
437 * {
438 * "name": String
439 * }
440 */
441 final Matcher isSearchFindMemberDeclarationsParams = new MatchesJsonObject(
442 "search.findMemberDeclarations params", {
443 "name": isString
444 });
445
446 /**
447 * search.findMemberDeclarations result
448 *
449 * {
450 * "id": SearchId
451 * }
452 */
453 final Matcher isSearchFindMemberDeclarationsResult = new MatchesJsonObject(
454 "search.findMemberDeclarations result", {
455 "id": isSearchId
456 });
457
458 /**
459 * search.findMemberReferences params
460 *
461 * {
462 * "name": String
463 * }
464 */
465 final Matcher isSearchFindMemberReferencesParams = new MatchesJsonObject(
466 "search.findMemberReferences params", {
467 "name": isString
468 });
469
470 /**
471 * search.findMemberReferences result
472 *
473 * {
474 * "id": SearchId
475 * }
476 */
477 final Matcher isSearchFindMemberReferencesResult = new MatchesJsonObject(
478 "search.findMemberReferences result", {
479 "id": isSearchId
480 });
481
482 /**
483 * search.findTopLevelDeclarations params
484 *
485 * {
486 * "pattern": String
487 * }
488 */
489 final Matcher isSearchFindTopLevelDeclarationsParams = new MatchesJsonObject(
490 "search.findTopLevelDeclarations params", {
491 "pattern": isString
492 });
493
494 /**
495 * search.findTopLevelDeclarations result
496 *
497 * {
498 * "id": SearchId
499 * }
500 */
501 final Matcher isSearchFindTopLevelDeclarationsResult = new MatchesJsonObject(
502 "search.findTopLevelDeclarations result", {
503 "id": isSearchId
504 });
505
506 /**
507 * search.getTypeHierarchy params
508 *
509 * {
510 * "file": FilePath
511 * "offset": int
512 * }
513 */
514 final Matcher isSearchGetTypeHierarchyParams = new MatchesJsonObject(
515 "search.getTypeHierarchy params", {
516 "file": isFilePath,
517 "offset": isInt
518 });
519
520 /**
521 * search.getTypeHierarchy result
522 *
523 * {
524 * "hierarchy": TypeHierarchyItem
525 * }
526 */
527 final Matcher isSearchGetTypeHierarchyResult = new MatchesJsonObject(
528 "search.getTypeHierarchy result", {
529 "hierarchy": isTypeHierarchyItem
530 });
531
532 /**
533 * search.results params
534 *
535 * {
536 * "id": SearchId
537 * "results": List<SearchResult>
538 * "last": bool
539 * }
540 */
541 final Matcher isSearchResultsParams = new MatchesJsonObject(
542 "search.results params", {
543 "id": isSearchId,
544 "results": isListOf(isSearchResult),
545 "last": isBool
546 });
547
548 /**
549 * edit.applyRefactoring params
550 *
551 * {
552 * "id": RefactoringId
553 * }
554 */
555 final Matcher isEditApplyRefactoringParams = new MatchesJsonObject(
556 "edit.applyRefactoring params", {
557 "id": isRefactoringId
558 });
559
560 /**
561 * edit.applyRefactoring result
562 *
563 * {
564 * "status": List<RefactoringProblem>
565 * "change": SourceChange
566 * }
567 */
568 final Matcher isEditApplyRefactoringResult = new MatchesJsonObject(
569 "edit.applyRefactoring result", {
570 "status": isListOf(isRefactoringProblem),
571 "change": isSourceChange
572 });
573
574 /**
575 * edit.createRefactoring params
576 *
577 * {
578 * "kindId": RefactoringKind
579 * "file": FilePath
580 * "offset": int
581 * "length": int
582 * }
583 */
584 final Matcher isEditCreateRefactoringParams = new MatchesJsonObject(
585 "edit.createRefactoring params", {
586 "kindId": isRefactoringKind,
587 "file": isFilePath,
588 "offset": isInt,
589 "length": isInt
590 });
591
592 /**
593 * edit.createRefactoring result
594 *
595 * {
596 * "id": RefactoringId
597 * "status": List<RefactoringProblem>
598 * }
599 */
600 final Matcher isEditCreateRefactoringResult = new MatchesJsonObject(
601 "edit.createRefactoring result", {
602 "id": isRefactoringId,
603 "status": isListOf(isRefactoringProblem)
604 });
605
606 /**
607 * edit.deleteRefactoring params
608 *
609 * {
610 * "id": RefactoringId
611 * }
612 */
613 final Matcher isEditDeleteRefactoringParams = new MatchesJsonObject(
614 "edit.deleteRefactoring params", {
615 "id": isRefactoringId
616 });
617
618 /**
619 * edit.deleteRefactoring result
620 */
621 final Matcher isEditDeleteRefactoringResult = isNull;
622
623 /**
624 * edit.getAssists params
625 *
626 * {
627 * "file": FilePath
628 * "offset": int
629 * "length": int
630 * }
631 */
632 final Matcher isEditGetAssistsParams = new MatchesJsonObject(
633 "edit.getAssists params", {
634 "file": isFilePath,
635 "offset": isInt,
636 "length": isInt
637 });
638
639 /**
640 * edit.getAssists result
641 *
642 * {
643 * "assists": List<SourceChange>
644 * }
645 */
646 final Matcher isEditGetAssistsResult = new MatchesJsonObject(
647 "edit.getAssists result", {
648 "assists": isListOf(isSourceChange)
649 });
650
651 /**
652 * edit.getFixes params
653 *
654 * {
655 * "file": FilePath
656 * "offset": int
657 * }
658 */
659 final Matcher isEditGetFixesParams = new MatchesJsonObject(
660 "edit.getFixes params", {
661 "file": isFilePath,
662 "offset": isInt
663 });
664
665 /**
666 * edit.getFixes result
667 *
668 * {
669 * "fixes": List<ErrorFixes>
670 * }
671 */
672 final Matcher isEditGetFixesResult = new MatchesJsonObject(
673 "edit.getFixes result", {
674 "fixes": isListOf(isErrorFixes)
675 });
676
677 /**
678 * edit.getRefactorings params
679 *
680 * {
681 * "file": FilePath
682 * "offset": int
683 * "length": int
684 * }
685 */
686 final Matcher isEditGetRefactoringsParams = new MatchesJsonObject(
687 "edit.getRefactorings params", {
688 "file": isFilePath,
689 "offset": isInt,
690 "length": isInt
691 });
692
693 /**
694 * edit.getRefactorings result
695 *
696 * {
697 * "kinds": List<RefactoringKind>
698 * }
699 */
700 final Matcher isEditGetRefactoringsResult = new MatchesJsonObject(
701 "edit.getRefactorings result", {
702 "kinds": isListOf(isRefactoringKind)
703 });
704
705 /**
706 * edit.setRefactoringOptions params
707 *
708 * {
709 * "id": RefactoringId
710 * }
711 */
712 final Matcher isEditSetRefactoringOptionsParams = new MatchesJsonObject(
713 "edit.setRefactoringOptions params", {
714 "id": isRefactoringId
715 });
716
717 /**
718 * edit.setRefactoringOptions result
719 *
720 * {
721 * "status": List<RefactoringProblem>
722 * }
723 */
724 final Matcher isEditSetRefactoringOptionsResult = new MatchesJsonObject(
725 "edit.setRefactoringOptions result", {
726 "status": isListOf(isRefactoringProblem)
727 });
728
729 /**
730 * debug.createContext params
731 *
732 * {
733 * "contextRoot": FilePath
734 * }
735 */
736 final Matcher isDebugCreateContextParams = new MatchesJsonObject(
737 "debug.createContext params", {
738 "contextRoot": isFilePath
739 });
740
741 /**
742 * debug.createContext result
743 *
744 * {
745 * "id": DebugContextId
746 * }
747 */
748 final Matcher isDebugCreateContextResult = new MatchesJsonObject(
749 "debug.createContext result", {
750 "id": isDebugContextId
751 });
752
753 /**
754 * debug.deleteContext params
755 *
756 * {
757 * "id": DebugContextId
758 * }
759 */
760 final Matcher isDebugDeleteContextParams = new MatchesJsonObject(
761 "debug.deleteContext params", {
762 "id": isDebugContextId
763 });
764
765 /**
766 * debug.deleteContext result
767 */
768 final Matcher isDebugDeleteContextResult = isNull;
769
770 /**
771 * debug.mapUri params
772 *
773 * {
774 * "id": DebugContextId
775 * "file": optional FilePath
776 * "uri": optional String
777 * }
778 */
779 final Matcher isDebugMapUriParams = new MatchesJsonObject(
780 "debug.mapUri params", {
781 "id": isDebugContextId
782 }, optionalFields: {
783 "file": isFilePath,
784 "uri": isString
785 });
786
787 /**
788 * debug.mapUri result
789 *
790 * {
791 * "file": optional FilePath
792 * "uri": optional String
793 * }
794 */
795 final Matcher isDebugMapUriResult = new MatchesJsonObject(
796 "debug.mapUri result", null, optionalFields: {
797 "file": isFilePath,
798 "uri": isString
799 });
800
801 /**
802 * debug.setSubscriptions params
803 *
804 * {
805 * "subscriptions": List<DebugService>
806 * }
807 */
808 final Matcher isDebugSetSubscriptionsParams = new MatchesJsonObject(
809 "debug.setSubscriptions params", {
810 "subscriptions": isListOf(isDebugService)
811 });
812
813 /**
814 * debug.setSubscriptions result
815 */
816 final Matcher isDebugSetSubscriptionsResult = isNull;
817
818 /**
819 * debug.launchData params
820 *
821 * {
822 * "executables": List<ExecutableFile>
823 * "dartToHtml": Map<FilePath, List<FilePath>>
824 * "htmlToDart": Map<FilePath, List<FilePath>>
825 * }
826 */
827 final Matcher isDebugLaunchDataParams = new MatchesJsonObject(
828 "debug.launchData params", {
829 "executables": isListOf(isExecutableFile),
830 "dartToHtml": isMapOf(isFilePath, isListOf(isFilePath)),
831 "htmlToDart": isMapOf(isFilePath, isListOf(isFilePath))
832 });
833
834 /**
835 * AnalysisError
836 *
837 * {
838 * "severity": ErrorSeverity
839 * "type": ErrorType
840 * "location": Location
841 * "message": String
842 * "correction": optional String
843 * }
844 */
845 final Matcher isAnalysisError = new MatchesJsonObject(
846 "AnalysisError", {
847 "severity": isErrorSeverity,
848 "type": isErrorType,
849 "location": isLocation,
850 "message": isString
851 }, optionalFields: {
852 "correction": isString
853 });
854
855 /**
856 * AnalysisOptions
857 *
858 * {
859 * "analyzeAngular": optional bool
860 * "analyzePolymer": optional bool
861 * "enableAsync": optional bool
862 * "enableDeferredLoading": optional bool
863 * "enableEnums": optional bool
864 * "generateDart2jsHints": optional bool
865 * "generateHints": optional bool
866 * }
867 */
868 final Matcher isAnalysisOptions = new MatchesJsonObject(
869 "AnalysisOptions", null, optionalFields: {
870 "analyzeAngular": isBool,
871 "analyzePolymer": isBool,
872 "enableAsync": isBool,
873 "enableDeferredLoading": isBool,
874 "enableEnums": isBool,
875 "generateDart2jsHints": isBool,
876 "generateHints": isBool
877 });
878
879 /**
880 * AnalysisService
881 *
882 * enum {
883 * ERRORS
884 * FOLDING
885 * HIGHLIGHTS
886 * NAVIGATION
887 * OCCURRENCES
888 * OUTLINE
889 * OVERRIDES
890 * }
891 */
892 final Matcher isAnalysisService = isIn([
893 "ERRORS",
894 "FOLDING",
895 "HIGHLIGHTS",
896 "NAVIGATION",
897 "OCCURRENCES",
898 "OUTLINE",
899 "OVERRIDES"
900 ]);
901
902 /**
903 * AnalysisStatus
904 *
905 * {
906 * "analyzing": bool
907 * "analysisTarget": optional String
908 * }
909 */
910 final Matcher isAnalysisStatus = new MatchesJsonObject(
911 "AnalysisStatus", {
912 "analyzing": isBool
913 }, optionalFields: {
914 "analysisTarget": isString
915 });
916
917 /**
918 * CompletionId
919 *
920 * String
921 */
922 final Matcher isCompletionId = isString;
923
924 /**
925 * CompletionRelevance
926 *
927 * enum {
928 * LOW
929 * DEFAULT
930 * HIGH
931 * }
932 */
933 final Matcher isCompletionRelevance = isIn([
934 "LOW",
935 "DEFAULT",
936 "HIGH"
937 ]);
938
939 /**
940 * CompletionSuggestion
941 *
942 * {
943 * "kind": CompletionSuggestionKind
944 * "relevance": CompletionRelevance
945 * "completion": String
946 * "selectionOffset": int
947 * "selectionLength": int
948 * "isDeprecated": bool
949 * "isPotential": bool
950 * "docSummary": optional String
951 * "docComplete": optional String
952 * "declaringType": optional String
953 * "returnType": optional String
954 * "parameterNames": optional List<String>
955 * "parameterTypes": optional List<String>
956 * "requiredParameterCount": optional int
957 * "positionalParameterCount": optional int
958 * "parameterName": optional String
959 * "parameterType": optional String
960 * }
961 */
962 final Matcher isCompletionSuggestion = new MatchesJsonObject(
963 "CompletionSuggestion", {
964 "kind": isCompletionSuggestionKind,
965 "relevance": isCompletionRelevance,
966 "completion": isString,
967 "selectionOffset": isInt,
968 "selectionLength": isInt,
969 "isDeprecated": isBool,
970 "isPotential": isBool
971 }, optionalFields: {
972 "docSummary": isString,
973 "docComplete": isString,
974 "declaringType": isString,
975 "returnType": isString,
976 "parameterNames": isListOf(isString),
977 "parameterTypes": isListOf(isString),
978 "requiredParameterCount": isInt,
979 "positionalParameterCount": isInt,
980 "parameterName": isString,
981 "parameterType": isString
982 });
983
984 /**
985 * CompletionSuggestionKind
986 *
987 * enum {
988 * ARGUMENT_LIST
989 * CLASS
990 * CLASS_ALIAS
991 * CONSTRUCTOR
992 * FIELD
993 * FUNCTION
994 * FUNCTION_TYPE_ALIAS
995 * GETTER
996 * IMPORT
997 * LIBRARY_PREFIX
998 * METHOD
999 * METHOD_NAME
1000 * NAMED_ARGUMENT
1001 * OPTIONAL_ARGUMENT
1002 * PARAMETER
1003 * SETTER
1004 * TOP_LEVEL_VARIABLE
1005 * TYPE_PARAMETER
1006 * VARIABLE
1007 * }
1008 */
1009 final Matcher isCompletionSuggestionKind = isIn([
1010 "ARGUMENT_LIST",
1011 "CLASS",
1012 "CLASS_ALIAS",
1013 "CONSTRUCTOR",
1014 "FIELD",
1015 "FUNCTION",
1016 "FUNCTION_TYPE_ALIAS",
1017 "GETTER",
1018 "IMPORT",
1019 "LIBRARY_PREFIX",
1020 "METHOD",
1021 "METHOD_NAME",
1022 "NAMED_ARGUMENT",
1023 "OPTIONAL_ARGUMENT",
1024 "PARAMETER",
1025 "SETTER",
1026 "TOP_LEVEL_VARIABLE",
1027 "TYPE_PARAMETER",
1028 "VARIABLE"
1029 ]);
1030
1031 /**
1032 * ContentChange
1033 *
1034 * {
1035 * "content": String
1036 * "offset": optional int
1037 * "oldLength": optional int
1038 * "newLength": optional int
1039 * }
1040 */
1041 final Matcher isContentChange = new MatchesJsonObject(
1042 "ContentChange", {
1043 "content": isString
1044 }, optionalFields: {
1045 "offset": isInt,
1046 "oldLength": isInt,
1047 "newLength": isInt
1048 });
1049
1050 /**
1051 * DebugContextId
1052 *
1053 * String
1054 */
1055 final Matcher isDebugContextId = isString;
1056
1057 /**
1058 * DebugService
1059 *
1060 * enum {
1061 * LAUNCH_DATA
1062 * }
1063 */
1064 final Matcher isDebugService = isIn([
1065 "LAUNCH_DATA"
1066 ]);
1067
1068 /**
1069 * Element
1070 *
1071 * {
1072 * "kind": ElementKind
1073 * "name": String
1074 * "location": Location
1075 * "flags": int
1076 * "parameters": optional String
1077 * "returnType": optional String
1078 * }
1079 */
1080 final Matcher isElement = new MatchesJsonObject(
1081 "Element", {
1082 "kind": isElementKind,
1083 "name": isString,
1084 "location": isLocation,
1085 "flags": isInt
1086 }, optionalFields: {
1087 "parameters": isString,
1088 "returnType": isString
1089 });
1090
1091 /**
1092 * ElementKind
1093 *
1094 * enum {
1095 * CLASS
1096 * CLASS_TYPE_ALIAS
1097 * COMPILATION_UNIT
1098 * CONSTRUCTOR
1099 * GETTER
1100 * FIELD
1101 * FUNCTION
1102 * FUNCTION_TYPE_ALIAS
1103 * LIBRARY
1104 * LOCAL_VARIABLE
1105 * METHOD
1106 * SETTER
1107 * TOP_LEVEL_VARIABLE
1108 * TYPE_PARAMETER
1109 * UNKNOWN
1110 * UNIT_TEST_GROUP
1111 * UNIT_TEST_TEST
1112 * }
1113 */
1114 final Matcher isElementKind = isIn([
1115 "CLASS",
1116 "CLASS_TYPE_ALIAS",
1117 "COMPILATION_UNIT",
1118 "CONSTRUCTOR",
1119 "GETTER",
1120 "FIELD",
1121 "FUNCTION",
1122 "FUNCTION_TYPE_ALIAS",
1123 "LIBRARY",
1124 "LOCAL_VARIABLE",
1125 "METHOD",
1126 "SETTER",
1127 "TOP_LEVEL_VARIABLE",
1128 "TYPE_PARAMETER",
1129 "UNKNOWN",
1130 "UNIT_TEST_GROUP",
1131 "UNIT_TEST_TEST"
1132 ]);
1133
1134 /**
1135 * Error
1136 *
1137 * {
1138 * "code": String
1139 * "message": String
1140 * "data": optional object
1141 * }
1142 */
1143 final Matcher isError = new MatchesJsonObject(
1144 "Error", {
1145 // TODO(paulberry): the API spec says "code" should be a string, but the
1146 // server is currently outputting integers.
1147 "code": isInt,
1148 "message": isString
1149 }, optionalFields: {
1150 "data": isObject
1151 });
1152
1153 /**
1154 * ErrorFixes
1155 *
1156 * {
1157 * "error": AnalysisError
1158 * "fixes": List<SourceChange>
1159 * }
1160 */
1161 final Matcher isErrorFixes = new MatchesJsonObject(
1162 "ErrorFixes", {
1163 "error": isAnalysisError,
1164 "fixes": isListOf(isSourceChange)
1165 });
1166
1167 /**
1168 * ErrorSeverity
1169 *
1170 * enum {
1171 * INFO
1172 * WARNING
1173 * ERROR
1174 * }
1175 */
1176 final Matcher isErrorSeverity = isIn([
1177 "INFO",
1178 "WARNING",
1179 "ERROR"
1180 ]);
1181
1182 /**
1183 * ErrorType
1184 *
1185 * enum {
1186 * COMPILE_TIME_ERROR
1187 * HINT
1188 * STATIC_TYPE_WARNING
1189 * STATIC_WARNING
1190 * SYNTACTIC_ERROR
1191 * TODO
1192 * }
1193 */
1194 final Matcher isErrorType = isIn([
1195 "COMPILE_TIME_ERROR",
1196 "HINT",
1197 "STATIC_TYPE_WARNING",
1198 "STATIC_WARNING",
1199 "SYNTACTIC_ERROR",
1200 "TODO"
1201 ]);
1202
1203 /**
1204 * ExecutableFile
1205 *
1206 * {
1207 * "file": FilePath
1208 * "offset": ExecutableKind
1209 * }
1210 */
1211 final Matcher isExecutableFile = new MatchesJsonObject(
1212 "ExecutableFile", {
1213 "file": isFilePath,
1214 "offset": isExecutableKind
1215 });
1216
1217 /**
1218 * ExecutableKind
1219 *
1220 * enum {
1221 * CLIENT
1222 * EITHER
1223 * SERVER
1224 * }
1225 */
1226 final Matcher isExecutableKind = isIn([
1227 "CLIENT",
1228 "EITHER",
1229 "SERVER"
1230 ]);
1231
1232 /**
1233 * FilePath
1234 *
1235 * String
1236 */
1237 final Matcher isFilePath = isString;
1238
1239 /**
1240 * FoldingKind
1241 *
1242 * enum {
1243 * COMMENT
1244 * CLASS_MEMBER
1245 * DIRECTIVES
1246 * DOCUMENTATION_COMMENT
1247 * TOP_LEVEL_DECLARATION
1248 * }
1249 */
1250 final Matcher isFoldingKind = isIn([
1251 "COMMENT",
1252 "CLASS_MEMBER",
1253 "DIRECTIVES",
1254 "DOCUMENTATION_COMMENT",
1255 "TOP_LEVEL_DECLARATION"
1256 ]);
1257
1258 /**
1259 * FoldingRegion
1260 *
1261 * {
1262 * "kind": FoldingKind
1263 * "offset": int
1264 * "length": int
1265 * }
1266 */
1267 final Matcher isFoldingRegion = new MatchesJsonObject(
1268 "FoldingRegion", {
1269 "kind": isFoldingKind,
1270 "offset": isInt,
1271 "length": isInt
1272 });
1273
1274 /**
1275 * HighlightRegion
1276 *
1277 * {
1278 * "type": HighlightRegionType
1279 * "offset": int
1280 * "length": int
1281 * }
1282 */
1283 final Matcher isHighlightRegion = new MatchesJsonObject(
1284 "HighlightRegion", {
1285 "type": isHighlightRegionType,
1286 "offset": isInt,
1287 "length": isInt
1288 });
1289
1290 /**
1291 * HighlightRegionType
1292 *
1293 * enum {
1294 * ANNOTATION
1295 * BUILT_IN
1296 * CLASS
1297 * COMMENT_BLOCK
1298 * COMMENT_DOCUMENTATION
1299 * COMMENT_END_OF_LINE
1300 * CONSTRUCTOR
1301 * DIRECTIVE
1302 * DYNAMIC_TYPE
1303 * FIELD
1304 * FIELD_STATIC
1305 * FUNCTION_DECLARATION
1306 * FUNCTION
1307 * FUNCTION_TYPE_ALIAS
1308 * GETTER_DECLARATION
1309 * KEYWORD
1310 * IDENTIFIER_DEFAULT
1311 * IMPORT_PREFIX
1312 * LITERAL_BOOLEAN
1313 * LITERAL_DOUBLE
1314 * LITERAL_INTEGER
1315 * LITERAL_LIST
1316 * LITERAL_MAP
1317 * LITERAL_STRING
1318 * LOCAL_VARIABLE_DECLARATION
1319 * LOCAL_VARIABLE
1320 * METHOD_DECLARATION
1321 * METHOD_DECLARATION_STATIC
1322 * METHOD
1323 * METHOD_STATIC
1324 * PARAMETER
1325 * SETTER_DECLARATION
1326 * TOP_LEVEL_VARIABLE
1327 * TYPE_NAME_DYNAMIC
1328 * TYPE_PARAMETER
1329 * }
1330 */
1331 final Matcher isHighlightRegionType = isIn([
1332 "ANNOTATION",
1333 "BUILT_IN",
1334 "CLASS",
1335 "COMMENT_BLOCK",
1336 "COMMENT_DOCUMENTATION",
1337 "COMMENT_END_OF_LINE",
1338 "CONSTRUCTOR",
1339 "DIRECTIVE",
1340 "DYNAMIC_TYPE",
1341 "FIELD",
1342 "FIELD_STATIC",
1343 "FUNCTION_DECLARATION",
1344 "FUNCTION",
1345 "FUNCTION_TYPE_ALIAS",
1346 "GETTER_DECLARATION",
1347 "KEYWORD",
1348 "IDENTIFIER_DEFAULT",
1349 "IMPORT_PREFIX",
1350 "LITERAL_BOOLEAN",
1351 "LITERAL_DOUBLE",
1352 "LITERAL_INTEGER",
1353 "LITERAL_LIST",
1354 "LITERAL_MAP",
1355 "LITERAL_STRING",
1356 "LOCAL_VARIABLE_DECLARATION",
1357 "LOCAL_VARIABLE",
1358 "METHOD_DECLARATION",
1359 "METHOD_DECLARATION_STATIC",
1360 "METHOD",
1361 "METHOD_STATIC",
1362 "PARAMETER",
1363 "SETTER_DECLARATION",
1364 "TOP_LEVEL_VARIABLE",
1365 "TYPE_NAME_DYNAMIC",
1366 "TYPE_PARAMETER"
1367 ]);
1368
1369 /**
1370 * HoverInformation
1371 *
1372 * {
1373 * "offset": int
1374 * "length": int
1375 * "containingLibraryPath": optional String
1376 * "containingLibraryName": optional String
1377 * "dartdoc": optional String
1378 * "elementDescription": optional String
1379 * "elementKind": optional String
1380 * "parameter": optional String
1381 * "propagatedType": optional String
1382 * "staticType": optional String
1383 * }
1384 */
1385 final Matcher isHoverInformation = new MatchesJsonObject(
1386 "HoverInformation", {
1387 "offset": isInt,
1388 "length": isInt
1389 }, optionalFields: {
1390 "containingLibraryPath": isString,
1391 "containingLibraryName": isString,
1392 "dartdoc": isString,
1393 "elementDescription": isString,
1394 "elementKind": isString,
1395 "parameter": isString,
1396 "propagatedType": isString,
1397 "staticType": isString
1398 });
1399
1400 /**
1401 * Location
1402 *
1403 * {
1404 * "file": FilePath
1405 * "offset": int
1406 * "length": int
1407 * "startLine": int
1408 * "startColumn": int
1409 * }
1410 */
1411 final Matcher isLocation = new MatchesJsonObject(
1412 "Location", {
1413 "file": isFilePath,
1414 "offset": isInt,
1415 "length": isInt,
1416 "startLine": isInt,
1417 "startColumn": isInt
1418 });
1419
1420 /**
1421 * NavigationRegion
1422 *
1423 * {
1424 * "offset": int
1425 * "length": int
1426 * "targets": List<Element>
1427 * }
1428 */
1429 final Matcher isNavigationRegion = new MatchesJsonObject(
1430 "NavigationRegion", {
1431 "offset": isInt,
1432 "length": isInt,
1433 "targets": isListOf(isElement)
1434 });
1435
1436 /**
1437 * Occurrences
1438 *
1439 * {
1440 * "element": Element
1441 * "offsets": List<int>
1442 * "length": int
1443 * }
1444 */
1445 final Matcher isOccurrences = new MatchesJsonObject(
1446 "Occurrences", {
1447 "element": isElement,
1448 "offsets": isListOf(isInt),
1449 "length": isInt
1450 });
1451
1452 /**
1453 * Outline
1454 *
1455 * {
1456 * "element": Element
1457 * "offset": int
1458 * "length": int
1459 * "children": optional List<Outline>
1460 * }
1461 */
1462 final Matcher isOutline = new MatchesJsonObject(
1463 "Outline", {
1464 "element": isElement,
1465 "offset": isInt,
1466 "length": isInt
1467 }, optionalFields: {
1468 "children": isListOf(isOutline)
1469 });
1470
1471 /**
1472 * Override
1473 *
1474 * {
1475 * "offset": int
1476 * "length": int
1477 * "superclassMember": optional OverriddenMember
1478 * "interfaceMembers": optional List<OverriddenMember>
1479 * }
1480 */
1481 final Matcher isOverride = new MatchesJsonObject(
1482 "Override", {
1483 "offset": isInt,
1484 "length": isInt
1485 }, optionalFields: {
1486 "superclassMember": isOverriddenMember,
1487 "interfaceMembers": isListOf(isOverriddenMember)
1488 });
1489
1490 /**
1491 * OverriddenMember
1492 *
1493 * {
1494 * "element": Element
1495 * "className": String
1496 * }
1497 */
1498 final Matcher isOverriddenMember = new MatchesJsonObject(
1499 "OverriddenMember", {
1500 "element": isElement,
1501 "className": isString
1502 });
1503
1504 /**
1505 * Parameter
1506 *
1507 * {
1508 * "type": String
1509 * "name": String
1510 * }
1511 */
1512 final Matcher isParameter = new MatchesJsonObject(
1513 "Parameter", {
1514 "type": isString,
1515 "name": isString
1516 });
1517
1518 /**
1519 * RefactoringId
1520 *
1521 * String
1522 */
1523 final Matcher isRefactoringId = isString;
1524
1525 /**
1526 * RefactoringKind
1527 *
1528 * enum {
1529 * CONVERT_GETTER_TO_METHOD
1530 * CONVERT_METHOD_TO_GETTER
1531 * EXTRACT_LOCAL_VARIABLE
1532 * EXTRACT_METHOD
1533 * INLINE_LOCAL_VARIABLE
1534 * INLINE_METHOD
1535 * RENAME
1536 * }
1537 */
1538 final Matcher isRefactoringKind = isIn([
1539 "CONVERT_GETTER_TO_METHOD",
1540 "CONVERT_METHOD_TO_GETTER",
1541 "EXTRACT_LOCAL_VARIABLE",
1542 "EXTRACT_METHOD",
1543 "INLINE_LOCAL_VARIABLE",
1544 "INLINE_METHOD",
1545 "RENAME"
1546 ]);
1547
1548 /**
1549 * RefactoringProblem
1550 *
1551 * {
1552 * "severity": RefactoringProblemSeverity
1553 * "message": String
1554 * "location": Location
1555 * }
1556 */
1557 final Matcher isRefactoringProblem = new MatchesJsonObject(
1558 "RefactoringProblem", {
1559 "severity": isRefactoringProblemSeverity,
1560 "message": isString,
1561 "location": isLocation
1562 });
1563
1564 /**
1565 * RefactoringProblemSeverity
1566 *
1567 * enum {
1568 * INFO
1569 * WARNING
1570 * ERROR
1571 * FATAL
1572 * }
1573 */
1574 final Matcher isRefactoringProblemSeverity = isIn([
1575 "INFO",
1576 "WARNING",
1577 "ERROR",
1578 "FATAL"
1579 ]);
1580
1581 /**
1582 * SearchId
1583 *
1584 * String
1585 */
1586 final Matcher isSearchId = isString;
1587
1588 /**
1589 * SearchResult
1590 *
1591 * {
1592 * "location": Location
1593 * "kind": SearchResultKind
1594 * "isPotential": bool
1595 * "path": List<Element>
1596 * }
1597 */
1598 final Matcher isSearchResult = new MatchesJsonObject(
1599 "SearchResult", {
1600 "location": isLocation,
1601 "kind": isSearchResultKind,
1602 "isPotential": isBool,
1603 "path": isListOf(isElement)
1604 });
1605
1606 /**
1607 * SearchResultKind
1608 *
1609 * enum {
1610 * DECLARATION
1611 * INVOCATION
1612 * READ
1613 * READ_WRITE
1614 * REFERENCE
1615 * WRITE
1616 * }
1617 */
1618 final Matcher isSearchResultKind = isIn([
1619 "DECLARATION",
1620 "INVOCATION",
1621 "READ",
1622 "READ_WRITE",
1623 "REFERENCE",
1624 "WRITE"
1625 ]);
1626
1627 /**
1628 * ServerService
1629 *
1630 * enum {
1631 * STATUS
1632 * }
1633 */
1634 final Matcher isServerService = isIn([
1635 "STATUS"
1636 ]);
1637
1638 /**
1639 * SourceChange
1640 *
1641 * {
1642 * "message": String
1643 * "edits": List<SourceFileEdit>
1644 * }
1645 */
1646 final Matcher isSourceChange = new MatchesJsonObject(
1647 "SourceChange", {
1648 "message": isString,
1649 "edits": isListOf(isSourceFileEdit)
1650 });
1651
1652 /**
1653 * SourceEdit
1654 *
1655 * {
1656 * "offset": int
1657 * "length": int
1658 * "replacement": String
1659 * }
1660 */
1661 final Matcher isSourceEdit = new MatchesJsonObject(
1662 "SourceEdit", {
1663 "offset": isInt,
1664 "length": isInt,
1665 "replacement": isString
1666 });
1667
1668 /**
1669 * SourceFileEdit
1670 *
1671 * {
1672 * "file": FilePath
1673 * "edits": List<SourceEdit>
1674 * }
1675 */
1676 final Matcher isSourceFileEdit = new MatchesJsonObject(
1677 "SourceFileEdit", {
1678 "file": isFilePath,
1679 "edits": isListOf(isSourceEdit)
1680 });
1681
1682 /**
1683 * TypeHierarchyItem
1684 *
1685 * {
1686 * "classElement": Element
1687 * "displayName": optional String
1688 * "memberElement": optional Element
1689 * "superclass": optional TypeHierarchyItem
1690 * "interfaces": List<TypeHierarchyItem>
1691 * "mixins": List<TypeHierarchyItem>
1692 * "subclasses": List<TypeHierarchyItem>
1693 * }
1694 */
1695 final Matcher isTypeHierarchyItem = new MatchesJsonObject(
1696 "TypeHierarchyItem", {
1697 "classElement": isElement,
1698 "interfaces": isListOf(isTypeHierarchyItem),
1699 "mixins": isListOf(isTypeHierarchyItem),
1700 "subclasses": isListOf(isTypeHierarchyItem)
1701 }, optionalFields: {
1702 "displayName": isString,
1703 "memberElement": isElement,
1704 "superclass": isTypeHierarchyItem
1705 });
1706
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698