Index: pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart |
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart |
index a57319a6dbce03a064a77ff7500771b04d3764b1..448d848148159974d3ccee9e9887348d0f24894c 100644 |
--- a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart |
+++ b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart |
@@ -8,6 +8,7 @@ import 'package:analysis_server/src/protocol_server.dart' as protocol; |
import 'package:analysis_server/src/protocol_server.dart' |
hide Element, ElementKind; |
import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart'; |
+import 'package:analysis_server/src/services/completion/dart/utilities.dart'; |
import 'package:analysis_server/src/utilities/documentation.dart'; |
import 'package:analyzer/dart/element/element.dart'; |
import 'package:analyzer/dart/element/type.dart'; |
@@ -70,13 +71,18 @@ CompletionSuggestion createSuggestion(Element element, |
// Gracefully degrade if type not resolved yet |
return paramType != null ? paramType.displayName : 'var'; |
}).toList(); |
- suggestion.requiredParameterCount = element.parameters |
- .where((ParameterElement parameter) => |
- parameter.parameterKind == ParameterKind.REQUIRED) |
- .length; |
- suggestion.hasNamedParameters = element.parameters.any( |
- (ParameterElement parameter) => |
- parameter.parameterKind == ParameterKind.NAMED); |
+ |
+ Iterable<ParameterElement> requiredParameters = element.parameters.where( |
+ (ParameterElement param) => |
+ param.parameterKind == ParameterKind.REQUIRED); |
+ suggestion.requiredParameterCount = requiredParameters.length; |
+ |
+ Iterable<ParameterElement> namedParameters = element.parameters.where( |
+ (ParameterElement param) => param.parameterKind == ParameterKind.NAMED); |
+ suggestion.hasNamedParameters = namedParameters.isNotEmpty; |
+ |
+ suggestion.defaultArgumentListString = |
+ buildDefaultArgList(requiredParameters, namedParameters); |
} |
if (importForSource != null) { |
String srcPath = path.dirname(importForSource.fullName); |