Skip to content

Commit 309ba3b

Browse files
FMorschelCommit Queue
authored andcommitted
[DAS] Fixes keyword completion inside map literal value
[email protected] Fixes #57032 Change-Id: I4703fdafc7986d20a40a18b729a4c66eaafff87a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393940 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]> Auto-Submit: Felipe Morschel <[email protected]> Reviewed-by: Keerti Parthasarathy <[email protected]>
1 parent e565488 commit 309ba3b

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

pkg/analysis_server/lib/src/services/completion/dart/in_scope_completion_pass.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,9 +1840,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
18401840
collector.completionLocation = 'NullAwareElement_value';
18411841
} else if (offset >= node.separator.end) {
18421842
collector.completionLocation = 'MapLiteralEntry_value';
1843-
declarationHelper(
1844-
mustBeStatic: node.inStaticContext,
1845-
).addLexicalDeclarations(node);
1843+
_forExpression(node, mustBeNonVoid: true);
18461844
}
18471845
}
18481846

pkg/analysis_server/test/services/completion/dart/location/map_literal_test.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,25 @@ suggestions
106106
kind: keyword
107107
switch
108108
kind: keyword
109+
''');
110+
}
111+
112+
Future<void> test_inside_value_keyword() async {
113+
await computeSuggestions('''
114+
void f() => <String, int>{"": ^};
115+
''');
116+
assertResponse(r'''
117+
suggestions
118+
null
119+
kind: keyword
120+
false
121+
kind: keyword
122+
true
123+
kind: keyword
124+
const
125+
kind: keyword
126+
switch
127+
kind: keyword
109128
''');
110129
}
111130
}

0 commit comments

Comments
 (0)