| 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 */ | 68 */ |
| 69 factory DartCompletionManager.create(AnalysisContext context, | 69 factory DartCompletionManager.create(AnalysisContext context, |
| 70 SearchEngine searchEngine, Source source) { | 70 SearchEngine searchEngine, Source source) { |
| 71 return new DartCompletionManager( | 71 return new DartCompletionManager( |
| 72 context, | 72 context, |
| 73 searchEngine, | 73 searchEngine, |
| 74 source, | 74 source, |
| 75 new DartCompletionCache(context, source)); | 75 new DartCompletionCache(context, source)); |
| 76 } | 76 } |
| 77 | 77 |
| 78 @override |
| 79 void computeCache() { |
| 80 waitForAnalysis().then((CompilationUnit unit) { |
| 81 if (unit != null && !cache.isImportInfoCached(unit)) { |
| 82 cache.computeImportInfo(unit, searchEngine); |
| 83 } |
| 84 }); |
| 85 } |
| 86 |
| 78 /** | 87 /** |
| 79 * Compute suggestions based upon cached information only | 88 * Compute suggestions based upon cached information only |
| 80 * then send an initial response to the client. | 89 * then send an initial response to the client. |
| 81 * Return a list of computers for which [computeFull] should be called | 90 * Return a list of computers for which [computeFull] should be called |
| 82 */ | 91 */ |
| 83 List<DartCompletionComputer> computeFast(DartCompletionRequest request) { | 92 List<DartCompletionComputer> computeFast(DartCompletionRequest request) { |
| 84 return request.performance.logElapseTime('computeFast', () { | 93 return request.performance.logElapseTime('computeFast', () { |
| 85 CompilationUnit unit = context.parseCompilationUnit(source); | 94 CompilationUnit unit = context.parseCompilationUnit(source); |
| 86 request.unit = unit; | 95 request.unit = unit; |
| 87 request.node = new NodeLocator.con1(request.offset).searchWithin(unit); | 96 request.node = new NodeLocator.con1(request.offset).searchWithin(unit); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 _ReplacementOffsetBuilder(this.request) { | 267 _ReplacementOffsetBuilder(this.request) { |
| 259 request.replacementOffset = request.offset; | 268 request.replacementOffset = request.offset; |
| 260 request.replacementLength = 0; | 269 request.replacementLength = 0; |
| 261 } | 270 } |
| 262 | 271 |
| 263 visitSimpleIdentifier(SimpleIdentifier node) { | 272 visitSimpleIdentifier(SimpleIdentifier node) { |
| 264 request.replacementOffset = node.offset; | 273 request.replacementOffset = node.offset; |
| 265 request.replacementLength = node.length; | 274 request.replacementLength = node.length; |
| 266 } | 275 } |
| 267 } | 276 } |
| OLD | NEW |