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

Unified Diff: pkg/analysis_server/lib/src/services/completion/optype.dart

Issue 1273773005: fix completion after dot-keyword - fixes #23882 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years, 4 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
Index: pkg/analysis_server/lib/src/services/completion/optype.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/optype.dart b/pkg/analysis_server/lib/src/services/completion/optype.dart
index 7ab13f905ad4310c59b522f6ab723d1fe4cba066..76967312eff1e86e8bccc0fd54800643b12b15a6 100644
--- a/pkg/analysis_server/lib/src/services/completion/optype.dart
+++ b/pkg/analysis_server/lib/src/services/completion/optype.dart
@@ -472,7 +472,13 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor {
@override
void visitPrefixedIdentifier(PrefixedIdentifier node) {
- if (identical(entity, node.identifier)) {
+ if (identical(entity, node.identifier) ||
+ // In addition to the standard case,
+ // handle the exceptional case where the parser considers the would-be
+ // identifier to be a keyword and inserts a synthetic identifier
+ (node.identifier != null &&
+ node.identifier.isSynthetic &&
+ identical(entity, node.identifier.beginToken.previous))) {
optype.isPrefixed = true;
if (node.parent is TypeName && node.parent.parent is ConstructorName) {
optype.includeConstructorSuggestions = true;
@@ -562,9 +568,9 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor {
if (entity is SwitchMember && entity != node.members.first) {
SwitchMember member = entity as SwitchMember;
if (offset <= member.offset) {
- optype.includeReturnValueSuggestions = true;
- optype.includeTypeNameSuggestions = true;
- optype.includeVoidReturnSuggestions = true;
+ optype.includeReturnValueSuggestions = true;
+ optype.includeTypeNameSuggestions = true;
+ optype.includeVoidReturnSuggestions = true;
}
}
}

Powered by Google App Engine
This is Rietveld 408576698