@@ -45,7 +45,7 @@ For example
45
45
| | // omit cargo file
46
46
| |-tests
47
47
| |-foo-bar.rs
48
- |
48
+ |
49
49
|
50
50
|-package2
51
51
| | // omit cargo file
@@ -107,3 +107,122 @@ When you want to run `mod1::foo`(module), the cause will be matched too.
107
107
8 . As mentioned in 2 point, "run all" does not work for workspace level for now.
108
108
109
109
9 . Debug will not update the state of test item.(could provide better experience for Linux)
110
+
111
+
112
+ ###
113
+
114
+ Init
115
+
116
+ ``` mermaid
117
+ sequenceDiagram
118
+ participant U as User
119
+ participant VSC as VSCode
120
+ participant C as VSCode extension
121
+ participant RA as Rust Analyzer
122
+
123
+ U->>+VSC: Open testing explorer
124
+ VSC->>+C: resolver sends init request
125
+ C->>+RA: get cargo project info
126
+ RA->>-C: back cargo project info
127
+ C->>C: construct Ideal tree about workspace and package part
128
+ loop until all targets are got
129
+ C->>+RA: request test infos for target root files (repeat many times)
130
+ RA->>-C: request test infos for target root files
131
+ end
132
+ C->>C: construct Ideal tree about target root files part
133
+ C->>C: construct TestItem tree By Ideal tree
134
+ C->>-VSC: VSCode got the Test Item tree
135
+ VSC->>-U: Render Test Explorer
136
+ ```
137
+
138
+ Change avtive file
139
+ ``` mermaid
140
+ sequenceDiagram
141
+ participant U as User
142
+ participant VSC as VSCode
143
+ participant C as VSCode extension
144
+ participant RA as Rust Analyzer
145
+
146
+ U->>+VSC: Change active document
147
+ VSC->>+C: trigger event
148
+ C->>C: check whether the file is already loaded
149
+ alt is already loaded
150
+ C->>VSC: nothing changed
151
+ VSC->>U: nothing changed
152
+ else file is not loaed
153
+ Note over C: Load the file, but we might need to load its parent
154
+ loop until the module is loaded
155
+ C->>C: find nearest parent of the file module in ideal tree
156
+ C->>RA: get module info of the file
157
+ RA->>C: return module info of the file
158
+ C->>C: add new nodes to ideal tree
159
+ end
160
+ C->>C: construct TestItem tree By Ideal tree
161
+ C->>-VSC: VSCode got the Test Item tree
162
+ VSC->>-U: Render Test Explorer
163
+ end
164
+ ```
165
+
166
+ Add file
167
+ Change file
168
+ Delete file
169
+ ``` mermaid
170
+ sequenceDiagram
171
+ participant U as User
172
+ participant VSC as VSCode
173
+ participant C as VSCode extension
174
+ participant RA as Rust Analyzer
175
+
176
+ U->>+VSC: Add/Delete/Change file
177
+ VSC->>+C: trigger event
178
+ C->>RA: request test info in file
179
+ RA->>C: back test info in file
180
+ C->>C: update ideal tree
181
+ Note over C: This is different for different operations
182
+ C->>C: construct TestItem tree By Ideal tree
183
+ C->>-VSC: VSCode got the Test Item tree
184
+ VSC->>-U: Render Test Explorer
185
+ ```
186
+
187
+
188
+ Debug
189
+ ``` mermaid
190
+ sequenceDiagram
191
+ participant U as User
192
+ participant VSC as VSCode
193
+ participant C as VSCode extension
194
+ participant LLDB as LLDB extension
195
+
196
+ U->>+VSC: Click run/debug button
197
+ VSC->>+C: testing API trigger event
198
+ C->>C: compute VSCode Debug configuration(LLDB)
199
+ C->>C: Set test status for test items
200
+ C->>VSCode: Start debug
201
+ VSCode->>LLDB: Debugger protocal
202
+ LLDB->>VSCode: Debugger protocal
203
+ VSCode->>C: debug session
204
+ C->>C: Analytics test output from rustc and update status of test items
205
+ C->>C: Attach info to test items(if any)
206
+ C->>-VSC:
207
+ VSC->>-U:
208
+ ```
209
+
210
+ Run
211
+ ``` mermaid
212
+ sequenceDiagram
213
+ participant U as User
214
+ participant VSC as VSCode
215
+ participant C as VSCode extension
216
+ participant Cargo as Cargo
217
+
218
+ U->>+VSC: Click run/debug button
219
+ VSC->>+C: testing API trigger event
220
+ C->>C: compute Cargo command
221
+ C->>C: Set test status for test items
222
+ C->>Cargo: execute commands
223
+ Cargo->>C: run tests
224
+ C->>C: Analytics test output from rustc and update status of test items
225
+ C->>C: Attach info to test items(if any)
226
+ C->>-VSC:
227
+ VSC->>-U:
228
+ ```
0 commit comments