OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /** | 5 /** |
6 * Operations to be performed during the simulation. | 6 * Operations to be performed during the simulation. |
7 */ | 7 */ |
8 library analysis_server.test.stress.replay.replay; | 8 library analysis_server.test.stress.replay.replay; |
9 | 9 |
10 import '../utilities/server.dart'; | 10 import '../utilities/server.dart'; |
11 | 11 |
12 /** | 12 /** |
13 * An operation that will send an 'analysis.updateContent' request. | 13 * An operation that will send an 'analysis.updateContent' request. |
14 */ | 14 */ |
15 class AnalysisUpdateContent extends ServerOperation { | 15 class Analysis_UpdateContent extends ServerOperation { |
16 /** | 16 /** |
17 * The path of the file whose content is being updated. | 17 * The path of the file whose content is being updated. |
18 */ | 18 */ |
19 String filePath; | 19 final String filePath; |
20 | 20 |
21 /** | 21 /** |
22 * The overlay used to update the content. | 22 * The overlay used to update the content. |
23 */ | 23 */ |
24 dynamic overlay; | 24 final dynamic overlay; |
25 | 25 |
26 /** | 26 /** |
27 * Initialize an operation to send an 'analysis.updateContent' request with | 27 * Initialize an operation to send an 'analysis.updateContent' request with |
28 * the given [filePath] and [overlay] as parameters. | 28 * the given [filePath] and [overlay] as parameters. |
29 */ | 29 */ |
30 AnalysisUpdateContent(this.filePath, this.overlay); | 30 Analysis_UpdateContent(this.filePath, this.overlay); |
31 | 31 |
32 @override | 32 @override |
33 void perform(Server server) { | 33 void perform(Server server) { |
34 server.sendAnalysisUpdateContent({filePath: overlay}); | 34 server.sendAnalysisUpdateContent({filePath: overlay}); |
35 // if (overlay is ChangeContentOverlay) { | 35 // if (overlay is ChangeContentOverlay) { |
36 // List<SourceEdit> edits = (overlay as ChangeContentOverlay).edits; | 36 // List<SourceEdit> edits = (overlay as ChangeContentOverlay).edits; |
37 // if (edits.length == 1) { | 37 // if (edits.length == 1) { |
38 // SourceEdit edit = edits[0]; | 38 // SourceEdit edit = edits[0]; |
39 // if (edit.replacement.endsWith('.')) { | 39 // if (edit.replacement.endsWith('.')) { |
40 // int offset = edit.offset + edit.replacement.length - 1; | 40 // int offset = edit.offset + edit.replacement.length - 1; |
41 // server.sendCompletionGetSuggestions(filePath, offset); | 41 // server.sendCompletionGetSuggestions(filePath, offset); |
42 // } | 42 // } |
43 // } | 43 // } |
44 // } | 44 // } |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 /** | 48 /** |
| 49 * An operation that will send a 'completion.getSuggestions' request. |
| 50 */ |
| 51 class Completion_GetSuggestions extends ServerOperation { |
| 52 /** |
| 53 * The path of the file in which completions are being requested. |
| 54 */ |
| 55 final String filePath; |
| 56 |
| 57 /** |
| 58 * The offset at which completions are being requested. |
| 59 */ |
| 60 final int offset; |
| 61 |
| 62 /** |
| 63 * Initialize an operation to send a 'completion.getSuggestions' request with |
| 64 * the given [filePath] and [offset] as parameters. |
| 65 */ |
| 66 Completion_GetSuggestions(this.filePath, this.offset); |
| 67 |
| 68 @override |
| 69 void perform(Server server) { |
| 70 server.sendCompletionGetSuggestions(filePath, offset); |
| 71 } |
| 72 } |
| 73 |
| 74 /** |
49 * An operation to be performed during the simulation. | 75 * An operation to be performed during the simulation. |
50 */ | 76 */ |
51 abstract class ServerOperation { | 77 abstract class ServerOperation { |
52 /** | 78 /** |
53 * Perform this operation by communicating with the given [server]. | 79 * Perform this operation by communicating with the given [server]. |
54 */ | 80 */ |
55 void perform(Server server); | 81 void perform(Server server); |
56 } | 82 } |
OLD | NEW |