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

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

Issue 1035623003: send completion notification even if offset beyond eof (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 8 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/domain_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.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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 * Compute suggestions based upon cached information only 117 * Compute suggestions based upon cached information only
118 * then send an initial response to the client. 118 * then send an initial response to the client.
119 * Return a list of computers for which [computeFull] should be called 119 * Return a list of computers for which [computeFull] should be called
120 */ 120 */
121 List<DartCompletionComputer> computeFast(DartCompletionRequest request) { 121 List<DartCompletionComputer> computeFast(DartCompletionRequest request) {
122 return request.performance.logElapseTime('computeFast', () { 122 return request.performance.logElapseTime('computeFast', () {
123 CompilationUnit unit = context.parseCompilationUnit(source); 123 CompilationUnit unit = context.parseCompilationUnit(source);
124 request.unit = unit; 124 request.unit = unit;
125 request.node = new NodeLocator.con1(request.offset).searchWithin(unit); 125 request.node = new NodeLocator.con1(request.offset).searchWithin(unit);
126 request.target = new CompletionTarget.forOffset(unit, request.offset); 126 request.target = new CompletionTarget.forOffset(unit, request.offset);
127 request.replacementOffset = request.offset;
128 request.replacementLength = 0;
127 if (request.node == null) { 129 if (request.node == null) {
130 sendResults(request, true);
128 return []; 131 return [];
129 } 132 }
130 133
131 request.replacementOffset = request.offset;
132 request.replacementLength = 0;
133 var entity = request.target.entity; 134 var entity = request.target.entity;
134 Token token = entity is AstNode ? entity.beginToken : entity; 135 Token token = entity is AstNode ? entity.beginToken : entity;
135 if (token != null && 136 if (token != null &&
136 token.offset <= request.offset && 137 token.offset <= request.offset &&
137 (token.type == TokenType.KEYWORD || 138 (token.type == TokenType.KEYWORD ||
138 token.type == TokenType.IDENTIFIER)) { 139 token.type == TokenType.IDENTIFIER)) {
139 request.replacementOffset = token.offset; 140 request.replacementOffset = token.offset;
140 request.replacementLength = token.length; 141 request.replacementLength = token.length;
141 } 142 }
142 143
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 parameterNames: suggestion.parameterNames, 384 parameterNames: suggestion.parameterNames,
384 parameterTypes: suggestion.parameterTypes, 385 parameterTypes: suggestion.parameterTypes,
385 requiredParameterCount: suggestion.requiredParameterCount, 386 requiredParameterCount: suggestion.requiredParameterCount,
386 hasNamedParameters: suggestion.hasNamedParameters, 387 hasNamedParameters: suggestion.hasNamedParameters,
387 returnType: suggestion.returnType, 388 returnType: suggestion.returnType,
388 element: suggestion.element); 389 element: suggestion.element);
389 } 390 }
390 } 391 }
391 } 392 }
392 } 393 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/domain_completion_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698