| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'package:analysis_server/protocol/protocol.dart'; | 5 import 'package:analysis_server/protocol/protocol.dart'; |
| 6 import 'package:analysis_server/protocol/protocol_generated.dart'; | 6 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| 7 import 'package:analysis_server/src/edit/edit_domain.dart'; | 7 import 'package:analysis_server/src/edit/edit_domain.dart'; |
| 8 import 'package:analyzer_plugin/protocol/protocol_common.dart'; | 8 import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
| 9 import 'package:plugin/manager.dart'; | 9 import 'package:plugin/manager.dart'; |
| 10 import 'package:test/test.dart'; | 10 import 'package:test/test.dart'; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 test_plainEnterFromStart() async { | 34 test_plainEnterFromStart() async { |
| 35 addTestFile(''' | 35 addTestFile(''' |
| 36 main() { | 36 main() { |
| 37 int v = 1; | 37 int v = 1; |
| 38 } | 38 } |
| 39 '''); | 39 '''); |
| 40 await waitForTasksFinished(); | 40 await waitForTasksFinished(); |
| 41 await _prepareCompletion('v = 1;', atStart: true); | 41 await _prepareCompletion('v = 1;', atStart: true); |
| 42 _assertHasChange( | 42 _assertHasChange('Insert a newline at the end of the current line', ''' |
| 43 'Insert a newline at the end of the current line', | |
| 44 ''' | |
| 45 main() { | 43 main() { |
| 46 int v = 1; | 44 int v = 1; |
| 47 /*caret*/ | 45 /*caret*/ |
| 48 } | 46 } |
| 49 '''); | 47 '''); |
| 50 } | 48 } |
| 51 | 49 |
| 52 test_plainOleEnter() async { | 50 test_plainOleEnter() async { |
| 53 addTestFile(''' | 51 addTestFile(''' |
| 54 main() { | 52 main() { |
| 55 int v = 1; | 53 int v = 1; |
| 56 } | 54 } |
| 57 '''); | 55 '''); |
| 58 await waitForTasksFinished(); | 56 await waitForTasksFinished(); |
| 59 await _prepareCompletion('v = 1;', atEnd: true); | 57 await _prepareCompletion('v = 1;', atEnd: true); |
| 60 _assertHasChange( | 58 _assertHasChange('Insert a newline at the end of the current line', ''' |
| 61 'Insert a newline at the end of the current line', | |
| 62 ''' | |
| 63 main() { | 59 main() { |
| 64 int v = 1; | 60 int v = 1; |
| 65 /*caret*/ | 61 /*caret*/ |
| 66 } | 62 } |
| 67 '''); | 63 '''); |
| 68 } | 64 } |
| 69 | 65 |
| 70 test_plainOleEnterWithError() async { | 66 test_plainOleEnterWithError() async { |
| 71 addTestFile(''' | 67 addTestFile(''' |
| 72 main() { | 68 main() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 116 } |
| 121 | 117 |
| 122 _prepareCompletionAt(int offset) async { | 118 _prepareCompletionAt(int offset) async { |
| 123 Request request = | 119 Request request = |
| 124 new EditGetStatementCompletionParams(testFile, offset).toRequest('0'); | 120 new EditGetStatementCompletionParams(testFile, offset).toRequest('0'); |
| 125 Response response = await waitResponse(request); | 121 Response response = await waitResponse(request); |
| 126 var result = new EditGetStatementCompletionResult.fromResponse(response); | 122 var result = new EditGetStatementCompletionResult.fromResponse(response); |
| 127 change = result.change; | 123 change = result.change; |
| 128 } | 124 } |
| 129 } | 125 } |
| OLD | NEW |