| 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.dart; | 5 library test.services.completion.dart; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_services/completion/completion_computer.dart'; | 9 import 'package:analysis_services/completion/completion_computer.dart'; |
| 10 import 'package:analysis_services/completion/completion_suggestion.dart'; | 10 import 'package:analysis_services/completion/completion_suggestion.dart'; |
| 11 import 'package:analysis_services/search/search_engine.dart'; | 11 import 'package:analysis_services/search/search_engine.dart'; |
| 12 import 'package:analysis_services/src/completion/imported_type_computer.dart'; | 12 import 'package:analysis_services/src/completion/imported_type_computer.dart'; |
| 13 import 'package:analysis_services/src/completion/keyword_computer.dart'; |
| 13 import 'package:analysis_services/src/completion/invocation_computer.dart'; | 14 import 'package:analysis_services/src/completion/invocation_computer.dart'; |
| 14 import 'package:analysis_services/src/completion/local_computer.dart'; | 15 import 'package:analysis_services/src/completion/local_computer.dart'; |
| 15 import 'package:analyzer/src/generated/ast.dart'; | 16 import 'package:analyzer/src/generated/ast.dart'; |
| 16 import 'package:analyzer/src/generated/element.dart'; | 17 import 'package:analyzer/src/generated/element.dart'; |
| 17 import 'package:analyzer/src/generated/engine.dart'; | 18 import 'package:analyzer/src/generated/engine.dart'; |
| 18 import 'package:analyzer/src/generated/source.dart'; | 19 import 'package:analyzer/src/generated/source.dart'; |
| 19 | 20 |
| 20 /** | 21 /** |
| 21 * Manages code completion for a given Dart file completion request. | 22 * Manages code completion for a given Dart file completion request. |
| 22 */ | 23 */ |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 }); | 74 }); |
| 74 }); | 75 }); |
| 75 } | 76 } |
| 76 | 77 |
| 77 /** | 78 /** |
| 78 * Build and initialize the list of completion computers | 79 * Build and initialize the list of completion computers |
| 79 */ | 80 */ |
| 80 void initComputers() { | 81 void initComputers() { |
| 81 if (computers == null) { | 82 if (computers == null) { |
| 82 computers = [ | 83 computers = [ |
| 84 new KeywordComputer(), |
| 83 new LocalComputer(), | 85 new LocalComputer(), |
| 84 new ImportedTypeComputer(), | 86 new ImportedTypeComputer(), |
| 85 new InvocationComputer()]; | 87 new InvocationComputer()]; |
| 86 } | 88 } |
| 87 computers.forEach((CompletionComputer c) { | 89 computers.forEach((CompletionComputer c) { |
| 88 c.context = context; | 90 c.context = context; |
| 89 c.source = source; | 91 c.source = source; |
| 90 c.offset = offset; | 92 c.offset = offset; |
| 91 c.searchEngine = searchEngine; | 93 c.searchEngine = searchEngine; |
| 92 }); | 94 }); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 111 if (library != null) { | 113 if (library != null) { |
| 112 var unit = context.getResolvedCompilationUnit(source, library); | 114 var unit = context.getResolvedCompilationUnit(source, library); |
| 113 if (unit != null) { | 115 if (unit != null) { |
| 114 return new Future.value(unit); | 116 return new Future.value(unit); |
| 115 } | 117 } |
| 116 } | 118 } |
| 117 //TODO (danrubel) Determine if analysis is complete but unit not resolved | 119 //TODO (danrubel) Determine if analysis is complete but unit not resolved |
| 118 return new Future(waitForAnalysis); | 120 return new Future(waitForAnalysis); |
| 119 } | 121 } |
| 120 } | 122 } |
| OLD | NEW |