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

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

Issue 1044463004: Gracefully degrade if no source for completion (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Gracefully degrade if no source for completion Created 5 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/protocol.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 Response processRequest(Request request, [CompletionManager manager]) { 170 Response processRequest(Request request, [CompletionManager manager]) {
171 performance = new CompletionPerformance(); 171 performance = new CompletionPerformance();
172 // extract params 172 // extract params
173 CompletionGetSuggestionsParams params = 173 CompletionGetSuggestionsParams params =
174 new CompletionGetSuggestionsParams.fromRequest(request); 174 new CompletionGetSuggestionsParams.fromRequest(request);
175 // schedule completion analysis 175 // schedule completion analysis
176 String completionId = (_nextCompletionId++).toString(); 176 String completionId = (_nextCompletionId++).toString();
177 ContextSourcePair contextSource = server.getContextSourcePair(params.file); 177 ContextSourcePair contextSource = server.getContextSourcePair(params.file);
178 AnalysisContext context = contextSource.context; 178 AnalysisContext context = contextSource.context;
179 Source source = contextSource.source; 179 Source source = contextSource.source;
180 if (!context.exists(source)) {
scheglov 2015/03/30 21:10:48 Actually it is not guaranteed that AnalysisContext
danrubel 2015/03/30 21:40:48 Good catch. Fixed.
181 return new Response.unknownSource(request);
182 }
180 recordRequest(performance, context, source, params.offset); 183 recordRequest(performance, context, source, params.offset);
181 if (manager == null) { 184 if (manager == null) {
182 manager = completionManagerFor(context, source); 185 manager = completionManagerFor(context, source);
183 } 186 }
184 CompletionRequest completionRequest = 187 CompletionRequest completionRequest =
185 new CompletionRequest(params.offset, performance); 188 new CompletionRequest(params.offset, performance);
186 int notificationCount = 0; 189 int notificationCount = 0;
187 manager.results(completionRequest).listen((CompletionResult result) { 190 manager.results(completionRequest).listen((CompletionResult result) {
188 ++notificationCount; 191 ++notificationCount;
189 performance.logElapseTime("notification $notificationCount send", () { 192 performance.logElapseTime("notification $notificationCount send", () {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 if (_sourcesChangedSubscription != null) { 270 if (_sourcesChangedSubscription != null) {
268 _sourcesChangedSubscription.cancel(); 271 _sourcesChangedSubscription.cancel();
269 _sourcesChangedSubscription = null; 272 _sourcesChangedSubscription = null;
270 } 273 }
271 if (_manager != null) { 274 if (_manager != null) {
272 _manager.dispose(); 275 _manager.dispose();
273 _manager = null; 276 _manager = null;
274 } 277 }
275 } 278 }
276 } 279 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/protocol.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698