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

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

Issue 664523003: improve element parameter string returned by local suggestion computer (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
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 3fc11ca0b02e1624b1226fa4641a32af555d187f..19e28f46065ab54e772071813f880431e0b1fe63 100644
--- a/pkg/analysis_server/lib/src/services/completion/local_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/local_computer.dart
@@ -296,6 +296,7 @@ class _LocalVisitor extends GeneralizingAstVisitor<dynamic> {
suggestion.element = _createElement(
protocol.ElementKind.CLASS,
declaration.name,
+ null,
NO_RETURN_TYPE,
declaration.isAbstract,
_isDeprecated(declaration.metadata));
@@ -317,6 +318,7 @@ class _LocalVisitor extends GeneralizingAstVisitor<dynamic> {
suggestion.element = _createElement(
protocol.ElementKind.GETTER,
varDecl.name,
+ '()',
fieldDecl.fields.type,
false,
isDeprecated || _isDeprecated(varDecl.metadata));
@@ -340,6 +342,7 @@ class _LocalVisitor extends GeneralizingAstVisitor<dynamic> {
suggestion.element = _createElement(
protocol.ElementKind.FUNCTION,
declaration.name,
+ declaration.functionExpression.parameters.toSource(),
declaration.returnType,
false,
_isDeprecated(declaration.metadata));
@@ -356,6 +359,7 @@ class _LocalVisitor extends GeneralizingAstVisitor<dynamic> {
suggestion.element = _createElement(
protocol.ElementKind.LOCAL_VARIABLE,
id,
+ null,
returnType,
false,
false);
@@ -368,21 +372,25 @@ class _LocalVisitor extends GeneralizingAstVisitor<dynamic> {
}
protocol.ElementKind kind;
CompletionSuggestionKind csKind;
+ String parameters;
if (classMbr.isGetter) {
kind = protocol.ElementKind.GETTER;
csKind = CompletionSuggestionKind.GETTER;
+ parameters = '()';
} else if (classMbr.isSetter) {
if (excludeVoidReturn) {
return;
}
kind = protocol.ElementKind.SETTER;
csKind = CompletionSuggestionKind.SETTER;
+ parameters = '(${classMbr.returnType.toSource()} value)';
} else {
if (excludeVoidReturn && _isVoid(classMbr.returnType)) {
return;
}
kind = protocol.ElementKind.METHOD;
csKind = CompletionSuggestionKind.METHOD;
+ parameters = classMbr.parameters.toSource();
}
CompletionSuggestion suggestion =
_addSuggestion(classMbr.name, csKind, classMbr.returnType, node);
@@ -390,6 +398,7 @@ class _LocalVisitor extends GeneralizingAstVisitor<dynamic> {
suggestion.element = _createElement(
kind,
classMbr.name,
+ parameters,
classMbr.returnType,
classMbr.isAbstract,
_isDeprecated(classMbr.metadata));
@@ -428,8 +437,13 @@ class _LocalVisitor extends GeneralizingAstVisitor<dynamic> {
CompletionSuggestion suggestion =
_addSuggestion(identifier, CompletionSuggestionKind.PARAMETER, type, null);
if (suggestion != null) {
- suggestion.element =
- _createElement(protocol.ElementKind.PARAMETER, identifier, type, false, false);
+ suggestion.element = _createElement(
+ protocol.ElementKind.PARAMETER,
+ identifier,
+ null,
+ type,
+ false,
+ false);
}
}
@@ -487,6 +501,7 @@ class _LocalVisitor extends GeneralizingAstVisitor<dynamic> {
suggestion.element = _createElement(
protocol.ElementKind.TOP_LEVEL_VARIABLE,
varDecl.name,
+ null,
varList.type,
false,
isDeprecated || _isDeprecated(varDecl.metadata));
@@ -509,7 +524,8 @@ class _LocalVisitor extends GeneralizingAstVisitor<dynamic> {
* Create a new protocol Element for inclusion in a completion suggestion.
*/
protocol.Element _createElement(protocol.ElementKind kind,
- SimpleIdentifier id, TypeName returnType, bool isAbstract, bool isDeprecated) {
+ SimpleIdentifier id, String parameters, TypeName returnType,
+ bool isAbstract, bool isDeprecated) {
String name = id.name;
int flags = protocol.Element.makeFlags(
isAbstract: isAbstract,
@@ -519,6 +535,7 @@ class _LocalVisitor extends GeneralizingAstVisitor<dynamic> {
kind,
name,
flags,
+ parameters: parameters,
returnType: _nameForType(returnType));
}

Powered by Google App Engine
This is Rietveld 408576698