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

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

Issue 795633004: filter imported element suggestions to reduce number of results sent to client (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge and fix test Created 6 years 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/lib/src/services/completion/imported_computer.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; 5 library services.completion.dart;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol.dart'; 9 import 'package:analysis_server/src/protocol.dart';
10 import 'package:analysis_server/src/services/completion/arglist_computer.dart'; 10 import 'package:analysis_server/src/services/completion/arglist_computer.dart';
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 * containing the cursor is to be replaced when the suggestion is applied 258 * containing the cursor is to be replaced when the suggestion is applied
259 * (that is, the number of characters in the existing identifier). 259 * (that is, the number of characters in the existing identifier).
260 */ 260 */
261 int replacementLength; 261 int replacementLength;
262 262
263 /** 263 /**
264 * The list of suggestions to be sent to the client. 264 * The list of suggestions to be sent to the client.
265 */ 265 */
266 final List<CompletionSuggestion> suggestions = <CompletionSuggestion>[]; 266 final List<CompletionSuggestion> suggestions = <CompletionSuggestion>[];
267 267
268 /**
269 * Return the original text from the [replacementOffset] to the [offset]
270 * that can be used to filter the suggestions on the server side.
271 */
272 String get filterText {
273 return context.getContents(source).data.substring(replacementOffset, offset) ;
274 }
275
268 DartCompletionRequest(this.context, this.searchEngine, this.source, 276 DartCompletionRequest(this.context, this.searchEngine, this.source,
269 int offset, this.cache, CompletionPerformance performance) 277 int offset, this.cache, CompletionPerformance performance)
270 : super(offset, performance); 278 : super(offset, performance);
271 } 279 }
272 280
273 /** 281 /**
274 * Visitor used to determine the replacement offset and length 282 * Visitor used to determine the replacement offset and length
275 * based upon the cursor location. 283 * based upon the cursor location.
276 */ 284 */
277 class _ReplacementOffsetBuilder extends SimpleAstVisitor { 285 class _ReplacementOffsetBuilder extends SimpleAstVisitor {
278 final DartCompletionRequest request; 286 final DartCompletionRequest request;
279 287
280 _ReplacementOffsetBuilder(this.request) { 288 _ReplacementOffsetBuilder(this.request) {
281 request.replacementOffset = request.offset; 289 request.replacementOffset = request.offset;
282 request.replacementLength = 0; 290 request.replacementLength = 0;
283 } 291 }
284 292
285 visitSimpleIdentifier(SimpleIdentifier node) { 293 visitSimpleIdentifier(SimpleIdentifier node) {
286 request.replacementOffset = node.offset; 294 request.replacementOffset = node.offset;
287 request.replacementLength = node.length; 295 request.replacementLength = node.length;
288 } 296 }
289 } 297 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/imported_computer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698