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

Side by Side Diff: pkg/analysis_server/test/domain_completion_test.dart

Issue 1522003003: suppress all dart contributor suggestions in comments (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.domain.completion; 5 library test.domain.completion;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; 9 import 'package:analysis_server/plugin/protocol/protocol.dart';
10 import 'package:analysis_server/src/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 expect(id.isNotEmpty, isTrue); 335 expect(id.isNotEmpty, isTrue);
336 } 336 }
337 337
338 @override 338 @override
339 Index createIndex() { 339 Index createIndex() {
340 return createLocalMemoryIndex(); 340 return createLocalMemoryIndex();
341 } 341 }
342 342
343 Future getSuggestions() { 343 Future getSuggestions() {
344 return waitForTasksFinished().then((_) { 344 return waitForTasksFinished().then((_) {
345 Request request = new CompletionGetSuggestionsParams( 345 Request request =
346 testFile, completionOffset).toRequest('0'); 346 new CompletionGetSuggestionsParams(testFile, completionOffset)
347 .toRequest('0');
347 Response response = handleSuccessfulRequest(request); 348 Response response = handleSuccessfulRequest(request);
348 completionId = response.id; 349 completionId = response.id;
349 assertValidId(completionId); 350 assertValidId(completionId);
350 return pumpEventQueue().then((_) { 351 return pumpEventQueue().then((_) {
351 expect(suggestionsDone, isTrue); 352 expect(suggestionsDone, isTrue);
352 }); 353 });
353 }); 354 });
354 } 355 }
355 356
356 void processNotification(Notification notification) { 357 void processNotification(Notification notification) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 526
526 test_invocation_withTrailingStmt() { 527 test_invocation_withTrailingStmt() {
527 addTestFile('class A {b() {}} main() {A a; a.^ int x = 7;}'); 528 addTestFile('class A {b() {}} main() {A a; a.^ int x = 7;}');
528 return getSuggestions().then((_) { 529 return getSuggestions().then((_) {
529 expect(replacementOffset, equals(completionOffset)); 530 expect(replacementOffset, equals(completionOffset));
530 expect(replacementLength, equals(0)); 531 expect(replacementLength, equals(0));
531 assertHasResult(CompletionSuggestionKind.INVOCATION, 'b'); 532 assertHasResult(CompletionSuggestionKind.INVOCATION, 'b');
532 }); 533 });
533 } 534 }
534 535
536 test_inComment_block_beforeNode() async {
537 addTestFile('''
538 main(aaa, bbb) {
539 /* text ^ */
540 print(42);
541 }
542 ''');
543 await getSuggestions();
544 expect(suggestions, isEmpty);
545 }
546
547 test_inComment_endOfLine_beforeNode() async {
548 addTestFile('''
549 main(aaa, bbb) {
550 // text ^
551 print(42);
552 }
553 ''');
554 await getSuggestions();
555 expect(suggestions, isEmpty);
556 }
557
558 test_inComment_endOfLine_beforeToken() async {
559 addTestFile('''
560 main(aaa, bbb) {
561 // text ^
562 }
563 ''');
564 await getSuggestions();
565 expect(suggestions, isEmpty);
566 }
567
568 test_inDartDoc1() async {
569 addTestFile('''
570 /// ^
571 main(aaa, bbb) {}
572 ''');
573 await getSuggestions();
574 expect(suggestions, isEmpty);
575 }
576
577 test_inDartDoc2() async {
578 addTestFile('''
579 /// Some text^
580 main(aaa, bbb) {}
581 ''');
582 await getSuggestions();
583 expect(suggestions, isEmpty);
584 }
585
586 test_inDartDoc_reference2() async {
587 addTestFile('''
588 /// The [^]
589 main(aaa, bbb) {}
590 ''');
591 await getSuggestions();
592 assertHasResult(CompletionSuggestionKind.INVOCATION, 'main',
593 relevance: DART_RELEVANCE_LOCAL_FUNCTION);
594 assertHasResult(CompletionSuggestionKind.INVOCATION, 'Object');
595 }
596
597 test_inDartDoc_reference3() async {
598 addTestFile('''
599 /// The [m^]
600 main(aaa, bbb) {}
601 ''');
602 await getSuggestions();
603 assertHasResult(CompletionSuggestionKind.INVOCATION, 'main',
604 relevance: DART_RELEVANCE_LOCAL_FUNCTION);
605 }
606
535 test_keyword() { 607 test_keyword() {
536 addTestFile('library A; cl^'); 608 addTestFile('library A; cl^');
537 return getSuggestions().then((_) { 609 return getSuggestions().then((_) {
538 expect(replacementOffset, equals(completionOffset - 2)); 610 expect(replacementOffset, equals(completionOffset - 2));
539 expect(replacementLength, equals(2)); 611 expect(replacementLength, equals(2));
540 assertHasResult(CompletionSuggestionKind.KEYWORD, 'export', 612 assertHasResult(CompletionSuggestionKind.KEYWORD, 'export',
541 relevance: DART_RELEVANCE_HIGH); 613 relevance: DART_RELEVANCE_HIGH);
542 assertHasResult(CompletionSuggestionKind.KEYWORD, 'class', 614 assertHasResult(CompletionSuggestionKind.KEYWORD, 'class',
543 relevance: DART_RELEVANCE_HIGH); 615 relevance: DART_RELEVANCE_HIGH);
544 }); 616 });
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 } 949 }
878 '''); 950 ''');
879 await waitForTasksFinished(); 951 await waitForTasksFinished();
880 Request request = 952 Request request =
881 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); 953 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0');
882 Response response = handler.handleRequest(request); 954 Response response = handler.handleRequest(request);
883 expect(response.error, isNotNull); 955 expect(response.error, isNotNull);
884 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); 956 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED);
885 } 957 }
886 } 958 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698