| 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.computer.dart.arglist; | 5 library services.completion.computer.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; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 paramTypes.add(_getParamType(param)); | 172 paramTypes.add(_getParamType(param)); |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 completion.write(')'); | 176 completion.write(')'); |
| 177 CompletionSuggestion suggestion = new CompletionSuggestion( | 177 CompletionSuggestion suggestion = new CompletionSuggestion( |
| 178 CompletionSuggestionKind.ARGUMENT_LIST, DART_RELEVANCE_HIGH, | 178 CompletionSuggestionKind.ARGUMENT_LIST, DART_RELEVANCE_HIGH, |
| 179 completion.toString(), completion.length, 0, false, false); | 179 completion.toString(), completion.length, 0, false, false); |
| 180 suggestion.parameterNames = paramNames; | 180 suggestion.parameterNames = paramNames; |
| 181 suggestion.parameterTypes = paramTypes; | 181 suggestion.parameterTypes = paramTypes; |
| 182 request.suggestions.add(suggestion); | 182 request.addSuggestion(suggestion); |
| 183 } | 183 } |
| 184 | 184 |
| 185 String _getParamType(FormalParameter param) { | 185 String _getParamType(FormalParameter param) { |
| 186 TypeName type; | 186 TypeName type; |
| 187 if (param is SimpleFormalParameter) { | 187 if (param is SimpleFormalParameter) { |
| 188 type = param.type; | 188 type = param.type; |
| 189 } | 189 } |
| 190 if (type != null) { | 190 if (type != null) { |
| 191 Identifier id = type.name; | 191 Identifier id = type.name; |
| 192 if (id != null) { | 192 if (id != null) { |
| 193 String name = id.name; | 193 String name = id.name; |
| 194 if (name != null && name.length > 0) { | 194 if (name != null && name.length > 0) { |
| 195 return name; | 195 return name; |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 return 'dynamic'; | 199 return 'dynamic'; |
| 200 } | 200 } |
| 201 } | 201 } |
| OLD | NEW |