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

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

Issue 1538883003: remove internal streaming of results, remove obsolete test, cleanup unused code (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years 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/services/completion/completion_manager.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 653d50990e20dc5c5da5cee90ffd94702d8e58db..a2f3520ad719c5bfc0704f9454e266f2677af836 100644
--- a/pkg/analysis_server/lib/src/domain_completion.dart
+++ b/pkg/analysis_server/lib/src/domain_completion.dart
@@ -207,24 +207,21 @@ class CompletionDomainHandler implements RequestHandler {
}
CompletionRequest completionRequest = new CompletionRequestImpl(context,
server.resourceProvider, server.searchEngine, source, params.offset);
- int notificationCount = 0;
String completionId = (_nextCompletionId++).toString();
- manager.results(completionRequest).listen((CompletionResult result) {
- ++notificationCount;
- bool isLast = result is CompletionResultImpl ? result.isLast : true;
- performance.logElapseTime("notification $notificationCount send", () {
- sendCompletionNotification(completionId, result.replacementOffset,
- result.replacementLength, result.suggestions, isLast);
- });
- if (notificationCount == 1) {
- performance.logFirstNotificationComplete('notification 1 complete');
- performance.suggestionCountFirst = result.suggestions.length;
- }
- if (isLast) {
- performance.notificationCount = notificationCount;
- performance.suggestionCountLast = result.suggestions.length;
- performance.complete();
- }
+ manager
+ .computeSuggestions(completionRequest)
+ .then((CompletionResult result) {
+ const SEND_NOTIFICATION_TAG = 'send notification';
+ performance.logStartTime(SEND_NOTIFICATION_TAG);
+ sendCompletionNotification(completionId, result.replacementOffset,
+ result.replacementLength, result.suggestions);
+ performance.logElapseTime(SEND_NOTIFICATION_TAG);
+
+ performance.notificationCount = 1;
+ performance.logFirstNotificationComplete('notification 1 complete');
+ performance.suggestionCountFirst = result.suggestions.length;
+ performance.suggestionCountLast = result.suggestions.length;
+ performance.complete();
});
// initial response without results
return new CompletionGetSuggestionsResult(completionId)
@@ -255,14 +252,10 @@ class CompletionDomainHandler implements RequestHandler {
/**
* Send completion notification results.
*/
- void sendCompletionNotification(
- String completionId,
- int replacementOffset,
- int replacementLength,
- Iterable<CompletionSuggestion> results,
- bool isLast) {
+ void sendCompletionNotification(String completionId, int replacementOffset,
+ int replacementLength, Iterable<CompletionSuggestion> results) {
server.sendNotification(new CompletionResultsParams(
- completionId, replacementOffset, replacementLength, results, isLast)
+ completionId, replacementOffset, replacementLength, results, true)
.toNotification());
}
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/completion_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698