| 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.dart; | 5 library services.completion.dart; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart'; | 9 import 'package:analysis_server/src/protocol.dart'; |
| 10 import 'package:analysis_server/src/services/completion/arglist_computer.dart'; | 10 import 'package:analysis_server/src/services/completion/arglist_computer.dart'; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 factory DartCompletionManager.create(AnalysisContext context, | 68 factory DartCompletionManager.create(AnalysisContext context, |
| 69 SearchEngine searchEngine, Source source) { | 69 SearchEngine searchEngine, Source source) { |
| 70 return new DartCompletionManager( | 70 return new DartCompletionManager( |
| 71 context, | 71 context, |
| 72 searchEngine, | 72 searchEngine, |
| 73 source, | 73 source, |
| 74 new DartCompletionCache(context, source)); | 74 new DartCompletionCache(context, source)); |
| 75 } | 75 } |
| 76 | 76 |
| 77 @override | 77 @override |
| 78 void computeCache() { | 78 Future<bool> computeCache() { |
| 79 waitForAnalysis().then((CompilationUnit unit) { | 79 return waitForAnalysis().then((CompilationUnit unit) { |
| 80 if (unit != null && !cache.isImportInfoCached(unit)) { | 80 if (unit != null && !cache.isImportInfoCached(unit)) { |
| 81 cache.computeImportInfo(unit, searchEngine); | 81 return cache.computeImportInfo(unit, searchEngine); |
| 82 } else { |
| 83 return new Future.value(false); |
| 82 } | 84 } |
| 83 }); | 85 }); |
| 84 } | 86 } |
| 85 | 87 |
| 86 /** | 88 /** |
| 87 * Compute suggestions based upon cached information only | 89 * Compute suggestions based upon cached information only |
| 88 * then send an initial response to the client. | 90 * then send an initial response to the client. |
| 89 * Return a list of computers for which [computeFull] should be called | 91 * Return a list of computers for which [computeFull] should be called |
| 90 */ | 92 */ |
| 91 List<DartCompletionComputer> computeFast(DartCompletionRequest request) { | 93 List<DartCompletionComputer> computeFast(DartCompletionRequest request) { |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 _ReplacementOffsetBuilder(this.request) { | 281 _ReplacementOffsetBuilder(this.request) { |
| 280 request.replacementOffset = request.offset; | 282 request.replacementOffset = request.offset; |
| 281 request.replacementLength = 0; | 283 request.replacementLength = 0; |
| 282 } | 284 } |
| 283 | 285 |
| 284 visitSimpleIdentifier(SimpleIdentifier node) { | 286 visitSimpleIdentifier(SimpleIdentifier node) { |
| 285 request.replacementOffset = node.offset; | 287 request.replacementOffset = node.offset; |
| 286 request.replacementLength = node.length; | 288 request.replacementLength = node.length; |
| 287 } | 289 } |
| 288 } | 290 } |
| OLD | NEW |