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

Side by Side Diff: pkg/analysis_server/test/services/correction/assist_test.dart

Issue 693193002: Support for 'Add Type Annotation' when selection if right after ';'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « pkg/analysis_server/lib/src/services/correction/assist_internal.dart ('k') | no next file » | 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 test.services.correction.assist; 5 library test.services.correction.assist;
6 6
7 import 'package:analysis_server/src/protocol.dart'; 7 import 'package:analysis_server/src/protocol.dart';
8 import 'package:analysis_server/src/services/correction/assist.dart'; 8 import 'package:analysis_server/src/services/correction/assist.dart';
9 import 'package:analysis_server/src/services/index/index.dart'; 9 import 'package:analysis_server/src/services/index/index.dart';
10 import 'package:analysis_server/src/services/index/local_memory_index.dart'; 10 import 'package:analysis_server/src/services/index/local_memory_index.dart';
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 196 }
197 '''); 197 ''');
198 assertHasAssistAt('item in', AssistKind.ADD_TYPE_ANNOTATION, ''' 198 assertHasAssistAt('item in', AssistKind.ADD_TYPE_ANNOTATION, '''
199 main(List<String> items) { 199 main(List<String> items) {
200 for (final String item in items) { 200 for (final String item in items) {
201 } 201 }
202 } 202 }
203 '''); 203 ''');
204 } 204 }
205 205
206 void test_addTypeAnnotation_local_OK_onVariableDeclarationStatement() {
207 _indexTestUnit('''
208 main() {
209 var v = 123; // marker
210 }
211 ''');
212 assertHasAssistAt(' // marker', AssistKind.ADD_TYPE_ANNOTATION, '''
213 main() {
214 int v = 123; // marker
215 }
216 ''');
217 }
218
206 void test_addTypeAnnotation_local_OK_Function() { 219 void test_addTypeAnnotation_local_OK_Function() {
207 _indexTestUnit(''' 220 _indexTestUnit('''
208 main() { 221 main() {
209 var v = () => 1; 222 var v = () => 1;
210 } 223 }
211 '''); 224 ''');
212 assertHasAssistAt('v =', AssistKind.ADD_TYPE_ANNOTATION, ''' 225 assertHasAssistAt('v =', AssistKind.ADD_TYPE_ANNOTATION, '''
213 main() { 226 main() {
214 Function v = () => 1; 227 Function v = () => 1;
215 } 228 }
(...skipping 2204 matching lines...) Expand 10 before | Expand all | Expand 10 after
2420 void _indexTestUnit(String code) { 2433 void _indexTestUnit(String code) {
2421 resolveTestUnit(code); 2434 resolveTestUnit(code);
2422 index.indexUnit(context, testUnit); 2435 index.indexUnit(context, testUnit);
2423 } 2436 }
2424 2437
2425 void _setStartEndSelection() { 2438 void _setStartEndSelection() {
2426 offset = findOffset('// start\n') + '// start\n'.length; 2439 offset = findOffset('// start\n') + '// start\n'.length;
2427 length = findOffset('// end') - offset; 2440 length = findOffset('// end') - offset;
2428 } 2441 }
2429 } 2442 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/assist_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698