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

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

Issue 1005483002: add completion in type argument list (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: format Created 5 years, 9 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_target_test.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 cba56957243a1931b1da0629605c3b439c36503d..5bb865d18556b6e15a5a1fc7936b3aea9d7606cc 100644
--- a/pkg/analysis_server/lib/src/services/completion/optype.dart
+++ b/pkg/analysis_server/lib/src/services/completion/optype.dart
@@ -139,6 +139,22 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor {
@override
void visitBinaryExpression(BinaryExpression node) {
if (identical(entity, node.rightOperand)) {
+ // An empty type argument list is parsed as a binary expression
+ // `C<>` is parsed as `C < `
+ Object entity = this.entity;
+ if (entity is SimpleIdentifier && entity.isSynthetic) {
+ Token operator = node.operator;
+ if (operator != null && operator.lexeme == '<') {
+ Token next = entity.token.next;
+ if (next is StringToken && next.lexeme.length == 0) {
+ next = next.next;
+ }
+ if (next != null && next.lexeme == '>') {
+ optype.includeTypeNameSuggestions = true;
+ return;
+ }
+ }
+ }
optype.includeReturnValueSuggestions = true;
optype.includeTypeNameSuggestions = true;
}
@@ -496,6 +512,17 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor {
}
@override
+ visitTypeArgumentList(TypeArgumentList node) {
+ NodeList<TypeName> arguments = node.arguments;
+ for (TypeName typeName in arguments) {
+ if (identical(entity, typeName)) {
+ optype.includeTypeNameSuggestions = true;
+ break;
+ }
+ }
+ }
+
+ @override
void visitTypeName(TypeName node) {
// The entity won't be the first child entity (node.name), since
// CompletionTarget would have chosen an edge higher in the parse tree. So
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/completion_target_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698