| 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.optype; | 5 library services.completion.dart.optype; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol_server.dart' hide Element; | 7 import 'package:analysis_server/src/protocol_server.dart' hide Element; |
| 8 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 8 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
| 9 import 'package:analysis_server/src/provisional/completion/dart/completion_targe
t.dart'; | 9 import 'package:analysis_server/src/provisional/completion/dart/completion_targe
t.dart'; |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 /** | 128 /** |
| 129 * Indicate whether only type names should be suggested | 129 * Indicate whether only type names should be suggested |
| 130 */ | 130 */ |
| 131 bool get includeOnlyNamedArgumentSuggestions => | 131 bool get includeOnlyNamedArgumentSuggestions => |
| 132 includeNamedArgumentSuggestions && | 132 includeNamedArgumentSuggestions && |
| 133 !includeTypeNameSuggestions && | 133 !includeTypeNameSuggestions && |
| 134 !includeReturnValueSuggestions && | 134 !includeReturnValueSuggestions && |
| 135 !includeVoidReturnSuggestions; | 135 !includeVoidReturnSuggestions; |
| 136 | 136 |
| 137 /** | 137 /** |
| 138 * Return `true` if free standing identifiers should be suggested |
| 139 */ |
| 140 bool get includeIdentifiers { |
| 141 return !isPrefixed && |
| 142 (includeReturnValueSuggestions || |
| 143 includeTypeNameSuggestions || |
| 144 includeVoidReturnSuggestions || |
| 145 includeConstructorSuggestions); |
| 146 } |
| 147 |
| 148 /** |
| 138 * Indicate whether only type names should be suggested | 149 * Indicate whether only type names should be suggested |
| 139 */ | 150 */ |
| 140 bool get includeOnlyTypeNameSuggestions => | 151 bool get includeOnlyTypeNameSuggestions => |
| 141 includeTypeNameSuggestions && | 152 includeTypeNameSuggestions && |
| 142 !includeNamedArgumentSuggestions && | 153 !includeNamedArgumentSuggestions && |
| 143 !includeReturnValueSuggestions && | 154 !includeReturnValueSuggestions && |
| 144 !includeVoidReturnSuggestions; | 155 !includeVoidReturnSuggestions; |
| 145 } | 156 } |
| 146 | 157 |
| 147 class _OpTypeAstVisitor extends GeneralizingAstVisitor { | 158 class _OpTypeAstVisitor extends GeneralizingAstVisitor { |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 } | 907 } |
| 897 | 908 |
| 898 bool _isEntityPrevTokenSynthetic() { | 909 bool _isEntityPrevTokenSynthetic() { |
| 899 Object entity = this.entity; | 910 Object entity = this.entity; |
| 900 if (entity is AstNode && entity.beginToken.previous?.isSynthetic ?? false) { | 911 if (entity is AstNode && entity.beginToken.previous?.isSynthetic ?? false) { |
| 901 return true; | 912 return true; |
| 902 } | 913 } |
| 903 return false; | 914 return false; |
| 904 } | 915 } |
| 905 } | 916 } |
| OLD | NEW |