| 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.cache; | 5 library services.completion.dart.cache; |
| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 /** | 247 /** |
| 248 * Add suggestions for all top level elements in the context | 248 * Add suggestions for all top level elements in the context |
| 249 * excluding those elemnents for which suggestions have already been added. | 249 * excluding those elemnents for which suggestions have already been added. |
| 250 */ | 250 */ |
| 251 void _addNonImportedElementSuggestions(List<SearchMatch> matches, | 251 void _addNonImportedElementSuggestions(List<SearchMatch> matches, |
| 252 Set<LibraryElement> excludedLibs) { | 252 Set<LibraryElement> excludedLibs) { |
| 253 matches.forEach((SearchMatch match) { | 253 matches.forEach((SearchMatch match) { |
| 254 if (match.kind == MatchKind.DECLARATION) { | 254 if (match.kind == MatchKind.DECLARATION) { |
| 255 Element element = match.element; | 255 Element element = match.element; |
| 256 if (element.isPublic && | 256 if (element.context == context && |
| 257 element.isPublic && |
| 257 !excludedLibs.contains(element.library) && | 258 !excludedLibs.contains(element.library) && |
| 258 !_importedCompletions.contains(element.displayName)) { | 259 !_importedCompletions.contains(element.displayName)) { |
| 259 _addSuggestion(element, CompletionRelevance.LOW); | 260 _addSuggestion(element, CompletionRelevance.LOW); |
| 260 } | 261 } |
| 261 } | 262 } |
| 262 }); | 263 }); |
| 263 } | 264 } |
| 264 | 265 |
| 265 /** | 266 /** |
| 266 * Add a suggestion for the given element. | 267 * Add a suggestion for the given element. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 @override | 354 @override |
| 354 void visitFunctionTypeAliasElement(FunctionTypeAliasElement element) { | 355 void visitFunctionTypeAliasElement(FunctionTypeAliasElement element) { |
| 355 cache._addSuggestion(element, CompletionRelevance.DEFAULT); | 356 cache._addSuggestion(element, CompletionRelevance.DEFAULT); |
| 356 } | 357 } |
| 357 | 358 |
| 358 @override | 359 @override |
| 359 void visitTopLevelVariableElement(TopLevelVariableElement element) { | 360 void visitTopLevelVariableElement(TopLevelVariableElement element) { |
| 360 cache._addSuggestion(element, CompletionRelevance.DEFAULT); | 361 cache._addSuggestion(element, CompletionRelevance.DEFAULT); |
| 361 } | 362 } |
| 362 } | 363 } |
| OLD | NEW |