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.computer.dart.local; | 5 library services.completion.computer.dart.local; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/protocol.dart' as protocol show Element, | 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element, |
10 ElementKind; | 10 ElementKind; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 node.declarations.forEach((Declaration declaration) { | 126 node.declarations.forEach((Declaration declaration) { |
127 if (declaration is ClassDeclaration) { | 127 if (declaration is ClassDeclaration) { |
128 _addClassSuggestion(declaration); | 128 _addClassSuggestion(declaration); |
129 } else if (declaration is EnumDeclaration) { | 129 } else if (declaration is EnumDeclaration) { |
130 // _addSuggestion(d.name, CompletionSuggestionKind.ENUM); | 130 // _addSuggestion(d.name, CompletionSuggestionKind.ENUM); |
131 } else if (declaration is FunctionDeclaration) { | 131 } else if (declaration is FunctionDeclaration) { |
132 _addFunctionSuggestion(declaration); | 132 _addFunctionSuggestion(declaration); |
133 } else if (declaration is TopLevelVariableDeclaration) { | 133 } else if (declaration is TopLevelVariableDeclaration) { |
134 _addTopLevelVarSuggestions(declaration.variables); | 134 _addTopLevelVarSuggestions(declaration.variables); |
135 } else if (declaration is ClassTypeAlias) { | 135 } else if (declaration is ClassTypeAlias) { |
136 _addSuggestion( | 136 CompletionSuggestion suggestion = _addSuggestion( |
137 declaration.name, | 137 declaration.name, |
138 CompletionSuggestionKind.CLASS_ALIAS, | 138 CompletionSuggestionKind.CLASS_ALIAS, |
139 null, | 139 null, |
140 null); | 140 null); |
| 141 if (suggestion != null) { |
| 142 suggestion.element = _createElement( |
| 143 protocol.ElementKind.CLASS_TYPE_ALIAS, |
| 144 declaration.name, |
| 145 null, |
| 146 NO_RETURN_TYPE, |
| 147 true, |
| 148 _isDeprecated(declaration.metadata)); |
| 149 } |
141 } else if (declaration is FunctionTypeAlias) { | 150 } else if (declaration is FunctionTypeAlias) { |
142 CompletionSuggestion suggestion = _addSuggestion( | 151 CompletionSuggestion suggestion = _addSuggestion( |
143 declaration.name, | 152 declaration.name, |
144 CompletionSuggestionKind.FUNCTION_TYPE_ALIAS, | 153 CompletionSuggestionKind.FUNCTION_TYPE_ALIAS, |
145 declaration.returnType, | 154 declaration.returnType, |
146 null); | 155 null); |
147 if (suggestion != null) { | 156 if (suggestion != null) { |
148 suggestion.element = _createElement( | 157 suggestion.element = _createElement( |
149 protocol.ElementKind.FUNCTION_TYPE_ALIAS, | 158 protocol.ElementKind.FUNCTION_TYPE_ALIAS, |
150 declaration.name, | 159 declaration.name, |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 if (name == null || name.length <= 0) { | 593 if (name == null || name.length <= 0) { |
585 return DYNAMIC; | 594 return DYNAMIC; |
586 } | 595 } |
587 TypeArgumentList typeArgs = type.typeArguments; | 596 TypeArgumentList typeArgs = type.typeArguments; |
588 if (typeArgs != null) { | 597 if (typeArgs != null) { |
589 //TODO (danrubel) include type arguments | 598 //TODO (danrubel) include type arguments |
590 } | 599 } |
591 return name; | 600 return name; |
592 } | 601 } |
593 } | 602 } |
OLD | NEW |