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

Side by Side Diff: pkg/analysis_server/test/services/completion/completion_test_util.dart

Issue 1369033002: Completions with exact prefix should be prioritized - fixes #23099 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
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.services.completion.util; 5 library test.services.completion.util;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/protocol.dart' as protocol 10 import 'package:analysis_server/src/protocol.dart' as protocol
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 // false, 1350 // false,
1351 // COMPLETION_RELEVANCE_LOW); 1351 // COMPLETION_RELEVANCE_LOW);
1352 if (contributor is ImportedReferenceContributor) { 1352 if (contributor is ImportedReferenceContributor) {
1353 // TODO(danrubel) should be top level var suggestion 1353 // TODO(danrubel) should be top level var suggestion
1354 assertSuggestGetter('T1', 'String'); 1354 assertSuggestGetter('T1', 'String');
1355 } 1355 }
1356 assertNotSuggested('_T2'); 1356 assertNotSuggested('_T2');
1357 //assertSuggestImportedTopLevelVar('T3', 'int', COMPLETION_RELEVANCE_LOW); 1357 //assertSuggestImportedTopLevelVar('T3', 'int', COMPLETION_RELEVANCE_LOW);
1358 assertNotSuggested('_T4'); 1358 assertNotSuggested('_T4');
1359 assertSuggestLocalTopLevelVar('T5', 'int'); 1359 assertSuggestLocalTopLevelVar('T5', 'int');
1360 assertSuggestLocalTopLevelVar('_T6', null); 1360 assertSuggestLocalTopLevelVar('_T6', null,
1361 relevance: DART_RELEVANCE_DEFAULT);
1361 assertNotSuggested('=='); 1362 assertNotSuggested('==');
1362 assertSuggestLocalGetter('T7', 'String'); 1363 assertSuggestLocalGetter('T7', 'String');
1363 assertSuggestLocalSetter('T8'); 1364 assertSuggestLocalSetter('T8');
1364 assertSuggestLocalGetter('clog', 'int'); 1365 assertSuggestLocalGetter('clog', 'int');
1365 assertSuggestLocalSetter('blog'); 1366 assertSuggestLocalSetter('blog');
1366 // TODO (danrubel) suggest HtmlElement as low relevance 1367 // TODO (danrubel) suggest HtmlElement as low relevance
1367 assertNotSuggested('HtmlElement'); 1368 assertNotSuggested('HtmlElement');
1368 assertSuggestImportedClass('Uri'); 1369 assertSuggestImportedClass('Uri');
1369 assertNotSuggested('parseIPv6Address'); 1370 assertNotSuggested('parseIPv6Address');
1370 assertNotSuggested('parseHex'); 1371 assertNotSuggested('parseHex');
(...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after
3466 if (methodA != null) { 3467 if (methodA != null) {
3467 expect(methodA.element.isDeprecated, isFalse); 3468 expect(methodA.element.isDeprecated, isFalse);
3468 expect(methodA.element.isPrivate, isFalse); 3469 expect(methodA.element.isPrivate, isFalse);
3469 } 3470 }
3470 CompletionSuggestion getterF = assertSuggestLocalGetter('f', 'X', 3471 CompletionSuggestion getterF = assertSuggestLocalGetter('f', 'X',
3471 relevance: DART_RELEVANCE_LOW, deprecated: true); 3472 relevance: DART_RELEVANCE_LOW, deprecated: true);
3472 if (getterF != null) { 3473 if (getterF != null) {
3473 expect(getterF.element.isDeprecated, isTrue); 3474 expect(getterF.element.isDeprecated, isTrue);
3474 expect(getterF.element.isPrivate, isFalse); 3475 expect(getterF.element.isPrivate, isFalse);
3475 } 3476 }
3476 CompletionSuggestion getterG = assertSuggestLocalGetter('_g', null); 3477 CompletionSuggestion getterG = assertSuggestLocalGetter('_g', null,
3478 relevance: DART_RELEVANCE_DEFAULT);
3477 if (getterG != null) { 3479 if (getterG != null) {
3478 expect(getterG.element.isDeprecated, isFalse); 3480 expect(getterG.element.isDeprecated, isFalse);
3479 expect(getterG.element.isPrivate, isTrue); 3481 expect(getterG.element.isPrivate, isTrue);
3480 } 3482 }
3481 }); 3483 });
3482 } 3484 }
3483 3485
3484 test_MethodDeclaration_body_static() { 3486 test_MethodDeclaration_body_static() {
3485 // Block BlockFunctionBody MethodDeclaration 3487 // Block BlockFunctionBody MethodDeclaration
3486 addSource( 3488 addSource(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3521 }); 3523 });
3522 } 3524 }
3523 3525
3524 test_MethodDeclaration_members() { 3526 test_MethodDeclaration_members() {
3525 // Block BlockFunctionBody MethodDeclaration 3527 // Block BlockFunctionBody MethodDeclaration
3526 addTestSource('class A {@deprecated X f; Z _a() {^} var _g;}'); 3528 addTestSource('class A {@deprecated X f; Z _a() {^} var _g;}');
3527 computeFast(); 3529 computeFast();
3528 return computeFull((bool result) { 3530 return computeFull((bool result) {
3529 expect(request.replacementOffset, completionOffset); 3531 expect(request.replacementOffset, completionOffset);
3530 expect(request.replacementLength, 0); 3532 expect(request.replacementLength, 0);
3531 CompletionSuggestion methodA = assertSuggestLocalMethod('_a', 'A', 'Z'); 3533 CompletionSuggestion methodA = assertSuggestLocalMethod('_a', 'A', 'Z',
3534 relevance: DART_RELEVANCE_DEFAULT);
3532 if (methodA != null) { 3535 if (methodA != null) {
3533 expect(methodA.element.isDeprecated, isFalse); 3536 expect(methodA.element.isDeprecated, isFalse);
3534 expect(methodA.element.isPrivate, isTrue); 3537 expect(methodA.element.isPrivate, isTrue);
3535 } 3538 }
3536 CompletionSuggestion getterF = assertSuggestLocalField('f', 'X', 3539 CompletionSuggestion getterF = assertSuggestLocalField('f', 'X',
3537 relevance: DART_RELEVANCE_LOW, deprecated: true); 3540 relevance: DART_RELEVANCE_LOW, deprecated: true);
3538 if (getterF != null) { 3541 if (getterF != null) {
3539 expect(getterF.element.isDeprecated, isTrue); 3542 expect(getterF.element.isDeprecated, isTrue);
3540 expect(getterF.element.isPrivate, isFalse); 3543 expect(getterF.element.isPrivate, isFalse);
3541 expect(getterF.element.parameters, isNull); 3544 expect(getterF.element.parameters, isNull);
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
4699 assertNotSuggested('bar2'); 4702 assertNotSuggested('bar2');
4700 assertNotSuggested('_B'); 4703 assertNotSuggested('_B');
4701 assertSuggestLocalClass('Y'); 4704 assertSuggestLocalClass('Y');
4702 assertSuggestLocalClass('C'); 4705 assertSuggestLocalClass('C');
4703 assertSuggestLocalVariable('f', null); 4706 assertSuggestLocalVariable('f', null);
4704 assertNotSuggested('x'); 4707 assertNotSuggested('x');
4705 assertNotSuggested('e'); 4708 assertNotSuggested('e');
4706 }); 4709 });
4707 } 4710 }
4708 } 4711 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698