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

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

Issue 1157113004: add enum suggestions (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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_suggestion_builder.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/local_suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/local_suggestion_builder.dart
index 8014dd4322902693c1c311da25ead76da77b403d..73bf1619cb1960c45af591a2d022f4f204778627 100644
--- a/pkg/analysis_server/lib/src/services/completion/local_suggestion_builder.dart
+++ b/pkg/analysis_server/lib/src/services/completion/local_suggestion_builder.dart
@@ -20,15 +20,16 @@ final TypeName NO_RETURN_TYPE = new TypeName(
* Create a new protocol Element for inclusion in a completion suggestion.
*/
protocol.Element createElement(protocol.ElementKind kind, SimpleIdentifier id,
- {String parameters, TypeName returnType, bool isAbstract: false,
- bool isDeprecated: false}) {
+ {String parameters, TypeName returnType, SimpleIdentifier enumName,
+ bool isAbstract: false, bool isDeprecated: false}) {
String name = id != null ? id.name : '';
int flags = protocol.Element.makeFlags(
isAbstract: isAbstract,
isDeprecated: isDeprecated,
isPrivate: Identifier.isPrivateName(name));
+ String typeName = enumName != null ? enumName.name : nameForType(returnType);
Paul Berry 2015/05/29 17:55:57 It's not clear to me why this is necessary. Won't
danrubel 2015/06/01 04:26:56 Oops. That's left over from an earlier refactoring
return new protocol.Element(kind, name, flags,
- parameters: parameters, returnType: nameForType(returnType));
+ parameters: parameters, returnType: typeName);
}
/**
@@ -51,8 +52,8 @@ CompletionSuggestion createFieldSuggestion(
* Return the new suggestion or `null` if it could not be created.
*/
CompletionSuggestion createSuggestion(SimpleIdentifier id, bool isDeprecated,
- int defaultRelevance, TypeName returnType,
- {ClassDeclaration classDecl, protocol.Element element}) {
+ int defaultRelevance, TypeName returnType, {ClassDeclaration classDecl,
+ SimpleIdentifier enumName, protocol.Element element}) {
if (id == null) {
return null;
}
@@ -64,7 +65,8 @@ CompletionSuggestion createSuggestion(SimpleIdentifier id, bool isDeprecated,
CompletionSuggestionKind.INVOCATION,
isDeprecated ? DART_RELEVANCE_LOW : defaultRelevance, completion,
completion.length, 0, isDeprecated, false,
- returnType: nameForType(returnType), element: element);
+ returnType: enumName != null ? enumName.name : nameForType(returnType),
Paul Berry 2015/05/29 17:55:57 Same question here.
danrubel 2015/06/01 04:26:56 As above, old unused code. Removed.
+ element: element);
if (classDecl != null) {
SimpleIdentifier classId = classDecl.name;
if (classId != null) {

Powered by Google App Engine
This is Rietveld 408576698