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

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: 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 171 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 if (libraries == null || libraries.length == 0 || libraries[0] == null) {
Paul Berry 2014/12/18 18:37:02 Are all of these possibilities expected to arise i
danrubel 2014/12/19 18:46:09 The dartdoc does not clearly state that it will no
194 return new Future.value(null);
195 }
192 return context.computeResolvedCompilationUnitAsync( 196 return context.computeResolvedCompilationUnitAsync(
193 source, 197 source,
194 source).catchError((_) { 198 libraries[0]).catchError((_) {
195 // This source file is not scheduled for analysis, so a resolved 199 // This source file is not scheduled for analysis, so a resolved
196 // compilation unit is never going to get computed. 200 // compilation unit is never going to get computed.
197 return null; 201 return null;
198 }, test: (e) => e is AnalysisNotScheduledError); 202 }, test: (e) => e is AnalysisNotScheduledError);
199 } 203 }
200 } 204 }
201 205
202 /** 206 /**
203 * The context in which the completion is requested. 207 * The context in which the completion is requested.
204 */ 208 */
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 _ReplacementOffsetBuilder(this.request) { 302 _ReplacementOffsetBuilder(this.request) {
299 request.replacementOffset = request.offset; 303 request.replacementOffset = request.offset;
300 request.replacementLength = 0; 304 request.replacementLength = 0;
301 } 305 }
302 306
303 visitSimpleIdentifier(SimpleIdentifier node) { 307 visitSimpleIdentifier(SimpleIdentifier node) {
304 request.replacementOffset = node.offset; 308 request.replacementOffset = node.offset;
305 request.replacementLength = node.length; 309 request.replacementLength = node.length;
306 } 310 }
307 } 311 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698