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

Unified Diff: pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart

Issue 1989393002: Code completion improvement. Recommend all 'E.x' where E is an enum, also, filter out only the cor… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
index ef909521b0d321037ea2ea83f3c8c0075663ddd9..5740cadb2eca9c7ab5af76157a71f7d536eda409 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
@@ -355,21 +355,19 @@ void main() {expect(foo: ^)}''');
expect(replacementLength, 0);
assertSuggestTopLevelVar('a', 'A',
relevance:
- DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE + DART_RELEVANCE_INCREMENT);
+ DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE + DART_RELEVANCE_INCREMENT);
assertSuggestTopLevelVar('b', 'B',
relevance:
- DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE + DART_RELEVANCE_INCREMENT);
+ DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE + DART_RELEVANCE_INCREMENT);
assertSuggestTopLevelVar('c', 'C',
relevance:
- DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE + DART_RELEVANCE_INCREMENT);
+ DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE + DART_RELEVANCE_INCREMENT);
assertSuggestTopLevelVar('d', 'D',
relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE);
assertSuggestTopLevelVar('e', 'E',
relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE);
}
-
-
test_AsExpression_type() async {
// SimpleIdentifier TypeName AsExpression
addTestSource('''
@@ -1929,6 +1927,8 @@ class A {a(blat: ^) { }}''');
addTestSource('enum E { one, two } main() {^}');
await computeSuggestions();
assertSuggestEnum('E');
+ assertSuggestEnumConst('E.one');
+ assertSuggestEnumConst('E.two');
assertNotSuggested('one');
assertNotSuggested('two');
}
@@ -1937,10 +1937,38 @@ class A {a(blat: ^) { }}''');
addTestSource('@deprecated enum E { one, two } main() {^}');
await computeSuggestions();
assertSuggestEnum('E', isDeprecated: true);
+ assertSuggestEnumConst('E.one', isDeprecated: true);
+ assertSuggestEnumConst('E.two', isDeprecated: true);
assertNotSuggested('one');
assertNotSuggested('two');
}
+ test_enum_filter() async {
+ // SimpleIdentifier NamedExpression ArgumentList
+ // InstanceCreationExpression
+ addTestSource('''
+ enum E { one, two }
+ enum F { three, four }
+ class A {}
+ class B {
+ B({E someE});
+ }
+ A a = new A();
+ B b = new B(someE: ^);
+ ''');
+ await computeSuggestions();
+
+ expect(replacementOffset, completionOffset);
+ expect(replacementLength, 0);
+ assertSuggestEnumConst('E.one',
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ assertSuggestEnumConst('E.two',
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ assertNotSuggested('a');
+ assertNotSuggested('F.three');
+ assertNotSuggested('F.four');
+ }
+
test_ExpressionStatement_identifier() async {
// SimpleIdentifier ExpressionStatement Block
addSource(
« no previous file with comments | « pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698