OLD | NEW |
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.contributor.dart.arglist; | 5 library services.completion.contributor.dart.arglist; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/protocol_server.dart' | 9 import 'package:analysis_server/src/protocol_server.dart' |
10 hide Element, ElementKind; | 10 hide Element, ElementKind; |
11 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 11 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
| 12 import 'package:analyzer/dart/element/element.dart'; |
12 import 'package:analyzer/src/generated/ast.dart'; | 13 import 'package:analyzer/src/generated/ast.dart'; |
13 import 'package:analyzer/src/generated/element.dart'; | |
14 import 'package:analyzer/src/generated/utilities_dart.dart'; | 14 import 'package:analyzer/src/generated/utilities_dart.dart'; |
15 | 15 |
16 /** | 16 /** |
17 * Determine the number of arguments. | 17 * Determine the number of arguments. |
18 */ | 18 */ |
19 int _argCount(DartCompletionRequest request) { | 19 int _argCount(DartCompletionRequest request) { |
20 AstNode node = request.target.containingNode; | 20 AstNode node = request.target.containingNode; |
21 if (node is ArgumentList) { | 21 if (node is ArgumentList) { |
22 return node.arguments.length; | 22 return node.arguments.length; |
23 } | 23 } |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 _addArgListSuggestion(requiredParam); | 253 _addArgListSuggestion(requiredParam); |
254 return; | 254 return; |
255 } | 255 } |
256 if (_isEditingNamedArgLabel(request) || _isAppendingToArgList(request)) { | 256 if (_isEditingNamedArgLabel(request) || _isAppendingToArgList(request)) { |
257 if (requiredCount == 0 || requiredCount < _argCount(request)) { | 257 if (requiredCount == 0 || requiredCount < _argCount(request)) { |
258 _addDefaultParamSuggestions(parameters); | 258 _addDefaultParamSuggestions(parameters); |
259 } | 259 } |
260 } | 260 } |
261 } | 261 } |
262 } | 262 } |
OLD | NEW |