| 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 import 'package:analyzer/src/generated/scanner.dart'; | 24 import 'package:analyzer/src/generated/scanner.dart'; |
| 25 | 25 |
| 26 // TODO (danrubel) these are temporary constants as we transition completion | |
| 27 // relevance from CompletionRelevance.LOW/DEFAULT/HIGH to int. | |
| 28 // These should be removed in a subsequent CL | |
| 29 const int COMPLETION_RELEVANCE_LOW = 500; | |
| 30 const int COMPLETION_RELEVANCE_DEFAULT = 1000; | |
| 31 const int COMPLETION_RELEVANCE_HIGH = 2000; | |
| 32 | |
| 33 // Relevance highest to lowest | 26 // Relevance highest to lowest |
| 27 const int DART_RELEVANCE_HIGH = 2000; |
| 34 const int DART_RELEVANCE_LOCAL_VARIABLE = 1059; | 28 const int DART_RELEVANCE_LOCAL_VARIABLE = 1059; |
| 35 const int DART_RELEVANCE_PARAMETER = 1059; | 29 const int DART_RELEVANCE_PARAMETER = 1059; |
| 36 const int DART_RELEVANCE_INHERITED_FIELD = 1058; | 30 const int DART_RELEVANCE_INHERITED_FIELD = 1058; |
| 37 const int DART_RELEVANCE_LOCAL_FIELD = 1058; | 31 const int DART_RELEVANCE_LOCAL_FIELD = 1058; |
| 38 const int DART_RELEVANCE_INHERITED_ACCESSOR = 1057; | 32 const int DART_RELEVANCE_INHERITED_ACCESSOR = 1057; |
| 39 const int DART_RELEVANCE_INHERITED_METHOD = 1057; | 33 const int DART_RELEVANCE_INHERITED_METHOD = 1057; |
| 40 const int DART_RELEVANCE_LOCAL_ACCESSOR = 1057; | 34 const int DART_RELEVANCE_LOCAL_ACCESSOR = 1057; |
| 41 const int DART_RELEVANCE_LOCAL_METHOD = 1057; | 35 const int DART_RELEVANCE_LOCAL_METHOD = 1057; |
| 42 const int DART_RELEVANCE_LOCAL_FUNCTION = 1056; | 36 const int DART_RELEVANCE_LOCAL_FUNCTION = 1056; |
| 43 const int DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE = 1056; | 37 const int DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE = 1056; |
| 44 const int DART_RELEVANCE_KEYWORD = 1055; | 38 const int DART_RELEVANCE_KEYWORD = 1055; |
| 39 const int DART_RELEVANCE_DEFAULT = 1000; |
| 40 const int DART_RELEVANCE_LOW = 500; |
| 45 | 41 |
| 46 /** | 42 /** |
| 47 * The base class for computing code completion suggestions. | 43 * The base class for computing code completion suggestions. |
| 48 */ | 44 */ |
| 49 abstract class DartCompletionComputer { | 45 abstract class DartCompletionComputer { |
| 50 /** | 46 /** |
| 51 * Computes the initial set of [CompletionSuggestion]s based on | 47 * Computes the initial set of [CompletionSuggestion]s based on |
| 52 * the given completion context. The compilation unit and completion node | 48 * the given completion context. The compilation unit and completion node |
| 53 * in the given completion context may not be resolved. | 49 * in the given completion context may not be resolved. |
| 54 * This method should execute quickly and not block waiting for any analysis. | 50 * This method should execute quickly and not block waiting for any analysis. |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 * Information about the types of suggestions that should be included. | 333 * Information about the types of suggestions that should be included. |
| 338 * The [target] must be set first. | 334 * The [target] must be set first. |
| 339 */ | 335 */ |
| 340 OpType get optype { | 336 OpType get optype { |
| 341 if (_optype == null) { | 337 if (_optype == null) { |
| 342 _optype = new OpType.forCompletion(target, offset); | 338 _optype = new OpType.forCompletion(target, offset); |
| 343 } | 339 } |
| 344 return _optype; | 340 return _optype; |
| 345 } | 341 } |
| 346 } | 342 } |
| OLD | NEW |