| 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' hide Element, | 9 import 'package:analysis_server/src/protocol_server.dart' hide Element, |
| 10 ElementKind; | 10 ElementKind; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 } | 178 } |
| 179 completion.write(name); | 179 completion.write(name); |
| 180 paramNames.add(name); | 180 paramNames.add(name); |
| 181 paramTypes.add(_getParamType(param)); | 181 paramTypes.add(_getParamType(param)); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 completion.write(')'); | 185 completion.write(')'); |
| 186 CompletionSuggestion suggestion = new CompletionSuggestion( | 186 CompletionSuggestion suggestion = new CompletionSuggestion( |
| 187 CompletionSuggestionKind.ARGUMENT_LIST, | 187 CompletionSuggestionKind.ARGUMENT_LIST, |
| 188 COMPLETION_RELEVANCE_HIGH, | 188 DART_RELEVANCE_HIGH, |
| 189 completion.toString(), | 189 completion.toString(), |
| 190 completion.length, | 190 completion.length, |
| 191 0, | 191 0, |
| 192 false, | 192 false, |
| 193 false); | 193 false); |
| 194 suggestion.parameterNames = paramNames; | 194 suggestion.parameterNames = paramNames; |
| 195 suggestion.parameterTypes = paramTypes; | 195 suggestion.parameterTypes = paramTypes; |
| 196 request.suggestions.add(suggestion); | 196 request.suggestions.add(suggestion); |
| 197 } | 197 } |
| 198 | 198 |
| 199 String _getParamType(FormalParameter param) { | 199 String _getParamType(FormalParameter param) { |
| 200 TypeName type; | 200 TypeName type; |
| 201 if (param is SimpleFormalParameter) { | 201 if (param is SimpleFormalParameter) { |
| 202 type = param.type; | 202 type = param.type; |
| 203 } | 203 } |
| 204 if (type != null) { | 204 if (type != null) { |
| 205 Identifier id = type.name; | 205 Identifier id = type.name; |
| 206 if (id != null) { | 206 if (id != null) { |
| 207 String name = id.name; | 207 String name = id.name; |
| 208 if (name != null && name.length > 0) { | 208 if (name != null && name.length > 0) { |
| 209 return name; | 209 return name; |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 return 'dynamic'; | 213 return 'dynamic'; |
| 214 } | 214 } |
| 215 } | 215 } |
| OLD | NEW |