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

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

Issue 1255953004: better completions in switch statements (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
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/completion_test_util.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c9d88bcdf847e12d82a9b32e79e9f25549782cd7..7ab13f905ad4310c59b522f6ab723d1fe4cba066 100644
--- a/pkg/analysis_server/lib/src/services/completion/optype.dart
+++ b/pkg/analysis_server/lib/src/services/completion/optype.dart
@@ -543,7 +543,6 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor {
if (identical(entity, node.expression)) {
optype.includeReturnValueSuggestions = true;
optype.includeTypeNameSuggestions = true;
- optype.includeVoidReturnSuggestions = true;
}
}
@@ -553,6 +552,21 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor {
optype.includeReturnValueSuggestions = true;
optype.includeTypeNameSuggestions = true;
}
+ if (identical(entity, node.rightBracket)) {
+ if (node.members.isNotEmpty) {
+ optype.includeReturnValueSuggestions = true;
+ optype.includeTypeNameSuggestions = true;
+ optype.includeVoidReturnSuggestions = true;
+ }
+ }
+ 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;
+ }
+ }
}
@override
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/completion_test_util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698