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

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

Issue 802233002: refine when suggestions are limited to types (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge and address comments Created 6 years 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/lib/src/services/completion/local_computer.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/imported_computer.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/imported_computer.dart b/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
index 51d58249d7895fce76efe712641468802827f643..8e98926c0c954a3d5d557712049b5407d29b4f86 100644
--- a/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/imported_computer.dart
@@ -196,7 +196,22 @@ class _ImportedAstVisitor extends
@override
_ImportedSuggestionBuilder visitTypeName(TypeName node) {
- return new _ImportedSuggestionBuilder(request, typesOnly: true);
+ // TODO (danrubel) refactor this and local_computer
+ // to reduce duplicate code
+ bool typesOnly = false;
+ // If suggesting completions within a TypeName node
+ // then limit suggestions to only types in specific situations
+ AstNode p = node.parent;
+ if (p is IsExpression || p is ConstructorName || p is AsExpression) {
+ typesOnly = true;
+ } else if (p is VariableDeclarationList) {
+ // TODO (danrubel) When entering 1st of 2 identifiers on assignment LHS
+ // the user may be either (1) entering a type for the assignment
+ // or (2) starting a new statement.
+ // Consider suggesting only types
+ // if only spaces separates the 1st and 2nd identifiers.
+ }
+ return new _ImportedSuggestionBuilder(request, typesOnly: typesOnly);
}
@override
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/local_computer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698