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

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

Issue 972193002: include library prefix suggestions when suggesting constructors (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/completion_test.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.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' 10 import 'package:analysis_server/src/protocol_server.dart'
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 future = cache.computeImportInfo(request.unit, request.searchEngine, 99 future = cache.computeImportInfo(request.unit, request.searchEngine,
100 shouldWaitForLowPrioritySuggestions); 100 shouldWaitForLowPrioritySuggestions);
101 } 101 }
102 if (future != null) { 102 if (future != null) {
103 return future.then(addSuggestions); 103 return future.then(addSuggestions);
104 } 104 }
105 return addSuggestions(true); 105 return addSuggestions(true);
106 } 106 }
107 107
108 /** 108 /**
109 * Add constructor suggestions from the cache. 109 * Add constructor and library prefix suggestions from the cache.
110 * To reduce the number of suggestions sent to the client, 110 * To reduce the number of suggestions sent to the client,
111 * filter the suggestions based upon the first character typed. 111 * filter the suggestions based upon the first character typed.
112 * If no characters are available to use for filtering, 112 * If no characters are available to use for filtering,
113 * then exclude all low priority suggestions. 113 * then exclude all low priority suggestions.
114 */ 114 */
115 void _addConstructorSuggestions() { 115 void _addConstructorSuggestions() {
116 String filterText = request.filterText; 116 String filterText = request.filterText;
117 if (filterText.length > 1) { 117 if (filterText.length > 1) {
118 filterText = filterText.substring(0, 1); 118 filterText = filterText.substring(0, 1);
119 } 119 }
120 DartCompletionCache cache = request.cache; 120 DartCompletionCache cache = request.cache;
121 _addFilteredSuggestions(filterText, cache.importedConstructorSuggestions); 121 _addFilteredSuggestions(filterText, cache.importedConstructorSuggestions);
122 _addFilteredSuggestions(filterText, cache.libraryPrefixSuggestions);
122 } 123 }
123 124
124 /** 125 /**
125 * Add imported element suggestions. 126 * Add imported element suggestions.
126 */ 127 */
127 void _addElementSuggestions(List<Element> elements, 128 void _addElementSuggestions(List<Element> elements,
128 {int relevance: DART_RELEVANCE_DEFAULT}) { 129 {int relevance: DART_RELEVANCE_DEFAULT}) {
129 elements.forEach((Element elem) { 130 elements.forEach((Element elem) {
130 if (elem is! ClassElement) { 131 if (elem is! ClassElement) {
131 if (typesOnly) { 132 if (typesOnly) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 _addFilteredSuggestions(filterText, cache.libraryPrefixSuggestions); 233 _addFilteredSuggestions(filterText, cache.libraryPrefixSuggestions);
233 if (!typesOnly) { 234 if (!typesOnly) {
234 _addFilteredSuggestions(filterText, cache.otherImportedSuggestions); 235 _addFilteredSuggestions(filterText, cache.otherImportedSuggestions);
235 if (!excludeVoidReturn) { 236 if (!excludeVoidReturn) {
236 _addFilteredSuggestions( 237 _addFilteredSuggestions(
237 filterText, cache.importedVoidReturnSuggestions); 238 filterText, cache.importedVoidReturnSuggestions);
238 } 239 }
239 } 240 }
240 } 241 }
241 } 242 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/completion_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698