Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(707)

Unified Diff: pkg/analysis_server/lib/src/domain_completion.dart

Issue 729193002: add code completion cache (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/get_handler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/domain_completion.dart
diff --git a/pkg/analysis_server/lib/src/domain_completion.dart b/pkg/analysis_server/lib/src/domain_completion.dart
index cdda8f2eee631923920335a0d728b29ad19a9889..e9ee80f32b2fff2935c83cf2e367b037794310cb 100644
--- a/pkg/analysis_server/lib/src/domain_completion.dart
+++ b/pkg/analysis_server/lib/src/domain_completion.dart
@@ -9,6 +9,9 @@ import 'package:analysis_server/src/constants.dart';
import 'package:analysis_server/src/protocol.dart';
import 'package:analysis_server/src/services/completion/completion_manager.dart';
+export 'package:analysis_server/src/services/completion/completion_manager.dart'
+ show CompletionPerformance, OperationPerformance;
+
/**
* Instances of the class [CompletionDomainHandler] implement a [RequestHandler]
* that handles requests in the search domain.
@@ -25,6 +28,13 @@ class CompletionDomainHandler implements RequestHandler {
int _nextCompletionId = 0;
/**
+ * Cached information from a prior completion operation.
+ * The type of cached information depends upon the completion operation.
+ */
+ // TODO (danrubel) clear cache if either source or context changes
+ CompletionCache _cache;
+
+ /**
* Code completion peformance for the last completion operation.
*/
CompletionPerformance performance;
@@ -57,12 +67,14 @@ class CompletionDomainHandler implements RequestHandler {
new CompletionGetSuggestionsParams.fromRequest(request);
// schedule completion analysis
String completionId = (_nextCompletionId++).toString();
- CompletionManager.create(
+ CompletionManager manager = new CompletionManager.create(
server.getAnalysisContext(params.file),
server.getSource(params.file),
params.offset,
server.searchEngine,
- performance).results().listen((CompletionResult result) {
+ _cache,
+ performance);
+ manager.results().listen((CompletionResult result) {
sendCompletionNotification(
completionId,
result.replacementOffset,
@@ -71,6 +83,7 @@ class CompletionDomainHandler implements RequestHandler {
result.last);
if (result.last) {
performance.complete();
+ _cache = manager.completionCache;
}
});
// initial response without results
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/get_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698