Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: pkg/analysis_server/lib/src/services/completion/dart_completion_cache.dart

Issue 1000223003: include unimported sdk lib types as low priority suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/test/mock_sdk.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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' 10 import 'package:analysis_server/src/protocol_server.dart'
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 _importedCompletions.add(suggestion.completion); 270 _importedCompletions.add(suggestion.completion);
271 } 271 }
272 } 272 }
273 273
274 /** 274 /**
275 * Add suggestions for all top level elements in the context 275 * Add suggestions for all top level elements in the context
276 * excluding those elemnents for which suggestions have already been added. 276 * excluding those elemnents for which suggestions have already been added.
277 */ 277 */
278 void _addNonImportedElementSuggestions( 278 void _addNonImportedElementSuggestions(
279 List<SearchMatch> matches, Set<LibraryElement> excludedLibs) { 279 List<SearchMatch> matches, Set<LibraryElement> excludedLibs) {
280 AnalysisContext sdkContext = context.sourceFactory.dartSdk.context;
280 matches.forEach((SearchMatch match) { 281 matches.forEach((SearchMatch match) {
281 if (match.kind == MatchKind.DECLARATION) { 282 if (match.kind == MatchKind.DECLARATION) {
282 Element element = match.element; 283 Element element = match.element;
283 if (element.context == context && 284 if ((element.context == context || element.context == sdkContext) &&
284 element.isPublic && 285 element.isPublic &&
285 !excludedLibs.contains(element.library) && 286 !excludedLibs.contains(element.library) &&
286 !_importedCompletions.contains(element.displayName)) { 287 !_importedCompletions.contains(element.displayName)) {
287 _addSuggestion(element, DART_RELEVANCE_LOW); 288 _addSuggestion(element, DART_RELEVANCE_LOW);
288 } 289 }
289 } 290 }
290 }); 291 });
291 } 292 }
292 293
293 /** 294 /**
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 @override 384 @override
384 void visitFunctionTypeAliasElement(FunctionTypeAliasElement element) { 385 void visitFunctionTypeAliasElement(FunctionTypeAliasElement element) {
385 cache._addSuggestion(element, DART_RELEVANCE_DEFAULT); 386 cache._addSuggestion(element, DART_RELEVANCE_DEFAULT);
386 } 387 }
387 388
388 @override 389 @override
389 void visitTopLevelVariableElement(TopLevelVariableElement element) { 390 void visitTopLevelVariableElement(TopLevelVariableElement element) {
390 cache._addSuggestion(element, DART_RELEVANCE_DEFAULT); 391 cache._addSuggestion(element, DART_RELEVANCE_DEFAULT);
391 } 392 }
392 } 393 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/mock_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698