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

Side by Side Diff: pkg/analysis_server/lib/src/domain_completion.dart

Issue 1484853002: new DartCompletionPlugin (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
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 domain.completion; 5 library domain.completion;
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/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 ContextSourcePair contextSource = server.getContextSourcePair(params.file); 188 ContextSourcePair contextSource = server.getContextSourcePair(params.file);
189 AnalysisContext context = contextSource.context; 189 AnalysisContext context = contextSource.context;
190 Source source = contextSource.source; 190 Source source = contextSource.source;
191 if (context == null || !context.exists(source)) { 191 if (context == null || !context.exists(source)) {
192 return new Response.unknownSource(request); 192 return new Response.unknownSource(request);
193 } 193 }
194 recordRequest(performance, context, source, params.offset); 194 recordRequest(performance, context, source, params.offset);
195 if (manager == null) { 195 if (manager == null) {
196 manager = completionManagerFor(context, source); 196 manager = completionManagerFor(context, source);
197 } 197 }
198 CompletionRequest completionRequest = 198 CompletionRequest completionRequest = new CompletionRequestImpl(context,
199 new CompletionRequestImpl(server, context, source, params.offset); 199 server.resourceProvider, server.searchEngine, source, params.offset);
200 int notificationCount = 0; 200 int notificationCount = 0;
201 manager.results(completionRequest).listen((CompletionResult result) { 201 manager.results(completionRequest).listen((CompletionResult result) {
202 ++notificationCount; 202 ++notificationCount;
203 bool isLast = result is CompletionResultImpl ? result.isLast : true; 203 bool isLast = result is CompletionResultImpl ? result.isLast : true;
204 performance.logElapseTime("notification $notificationCount send", () { 204 performance.logElapseTime("notification $notificationCount send", () {
205 sendCompletionNotification(completionId, result.replacementOffset, 205 sendCompletionNotification(completionId, result.replacementOffset,
206 result.replacementLength, result.suggestions, isLast); 206 result.replacementLength, result.suggestions, isLast);
207 }); 207 });
208 if (notificationCount == 1) { 208 if (notificationCount == 1) {
209 performance.logFirstNotificationComplete('notification 1 complete'); 209 performance.logFirstNotificationComplete('notification 1 complete');
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 if (_sourcesChangedSubscription != null) { 285 if (_sourcesChangedSubscription != null) {
286 _sourcesChangedSubscription.cancel(); 286 _sourcesChangedSubscription.cancel();
287 _sourcesChangedSubscription = null; 287 _sourcesChangedSubscription = null;
288 } 288 }
289 if (_manager != null) { 289 if (_manager != null) {
290 _manager.dispose(); 290 _manager.dispose();
291 _manager = null; 291 _manager = null;
292 } 292 }
293 } 293 }
294 } 294 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698