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 d2255d3cedd634cd1318036817d676a853037d2d..ba07b89ac799b4987c07e6de9021cfe755e858c9 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 |
@@ -415,6 +415,37 @@ void main() {new B().bar(^);}'''); |
assertNotSuggested('print'); |
} |
+ test_ArgumentList_namedFieldParam_tear_off() async { |
+ addSource( |
+ '/libA.dart', |
+ ''' |
+typedef void VoidCallback(); |
+ |
+class Button { |
+ final VoidCallback onPressed; |
+ Button({this.onPressed}); |
+} |
+'''); |
+ addTestSource(''' |
+import '/libA.dart'; |
+ |
+class PageState { |
+ void _incrementCounter() { } |
+ build() => |
+ new Button( |
+ onPressed: ^ |
+ ); |
+} |
+'''); |
+ await computeSuggestions(); |
+ |
+ expect(replacementOffset, completionOffset); |
+ expect(replacementLength, 0); |
+ |
+ assertSuggest('_incrementCounter', |
+ csKind: CompletionSuggestionKind.IDENTIFIER); |
+ } |
+ |
test_ArgumentList_namedParam() async { |
// SimpleIdentifier NamedExpression ArgumentList MethodInvocation |
// ExpressionStatement |
@@ -474,6 +505,96 @@ void main() {expect(foo: ^)}'''); |
relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); |
} |
+ test_ArgumentList_namedParam_tear_off() async { |
+ addSource( |
+ '/libA.dart', |
+ ''' |
+typedef void VoidCallback(); |
+ |
+class Button { |
+ Button({VoidCallback onPressed}); |
+} |
+'''); |
+ addTestSource(''' |
+import '/libA.dart'; |
+ |
+class PageState { |
+ void _incrementCounter() { } |
+ build() => |
+ new Button( |
+ onPressed: ^ |
+ ); |
+} |
+'''); |
+ await computeSuggestions(); |
+ |
+ expect(replacementOffset, completionOffset); |
+ expect(replacementLength, 0); |
+ |
+ assertSuggest('_incrementCounter', |
+ csKind: CompletionSuggestionKind.IDENTIFIER); |
+ } |
+ |
+ test_ArgumentList_namedParam_tear_off_1() async { |
+ addSource( |
+ '/libA.dart', |
+ ''' |
+typedef void VoidCallback(); |
+ |
+class Button { |
+ Button({VoidCallback onPressed, int x}); |
+} |
+'''); |
+ addTestSource(''' |
+import '/libA.dart'; |
+ |
+class PageState { |
+ void _incrementCounter() { } |
+ build() => |
+ new Button( |
+ onPressed: ^ |
+ ); |
+} |
+'''); |
+ await computeSuggestions(); |
+ |
+ expect(replacementOffset, completionOffset); |
+ expect(replacementLength, 0); |
+ |
+ assertSuggest('_incrementCounter', |
+ csKind: CompletionSuggestionKind.IDENTIFIER); |
+ } |
+ |
+ test_ArgumentList_namedParam_tear_off_2() async { |
+ addSource( |
+ '/libA.dart', |
+ ''' |
+typedef void VoidCallback(); |
+ |
+class Button { |
+ Button({ int x, VoidCallback onPressed); |
+} |
+'''); |
+ addTestSource(''' |
+import '/libA.dart'; |
+ |
+class PageState { |
+ void _incrementCounter() { } |
+ build() => |
+ new Button( |
+ onPressed: ^ |
+ ); |
+} |
+'''); |
+ await computeSuggestions(); |
+ |
+ expect(replacementOffset, completionOffset); |
+ expect(replacementLength, 0); |
+ |
+ assertSuggest('_incrementCounter', |
+ csKind: CompletionSuggestionKind.IDENTIFIER); |
+ } |
+ |
test_AsExpression_type() async { |
// SimpleIdentifier TypeName AsExpression |
addTestSource(''' |
@@ -2026,7 +2147,6 @@ class A {a(blat: ^) { }}'''); |
assertSuggestClass('A'); |
assertNotSuggested('String'); |
assertNotSuggested('identical'); |
- assertNotSuggested('bar'); |
} |
test_doc_classMember() async { |