| OLD | NEW |
| 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'; |
| 11 import 'package:analysis_server/src/services/completion/combinator_computer.dart
'; | 11 import 'package:analysis_server/src/services/completion/combinator_computer.dart
'; |
| 12 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; | 12 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; |
| 13 import 'package:analysis_server/src/services/completion/completion_target.dart'; | 13 import 'package:analysis_server/src/services/completion/completion_target.dart'; |
| 14 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; | 14 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; |
| 15 import 'package:analysis_server/src/services/completion/imported_computer.dart'; | 15 import 'package:analysis_server/src/services/completion/imported_computer.dart'; |
| 16 import 'package:analysis_server/src/services/completion/invocation_computer.dart
'; | 16 import 'package:analysis_server/src/services/completion/invocation_computer.dart
'; |
| 17 import 'package:analysis_server/src/services/completion/keyword_computer.dart'; | 17 import 'package:analysis_server/src/services/completion/keyword_computer.dart'; |
| 18 import 'package:analysis_server/src/services/completion/local_computer.dart'; | 18 import 'package:analysis_server/src/services/completion/local_computer.dart'; |
| 19 import 'package:analysis_server/src/services/completion/optype.dart'; | 19 import 'package:analysis_server/src/services/completion/optype.dart'; |
| 20 import 'package:analysis_server/src/services/search/search_engine.dart'; | 20 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 21 import 'package:analyzer/src/generated/ast.dart'; | 21 import 'package:analyzer/src/generated/ast.dart'; |
| 22 import 'package:analyzer/src/generated/engine.dart'; | 22 import 'package:analyzer/src/generated/engine.dart'; |
| 23 import 'package:analyzer/src/generated/source.dart'; | 23 import 'package:analyzer/src/generated/source.dart'; |
| 24 | 24 |
| 25 // TODO (danrubel) these are temporary constants as we transition completion |
| 26 // relevance from CompletionRelevance.LOW/DEFAULT/HIGH to int. |
| 27 // These should be removed in a subsequent CL |
| 28 const int COMPLETION_RELEVANCE_LOW = 500; |
| 29 const int COMPLETION_RELEVANCE_DEFAULT = 1000; |
| 30 const int COMPLETION_RELEVANCE_HIGH = 2000; |
| 31 |
| 25 /** | 32 /** |
| 26 * The base class for computing code completion suggestions. | 33 * The base class for computing code completion suggestions. |
| 27 */ | 34 */ |
| 28 abstract class DartCompletionComputer { | 35 abstract class DartCompletionComputer { |
| 29 /** | 36 /** |
| 30 * Computes the initial set of [CompletionSuggestion]s based on | 37 * Computes the initial set of [CompletionSuggestion]s based on |
| 31 * the given completion context. The compilation unit and completion node | 38 * the given completion context. The compilation unit and completion node |
| 32 * in the given completion context may not be resolved. | 39 * in the given completion context may not be resolved. |
| 33 * This method should execute quickly and not block waiting for any analysis. | 40 * This method should execute quickly and not block waiting for any analysis. |
| 34 * Returns `true` if the computer's work is complete | 41 * Returns `true` if the computer's work is complete |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 _ReplacementOffsetBuilder(this.request) { | 326 _ReplacementOffsetBuilder(this.request) { |
| 320 request.replacementOffset = request.offset; | 327 request.replacementOffset = request.offset; |
| 321 request.replacementLength = 0; | 328 request.replacementLength = 0; |
| 322 } | 329 } |
| 323 | 330 |
| 324 visitSimpleIdentifier(SimpleIdentifier node) { | 331 visitSimpleIdentifier(SimpleIdentifier node) { |
| 325 request.replacementOffset = node.offset; | 332 request.replacementOffset = node.offset; |
| 326 request.replacementLength = node.length; | 333 request.replacementLength = node.length; |
| 327 } | 334 } |
| 328 } | 335 } |
| OLD | NEW |