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.manager; | 5 library services.completion.manager; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
10 import 'package:analysis_server/src/provisional/completion/completion_core.dart' | 10 import 'package:analysis_server/src/provisional/completion/completion_core.dart' |
11 show CompletionRequest, CompletionResult; | 11 show CompletionContributor, CompletionContributorFactory, CompletionRequest,
CompletionResult; |
12 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 12 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
13 import 'package:analysis_server/src/services/search/search_engine.dart'; | 13 import 'package:analysis_server/src/services/search/search_engine.dart'; |
14 import 'package:analyzer/src/generated/engine.dart'; | 14 import 'package:analyzer/src/generated/engine.dart'; |
15 import 'package:analyzer/src/generated/source.dart'; | 15 import 'package:analyzer/src/generated/source.dart'; |
16 | 16 |
17 /** | 17 /** |
18 * [CompletionCache] contains information about the prior code completion | 18 * [CompletionCache] contains information about the prior code completion |
19 * for use in the next code completion. | 19 * for use in the next code completion. |
20 */ | 20 */ |
21 abstract class CompletionCache { | 21 abstract class CompletionCache { |
(...skipping 28 matching lines...) Expand all Loading... |
50 * The controller used for returning completion results. | 50 * The controller used for returning completion results. |
51 */ | 51 */ |
52 StreamController<CompletionResult> controller; | 52 StreamController<CompletionResult> controller; |
53 | 53 |
54 CompletionManager(this.context, this.source); | 54 CompletionManager(this.context, this.source); |
55 | 55 |
56 /** | 56 /** |
57 * Create a manager for the given request. | 57 * Create a manager for the given request. |
58 */ | 58 */ |
59 factory CompletionManager.create( | 59 factory CompletionManager.create( |
60 AnalysisContext context, Source source, SearchEngine searchEngine) { | 60 AnalysisContext context, |
| 61 Source source, |
| 62 SearchEngine searchEngine, |
| 63 Iterable<CompletionContributor> newContributors) { |
61 if (context != null) { | 64 if (context != null) { |
62 if (AnalysisEngine.isDartFileName(source.shortName)) { | 65 if (AnalysisEngine.isDartFileName(source.shortName)) { |
63 return new DartCompletionManager.create(context, searchEngine, source); | 66 return new DartCompletionManager.create( |
64 } | 67 context, searchEngine, source, newContributors); |
65 if (AnalysisEngine.isHtmlFileName(source.shortName)) { | |
66 //TODO (danrubel) implement | |
67 // return new HtmlCompletionManager(context, searchEngine, source, offset
); | |
68 } | 68 } |
69 } | 69 } |
70 return new NoOpCompletionManager(source); | 70 return new NoOpCompletionManager(source); |
71 } | 71 } |
72 | 72 |
73 /** | 73 /** |
74 * Compute and cache information in preparation for a possible code | 74 * Compute and cache information in preparation for a possible code |
75 * completion request sometime in the future. The default implementation | 75 * completion request sometime in the future. The default implementation |
76 * of this method does nothing. Subclasses may override but should not | 76 * of this method does nothing. Subclasses may override but should not |
77 * count on this method being called before [computeSuggestions]. | 77 * count on this method being called before [computeSuggestions]. |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 */ | 271 */ |
272 final String name; | 272 final String name; |
273 | 273 |
274 /** | 274 /** |
275 * The elapse time or `null` if undefined. | 275 * The elapse time or `null` if undefined. |
276 */ | 276 */ |
277 final Duration elapsed; | 277 final Duration elapsed; |
278 | 278 |
279 OperationPerformance(this.name, this.elapsed); | 279 OperationPerformance(this.name, this.elapsed); |
280 } | 280 } |
OLD | NEW |