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

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

Issue 977223003: When target requires a function, propose a function reference, not an invocation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge and update editor to process IDENTIFIER suggestions Created 5 years, 9 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
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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 /** 333 /**
334 * Information about the types of suggestions that should be included. 334 * Information about the types of suggestions that should be included.
335 * The [target] must be set first. 335 * The [target] must be set first.
336 */ 336 */
337 OpType get optype { 337 OpType get optype {
338 if (_optype == null) { 338 if (_optype == null) {
339 _optype = new OpType.forCompletion(target, offset); 339 _optype = new OpType.forCompletion(target, offset);
340 } 340 }
341 return _optype; 341 return _optype;
342 } 342 }
343
344 /**
345 * Convert all [CompletionSuggestionKind.INVOCATION] suggestions
346 * to [CompletionSuggestionKind.IDENTIFIER] suggestions.
347 */
348 void convertInvocationsToIdentifiers() {
349 for (int index = suggestions.length - 1; index >= 0; --index) {
350 CompletionSuggestion suggestion = suggestions[index];
351 if (suggestion.kind == CompletionSuggestionKind.INVOCATION) {
352 // Create a copy rather than just modifying the existing suggestion
353 // because [DartCompletionCache] may be caching that suggestion
354 // for future completion requests
355 suggestions[index] = new CompletionSuggestion(
356 CompletionSuggestionKind.IDENTIFIER, suggestion.relevance,
357 suggestion.completion, suggestion.selectionOffset,
358 suggestion.selectionLength, suggestion.isDeprecated,
359 suggestion.isPotential,
360 declaringType: suggestion.declaringType,
361 parameterNames: suggestion.parameterNames,
362 parameterTypes: suggestion.parameterTypes,
363 requiredParameterCount: suggestion.requiredParameterCount,
364 hasNamedParameters: suggestion.hasNamedParameters,
365 returnType: suggestion.returnType,
366 element: suggestion.element);
367 }
368 }
369 }
343 } 370 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698