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

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

Issue 436263002: incremental progress reworking code completion manager / computers (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address comments Created 6 years, 4 months 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/test/domain_completion_test.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 2a70a9498800d07746092477dc939e49cfd49fc3..0cd17da79e55dce2c758a8b2845af9069477b254 100644
--- a/pkg/analysis_server/lib/src/domain_completion.dart
+++ b/pkg/analysis_server/lib/src/domain_completion.dart
@@ -10,7 +10,6 @@ import 'package:analysis_server/src/protocol.dart';
import 'package:analysis_services/completion/completion_computer.dart';
import 'package:analysis_services/completion/completion_suggestion.dart';
import 'package:analysis_services/constants.dart';
-import 'package:analyzer/src/generated/java_io.dart';
import 'package:analyzer/src/generated/source_io.dart';
/**
@@ -56,23 +55,16 @@ class CompletionDomainHandler implements RequestHandler {
// schedule completion analysis
String completionId = (_nextCompletionId++).toString();
Source source = server.getSource(file);
- CompletionManager manager =
- CompletionManager.create(source, offset, server.searchEngine);
- manager.generate().then((List<CompletionComputer> computers) {
- int count = computers.length;
- List<CompletionSuggestion> results = new List<CompletionSuggestion>();
- computers.forEach((CompletionComputer c) {
- c.compute().then((List<CompletionSuggestion> partialResults) {
- // send aggregate results as we compute them
- results.addAll(partialResults);
- sendCompletionNotification(
- manager.replacementOffset,
- manager.replacementLength,
- completionId,
- --count == 0,
- results);
- });
- });
+ CompletionManager.create(
+ source,
+ offset,
+ server.searchEngine).results().listen((CompletionResult result) {
+ sendCompletionNotification(
+ completionId,
+ result.replacementOffset,
+ result.replacementLength,
+ result.suggestions,
+ result.last);
});
// initial response without results
return new Response(request.id)..setResult(ID, completionId);
@@ -81,8 +73,8 @@ class CompletionDomainHandler implements RequestHandler {
/**
* Send completion notification results.
*/
- void sendCompletionNotification(int replacementOffset, int replacementLength,
- String completionId, bool isLast, Iterable<CompletionSuggestion> results) {
+ void sendCompletionNotification(String completionId, int replacementOffset,
+ int replacementLength, Iterable<CompletionSuggestion> results, bool isLast) {
Notification notification = new Notification(COMPLETION_RESULTS);
notification.setParameter(ID, completionId);
notification.setParameter(REPLACEMENT_OFFSET, replacementOffset);
« no previous file with comments | « no previous file | pkg/analysis_server/test/domain_completion_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698