This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
lib/src/services/completion/dart
test/services/completion/dart Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -513,12 +513,15 @@ class _KeywordVisitor extends GeneralizingAstVisitor<void> {
513
513
514
514
@override
515
515
void visitMethodInvocation (MethodInvocation node) {
516
- if (entity == node.methodName || entity == node.argumentList) {
517
- // no keywords in '.' expressions or type argument lists
516
+ if (entity == node.methodName) {
517
+ // no keywords in '.' expressions
518
+ } else if (entity == node.argumentList) {
518
519
// Note that we're checking the argumentList rather than the typeArgumentList
519
520
// as you'd expect. For some reason, when the cursor is in a type argument
520
521
// list (f<^>()), the entity is the invocation's argumentList...
521
522
// See similar logic in `imported_reference_contributor`.
523
+
524
+ _addSuggestion (Keyword .DYNAMIC );
522
525
} else {
523
526
super .visitMethodInvocation (node);
524
527
}
@@ -658,6 +661,11 @@ class _KeywordVisitor extends GeneralizingAstVisitor<void> {
658
661
return visitStatement (node);
659
662
}
660
663
664
+ @override
665
+ void visitTypeArgumentList (TypeArgumentList node) {
666
+ _addSuggestion (Keyword .DYNAMIC );
667
+ }
668
+
661
669
@override
662
670
void visitVariableDeclaration (VariableDeclaration node) {
663
671
if (entity == node.initializer) {
Original file line number Diff line number Diff line change @@ -2150,6 +2150,12 @@ f() => [...^];
2150
2150
assertSuggestKeywords (statementStartInSwitchOutsideClass);
2151
2151
}
2152
2152
2153
+ Future <void > test_variable_decl_type_args () async {
2154
+ addTestSource ('void m() {List<^> list;}' );
2155
+ await computeSuggestions ();
2156
+ assertSuggestKeywords ([Keyword .DYNAMIC ]);
2157
+ }
2158
+
2153
2159
Future <void > test_while_break_continue () async {
2154
2160
addTestSource ('main() {while (true) {^}}' );
2155
2161
await computeSuggestions ();
@@ -2267,7 +2273,7 @@ void m() {
2267
2273
''' );
2268
2274
2269
2275
await computeSuggestions ();
2270
- assertSuggestKeywords ([]);
2276
+ assertSuggestKeywords ([Keyword . DYNAMIC ]);
2271
2277
}
2272
2278
}
2273
2279
You can’t perform that action at this time.
0 commit comments