OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.dart.manager; | 5 library services.completion.dart.manager; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
10 import 'package:analysis_server/src/provisional/completion/completion_core.dart' | 10 import 'package:analysis_server/src/provisional/completion/completion_core.dart' |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } | 224 } |
225 } else { | 225 } else { |
226 libSource = source; | 226 libSource = source; |
227 } | 227 } |
228 | 228 |
229 // Most (all?) contributors need declarations in scope to be resolved | 229 // Most (all?) contributors need declarations in scope to be resolved |
230 if (libSource != null) { | 230 if (libSource != null) { |
231 unit = await new AnalysisFutureHelper<CompilationUnit>(context, | 231 unit = await new AnalysisFutureHelper<CompilationUnit>(context, |
232 new LibrarySpecificUnit(libSource, source), RESOLVED_UNIT3) | 232 new LibrarySpecificUnit(libSource, source), RESOLVED_UNIT3) |
233 .computeAsync(); | 233 .computeAsync(); |
| 234 |
234 } | 235 } |
235 | 236 |
236 return new DartCompletionRequestImpl._( | 237 DartCompletionRequestImpl dartRequest = new DartCompletionRequestImpl._( |
237 request.context, | 238 request.context, |
238 request.resourceProvider, | 239 request.resourceProvider, |
239 request.searchEngine, | 240 request.searchEngine, |
240 libSource, | 241 libSource, |
241 request.source, | 242 request.source, |
242 request.offset, | 243 request.offset, |
243 unit); | 244 unit); |
| 245 |
| 246 // Resolve the expression in which the completion occurs |
| 247 // to properly determine if identifiers should be suggested |
| 248 // rather than invocations. |
| 249 if (dartRequest.target.maybeFunctionalArgument()) { |
| 250 AstNode node = dartRequest.target.containingNode.parent; |
| 251 if (node is Expression) { |
| 252 await dartRequest.resolveExpression(node); |
| 253 } |
| 254 } |
| 255 |
| 256 return dartRequest; |
244 } | 257 } |
245 } | 258 } |
OLD | NEW |