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

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

Issue 1536823002: merge completion suggestions based upon relevance (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
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 addTestFile(''' 657 addTestFile('''
658 import '/libA.dart'; 658 import '/libA.dart';
659 class B extends A { 659 class B extends A {
660 m() {} 660 m() {}
661 x() {^} 661 x() {^}
662 } 662 }
663 '''); 663 ''');
664 return getSuggestions().then((_) { 664 return getSuggestions().then((_) {
665 expect(replacementOffset, equals(completionOffset)); 665 expect(replacementOffset, equals(completionOffset));
666 expect(replacementLength, equals(0)); 666 expect(replacementLength, equals(0));
667 assertHasResult(CompletionSuggestionKind.INVOCATION, 'm'); 667 assertHasResult(CompletionSuggestionKind.INVOCATION, 'm',
668 relevance: DART_RELEVANCE_LOCAL_METHOD);
668 }); 669 });
669 } 670 }
670 671
671 test_locals() { 672 test_locals() {
672 addTestFile('class A {var a; x() {var b;^}} class DateTime { }'); 673 addTestFile('class A {var a; x() {var b;^}} class DateTime { }');
673 return getSuggestions().then((_) { 674 return getSuggestions().then((_) {
674 expect(replacementOffset, equals(completionOffset)); 675 expect(replacementOffset, equals(completionOffset));
675 expect(replacementLength, equals(0)); 676 expect(replacementLength, equals(0));
676 assertHasResult(CompletionSuggestionKind.INVOCATION, 'A'); 677 assertHasResult(CompletionSuggestionKind.INVOCATION, 'A');
677 assertHasResult(CompletionSuggestionKind.INVOCATION, 'a', 678 assertHasResult(CompletionSuggestionKind.INVOCATION, 'a',
(...skipping 18 matching lines...) Expand all
696 697
697 test_overrides() { 698 test_overrides() {
698 addFile('/libA.dart', 'class A {m() {}}'); 699 addFile('/libA.dart', 'class A {m() {}}');
699 addTestFile(''' 700 addTestFile('''
700 import '/libA.dart'; 701 import '/libA.dart';
701 class B extends A {m() {^}} 702 class B extends A {m() {^}}
702 '''); 703 ''');
703 return getSuggestions().then((_) { 704 return getSuggestions().then((_) {
704 expect(replacementOffset, equals(completionOffset)); 705 expect(replacementOffset, equals(completionOffset));
705 expect(replacementLength, equals(0)); 706 expect(replacementLength, equals(0));
706 assertHasResult(CompletionSuggestionKind.INVOCATION, 'm'); 707 assertHasResult(CompletionSuggestionKind.INVOCATION, 'm',
708 relevance: DART_RELEVANCE_LOCAL_METHOD);
707 }); 709 });
708 } 710 }
709 711
710 test_partFile() { 712 test_partFile() {
711 addFile( 713 addFile(
712 '/project/bin/testA.dart', 714 '/project/bin/testA.dart',
713 ''' 715 '''
714 library libA; 716 library libA;
715 part "$testFile"; 717 part "$testFile";
716 import 'dart:html'; 718 import 'dart:html';
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 } 988 }
987 '''); 989 ''');
988 await waitForTasksFinished(); 990 await waitForTasksFinished();
989 Request request = 991 Request request =
990 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0'); 992 new CompletionGetSuggestionsParams(testFile, 0).toRequest('0');
991 Response response = handler.handleRequest(request); 993 Response response = handler.handleRequest(request);
992 expect(response.error, isNotNull); 994 expect(response.error, isNotNull);
993 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); 995 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED);
994 } 996 }
995 } 997 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698