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

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

Issue 651443006: filter invalid method invocation 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 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/local_computer.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/local_computer.dart b/pkg/analysis_server/lib/src/services/completion/local_computer.dart
index 8d9d2d23aaf0a4d58ef4ca8740c85af8b4146a6d..3fc11ca0b02e1624b1226fa4641a32af555d187f 100644
--- a/pkg/analysis_server/lib/src/services/completion/local_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/local_computer.dart
@@ -213,6 +213,19 @@ class _LocalVisitor extends GeneralizingAstVisitor<dynamic> {
}
@override
+ visitMethodInvocation(MethodInvocation node) {
+ // InvocationComputer adds suggestions for method selector
+ Token period = node.period;
+ if (period != null && period.offset < request.offset) {
+ ArgumentList argumentList = node.argumentList;
+ if (argumentList == null || request.offset <= argumentList.offset) {
+ return;
+ }
+ }
+ visitNode(node);
+ }
+
+ @override
visitNamespaceDirective(NamespaceDirective node) {
// No suggestions
}
@@ -373,12 +386,14 @@ class _LocalVisitor extends GeneralizingAstVisitor<dynamic> {
}
CompletionSuggestion suggestion =
_addSuggestion(classMbr.name, csKind, classMbr.returnType, node);
- suggestion.element = _createElement(
- kind,
- classMbr.name,
- classMbr.returnType,
- classMbr.isAbstract,
- _isDeprecated(classMbr.metadata));
+ if (suggestion != null) {
+ suggestion.element = _createElement(
+ kind,
+ classMbr.name,
+ classMbr.returnType,
+ classMbr.isAbstract,
+ _isDeprecated(classMbr.metadata));
+ }
}
void _addParamListSuggestions(FormalParameterList paramList) {
@@ -422,7 +437,7 @@ class _LocalVisitor extends GeneralizingAstVisitor<dynamic> {
CompletionSuggestionKind kind, TypeName typeName, ClassDeclaration classDecl) {
if (id != null) {
String completion = id.name;
- if (completion != null && completion.length > 0) {
+ if (completion != null && completion.length > 0 && completion != '_') {
CompletionSuggestion suggestion = new CompletionSuggestion(
kind,
CompletionRelevance.DEFAULT,
« 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