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

Side by Side Diff: pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart

Issue 815683002: support part file completions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 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 | Annotate | Revision Log
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 services.completion.dart; 5 library services.completion.dart;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol.dart'; 9 import 'package:analysis_server/src/protocol.dart';
10 import 'package:analysis_server/src/services/completion/arglist_computer.dart'; 10 import 'package:analysis_server/src/services/completion/arglist_computer.dart';
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 context, 72 context,
73 searchEngine, 73 searchEngine,
74 source, 74 source,
75 new DartCompletionCache(context, source)); 75 new DartCompletionCache(context, source));
76 } 76 }
77 77
78 @override 78 @override
79 Future<bool> computeCache() { 79 Future<bool> computeCache() {
80 return waitForAnalysis().then((CompilationUnit unit) { 80 return waitForAnalysis().then((CompilationUnit unit) {
81 if (unit != null && !cache.isImportInfoCached(unit)) { 81 if (unit != null && !cache.isImportInfoCached(unit)) {
82 return cache.computeImportInfo(unit, searchEngine); 82 return cache.computeImportInfo(unit, searchEngine, true);
83 } else { 83 } else {
84 return new Future.value(false); 84 return new Future.value(false);
85 } 85 }
86 }); 86 });
87 } 87 }
88 88
89 /** 89 /**
90 * Compute suggestions based upon cached information only 90 * Compute suggestions based upon cached information only
91 * then send an initial response to the client. 91 * then send an initial response to the client.
92 * Return a list of computers for which [computeFull] should be called 92 * Return a list of computers for which [computeFull] should be called
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 controller.close(); 182 controller.close();
183 } 183 }
184 } 184 }
185 185
186 /** 186 /**
187 * Return a future that either (a) completes with the resolved compilation 187 * Return a future that either (a) completes with the resolved compilation
188 * unit when analysis is complete, or (b) completes with null if the 188 * unit when analysis is complete, or (b) completes with null if the
189 * compilation unit is never going to be resolved. 189 * compilation unit is never going to be resolved.
190 */ 190 */
191 Future<CompilationUnit> waitForAnalysis() { 191 Future<CompilationUnit> waitForAnalysis() {
192 List<Source> libraries = context.getLibrariesContaining(source);
193 assert(libraries != null);
194 if (libraries.length == 0) {
195 return new Future.value(null);
196 }
197 Source libSource = libraries[0];
198 assert(libSource != null);
192 return context.computeResolvedCompilationUnitAsync( 199 return context.computeResolvedCompilationUnitAsync(
193 source, 200 source,
194 source).catchError((_) { 201 libSource).catchError((_) {
195 // This source file is not scheduled for analysis, so a resolved 202 // This source file is not scheduled for analysis, so a resolved
196 // compilation unit is never going to get computed. 203 // compilation unit is never going to get computed.
197 return null; 204 return null;
198 }, test: (e) => e is AnalysisNotScheduledError); 205 }, test: (e) => e is AnalysisNotScheduledError);
199 } 206 }
200 } 207 }
201 208
202 /** 209 /**
203 * The context in which the completion is requested. 210 * The context in which the completion is requested.
204 */ 211 */
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 _ReplacementOffsetBuilder(this.request) { 305 _ReplacementOffsetBuilder(this.request) {
299 request.replacementOffset = request.offset; 306 request.replacementOffset = request.offset;
300 request.replacementLength = 0; 307 request.replacementLength = 0;
301 } 308 }
302 309
303 visitSimpleIdentifier(SimpleIdentifier node) { 310 visitSimpleIdentifier(SimpleIdentifier node) {
304 request.replacementOffset = node.offset; 311 request.replacementOffset = node.offset;
305 request.replacementLength = node.length; 312 request.replacementLength = node.length;
306 } 313 }
307 } 314 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698