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 test.services.completion.toplevel; | 5 library test.services.completion.toplevel; |
6 | 6 |
7 import 'package:analysis_server/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
8 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; | 8 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; |
9 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; | 9 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; |
10 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 10 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 provider.newFile('/context2/foo.dart', content2).createSource(); | 492 provider.newFile('/context2/foo.dart', content2).createSource(); |
493 ChangeSet changeSet = new ChangeSet(); | 493 ChangeSet changeSet = new ChangeSet(); |
494 changeSet.addedSource(source2); | 494 changeSet.addedSource(source2); |
495 context2.applyChanges(changeSet); | 495 context2.applyChanges(changeSet); |
496 context2.setContents(source2, content2); | 496 context2.setContents(source2, content2); |
497 | 497 |
498 // Resolve the source in the 2nd context and update the index | 498 // Resolve the source in the 2nd context and update the index |
499 var result = context2.performAnalysisTask(); | 499 var result = context2.performAnalysisTask(); |
500 while (result.hasMoreWork) { | 500 while (result.hasMoreWork) { |
501 result.changeNotices.forEach((ChangeNotice notice) { | 501 result.changeNotices.forEach((ChangeNotice notice) { |
502 CompilationUnit unit = notice.compilationUnit; | 502 CompilationUnit unit = notice.resolvedDartUnit; |
503 if (unit != null) { | 503 if (unit != null) { |
504 index.indexUnit(context2, unit); | 504 index.indexUnit(context2, unit); |
505 } | 505 } |
506 }); | 506 }); |
507 result = context2.performAnalysisTask(); | 507 result = context2.performAnalysisTask(); |
508 } | 508 } |
509 | 509 |
510 // Check that source in 2nd context does not appear in completion in 1st | 510 // Check that source in 2nd context does not appear in completion in 1st |
511 addSource('/context1/libA.dart', ''' | 511 addSource('/context1/libA.dart', ''' |
512 library libA; | 512 library libA; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 | 588 |
589 @override | 589 @override |
590 test_partFile_TypeName2() { | 590 test_partFile_TypeName2() { |
591 return super.test_partFile_TypeName2().then((_) { | 591 return super.test_partFile_TypeName2().then((_) { |
592 expect( | 592 expect( |
593 request.cache.importKey, | 593 request.cache.importKey, |
594 'library libA;import "/testB.dart";part "/testA.dart";'); | 594 'library libA;import "/testB.dart";part "/testA.dart";'); |
595 }); | 595 }); |
596 } | 596 } |
597 } | 597 } |
OLD | NEW |