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

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

Issue 845553005: Change code completion relevance from CompletionRelevance.LOW/DEFAULT/HIGH to int (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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
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' 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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698