| 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.toplevel; | 5 library services.completion.computer.dart.toplevel; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analysis_server/src/protocol_server.dart' hide Element, | 10 import 'package:analysis_server/src/protocol_server.dart' hide Element, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 if (elem.isSynthetic) { | 127 if (elem.isSynthetic) { |
| 128 if (elem is PropertyAccessorElement || elem is FieldElement) { | 128 if (elem is PropertyAccessorElement || elem is FieldElement) { |
| 129 return; | 129 return; |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 request.suggestions.add( | 133 request.suggestions.add( |
| 134 createElementSuggestion(elem, relevance: CompletionRelevance.DEFAULT))
; | 134 createElementSuggestion(elem, relevance: COMPLETION_RELEVANCE_DEFAULT)
); |
| 135 }); | 135 }); |
| 136 } | 136 } |
| 137 | 137 |
| 138 /** | 138 /** |
| 139 * Add suggestions for any inherited imported members. | 139 * Add suggestions for any inherited imported members. |
| 140 */ | 140 */ |
| 141 void _addInheritedSuggestions(AstNode node) { | 141 void _addInheritedSuggestions(AstNode node) { |
| 142 var classDecl = node.getAncestor((p) => p is ClassDeclaration); | 142 var classDecl = node.getAncestor((p) => p is ClassDeclaration); |
| 143 if (classDecl is ClassDeclaration) { | 143 if (classDecl is ClassDeclaration) { |
| 144 // Build a list of inherited types that are imported | 144 // Build a list of inherited types that are imported |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 183 } |
| 184 | 184 |
| 185 //TODO (danrubel) Revisit this filtering once paged API has been added | 185 //TODO (danrubel) Revisit this filtering once paged API has been added |
| 186 addFilteredSuggestions(List<CompletionSuggestion> unfiltered) { | 186 addFilteredSuggestions(List<CompletionSuggestion> unfiltered) { |
| 187 unfiltered.forEach((CompletionSuggestion suggestion) { | 187 unfiltered.forEach((CompletionSuggestion suggestion) { |
| 188 if (filterText.length > 0) { | 188 if (filterText.length > 0) { |
| 189 if (suggestion.completion.startsWith(filterText)) { | 189 if (suggestion.completion.startsWith(filterText)) { |
| 190 request.suggestions.add(suggestion); | 190 request.suggestions.add(suggestion); |
| 191 } | 191 } |
| 192 } else { | 192 } else { |
| 193 if (suggestion.relevance != CompletionRelevance.LOW) { | 193 if (suggestion.relevance != COMPLETION_RELEVANCE_LOW) { |
| 194 request.suggestions.add(suggestion); | 194 request.suggestions.add(suggestion); |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 }); | 197 }); |
| 198 } | 198 } |
| 199 | 199 |
| 200 DartCompletionCache cache = request.cache; | 200 DartCompletionCache cache = request.cache; |
| 201 addFilteredSuggestions(cache.importedTypeSuggestions); | 201 addFilteredSuggestions(cache.importedTypeSuggestions); |
| 202 addFilteredSuggestions(cache.libraryPrefixSuggestions); | 202 addFilteredSuggestions(cache.libraryPrefixSuggestions); |
| 203 if (!typesOnly) { | 203 if (!typesOnly) { |
| 204 addFilteredSuggestions(cache.otherImportedSuggestions); | 204 addFilteredSuggestions(cache.otherImportedSuggestions); |
| 205 if (!excludeVoidReturn) { | 205 if (!excludeVoidReturn) { |
| 206 addFilteredSuggestions(cache.importedVoidReturnSuggestions); | 206 addFilteredSuggestions(cache.importedVoidReturnSuggestions); |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 } | 210 } |
| OLD | NEW |