| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analysis_server/protocol/protocol_generated.dart'; | 7 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| 8 import 'package:analysis_server/src/ide_options.dart'; | 8 import 'package:analysis_server/src/ide_options.dart'; |
| 9 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 9 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
| 10 import 'package:analysis_server/src/services/completion/completion_core.dart'; | 10 import 'package:analysis_server/src/services/completion/completion_core.dart'; |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 context.performAnalysisTask(); | 467 context.performAnalysisTask(); |
| 468 // We use a delayed future to allow microtask events to finish. The | 468 // We use a delayed future to allow microtask events to finish. The |
| 469 // Future.value or Future() constructors use scheduleMicrotask themselves an
d | 469 // Future.value or Future() constructors use scheduleMicrotask themselves an
d |
| 470 // would therefore not wait for microtask callbacks that are scheduled after | 470 // would therefore not wait for microtask callbacks that are scheduled after |
| 471 // invoking this method. | 471 // invoking this method. |
| 472 return new Future.delayed( | 472 return new Future.delayed( |
| 473 Duration.ZERO, () => computeLibrariesContaining(times - 1)); | 473 Duration.ZERO, () => computeLibrariesContaining(times - 1)); |
| 474 } | 474 } |
| 475 | 475 |
| 476 Future computeSuggestions({int times = 200, IdeOptions options}) async { | 476 Future computeSuggestions({int times = 200, IdeOptions options}) async { |
| 477 AnalysisResult analysisResult = null; | 477 AnalysisResult analysisResult = await driver.getResult(testFile); |
| 478 if (enableNewAnalysisDriver) { | 478 testSource = analysisResult.unit.element.source; |
| 479 analysisResult = await driver.getResult(testFile); | |
| 480 testSource = analysisResult.unit.element.source; | |
| 481 } else { | |
| 482 context.analysisPriorityOrder = [testSource]; | |
| 483 } | |
| 484 CompletionRequestImpl baseRequest = new CompletionRequestImpl( | 479 CompletionRequestImpl baseRequest = new CompletionRequestImpl( |
| 485 analysisResult, | 480 analysisResult, |
| 486 enableNewAnalysisDriver ? null : context, | |
| 487 provider, | 481 provider, |
| 488 testSource, | 482 testSource, |
| 489 completionOffset, | 483 completionOffset, |
| 490 new CompletionPerformance(), | 484 new CompletionPerformance(), |
| 491 options); | 485 options); |
| 492 | 486 |
| 493 // Build the request | 487 // Build the request |
| 494 Completer<DartCompletionRequest> requestCompleter = | 488 Completer<DartCompletionRequest> requestCompleter = |
| 495 new Completer<DartCompletionRequest>(); | 489 new Completer<DartCompletionRequest>(); |
| 496 DartCompletionRequestImpl | 490 DartCompletionRequestImpl |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 context.computeResult(target, RESOLVED_UNIT); | 615 context.computeResult(target, RESOLVED_UNIT); |
| 622 } | 616 } |
| 623 } | 617 } |
| 624 | 618 |
| 625 @override | 619 @override |
| 626 void setUp() { | 620 void setUp() { |
| 627 super.setUp(); | 621 super.setUp(); |
| 628 contributor = createContributor(); | 622 contributor = createContributor(); |
| 629 } | 623 } |
| 630 } | 624 } |
| OLD | NEW |