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

Side by Side Diff: pkg/analysis_server/lib/src/services/completion/invocation_computer.dart

Issue 651953006: improve method invocation and string interpolation suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library services.completion.computer.dart.invocation; 5 library services.completion.computer.dart.invocation;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart'; 9 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart';
10 import 'package:analysis_server/src/services/completion/suggestion_builder.dart' ; 10 import 'package:analysis_server/src/services/completion/suggestion_builder.dart' ;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 Future<bool> visitConstructorName(ConstructorName node) { 43 Future<bool> visitConstructorName(ConstructorName node) {
44 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName 44 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
45 Token period = node.period; 45 Token period = node.period;
46 if (period != null && period.end <= request.offset) { 46 if (period != null && period.end <= request.offset) {
47 return _addNamedConstructorSuggestions(node); 47 return _addNamedConstructorSuggestions(node);
48 } 48 }
49 return super.visitConstructorName(node); 49 return super.visitConstructorName(node);
50 } 50 }
51 51
52 @override 52 @override
53 Future<bool> visitMethodInvocation(MethodInvocation node) {
54 Token period = node.period;
55 if (period == null || period.offset < request.offset) {
56 _addExpressionSuggestions(node.target);
57 }
58 return new Future.value(false);
59 }
60
61 @override
53 Future<bool> visitNode(AstNode node) { 62 Future<bool> visitNode(AstNode node) {
54 return new Future.value(false); 63 return new Future.value(false);
55 } 64 }
56 65
57 @override 66 @override
58 Future<bool> visitPrefixedIdentifier(PrefixedIdentifier node) { 67 Future<bool> visitPrefixedIdentifier(PrefixedIdentifier node) {
59 if (request.offset > node.period.offset) { 68 if (request.offset > node.period.offset) {
60 SimpleIdentifier prefix = node.prefix; 69 SimpleIdentifier prefix = node.prefix;
61 if (prefix != null) { 70 if (prefix != null) {
62 return _addElementSuggestions(prefix.bestElement); 71 return _addElementSuggestions(prefix.bestElement);
63 } 72 }
64 } 73 }
65 return super.visitPrefixedIdentifier(node); 74 return super.visitPrefixedIdentifier(node);
66 } 75 }
67 76
68 @override 77 @override
69 Future<bool> visitPropertyAccess(PropertyAccess node) { 78 Future<bool> visitPropertyAccess(PropertyAccess node) {
70 if (request.offset > node.offset) { 79 Token operator = node.operator;
80 if (operator != null && operator.offset < request.offset) {
71 return _addExpressionSuggestions(node.realTarget); 81 return _addExpressionSuggestions(node.realTarget);
72 } 82 }
73 return super.visitPropertyAccess(node); 83 return super.visitPropertyAccess(node);
74 } 84 }
75 85
76 @override 86 @override
77 Future<bool> visitSimpleIdentifier(SimpleIdentifier node) { 87 Future<bool> visitSimpleIdentifier(SimpleIdentifier node) {
78 return node.parent.accept(this); 88 return node.parent.accept(this);
79 } 89 }
80 90
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 163
154 @override 164 @override
155 Future<bool> visitVariableElement(VariableElement element) { 165 Future<bool> visitVariableElement(VariableElement element) {
156 DartType type = element.type; 166 DartType type = element.type;
157 if (type != null) { 167 if (type != null) {
158 ClassElementSuggestionBuilder.suggestionsFor(request, type.element); 168 ClassElementSuggestionBuilder.suggestionsFor(request, type.element);
159 } 169 }
160 return new Future.value(true); 170 return new Future.value(true);
161 } 171 }
162 } 172 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698