You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -300,12 +307,17 @@ If you install GNATtest, the Ada & SPARK extension for VS Code will provide the
300
307
301
308
<imgsrc="doc/gnattest-results.png"width="500"alt="GNATtest Test Results"/>
302
309
303
-
GNATtest support has the following known limitations:
310
+
#### Using multi-root workspaces for test development
304
311
305
-
* The extension relies on the default conventions of GNATtest such as the naming, location and object directory of the test harness project.
306
-
If those aspects are configured or altered manually, the features may no longer work.
312
+
When developing tests, it is recommended to use the test harness project auto-generated by GNATtest.
313
+
You can do so by editing the `ada.projectFile` setting to point to the test harness project.
314
+
However to avoid switching back and forth between the main application project and the test harness project,
315
+
see [Working with Multiple Projects in the Same VS Code Workspace](#working-with-multiple-projects-in-the-same-vs-code-workspace) for instructions on opening the test harness project in a separate VS Code window.
307
316
308
-
* Language support such as navigation and auto-completion is limited when editing test sources. A workaround is to modify the `ada.projectFile` setting to point to the test harness project created by GNATtest. That should restore language support when developing tests.
317
+
#### Limitations
318
+
319
+
* If you use a separate window to load the test harness project and edit tests, you have to go back to the main application project to benefit from the integration with the Test Explorer view (e.g. listing and searching for tests, running tests, etc...).
320
+
This limitation is planned to be lifted.
309
321
310
322
* Sections of test sources delimited by `begin read only` and `end read only` comments are not really protected from inadvertant edits.
311
323
To ensure proper interactions with GNATtest, you must refrain from making edits in those sections.
@@ -375,6 +387,54 @@ Once your project is setup, just open the VS Code
375
387
376
388
For more advanced use cases or if your program cannot be debugged remotely via GDB, you can try creating your custom VS Code debug launch configuration following [VS Code User's Guide for Launch Configurations](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations).
377
389
390
+
### Working with Multiple Projects in the Same VS Code Workspace
391
+
392
+
It is a possible for a workspace to contain multiple GPR projects.
393
+
For example, this is a typical scenario when working with GNATtest which generates (potentially multiple) test harness projects that contain test and stub sources that interface with the application code.
394
+
However, only one project can be loaded at a time with the `ada.projectFile` setting.
395
+
So you may find yourself switching back and forth between projects which can quickly become cumbersome.
396
+
397
+
This situation can be improved with [VS Code multi-root workspaces](https://code.visualstudio.com/docs/editing/workspaces/multi-root-workspaces). For example, in a workspace containing `prj1.gpr` and `prj2.gpr` it is possible to define the following two multi-root workspace files:
398
+
399
+
*`prj1.code-workspace`
400
+
401
+
```json
402
+
{
403
+
"folders": [
404
+
{
405
+
"path": "."
406
+
}
407
+
],
408
+
"settings": {
409
+
"ada.projectFile": "prj1.gpr"
410
+
}
411
+
}
412
+
```
413
+
414
+
*`prj2.code-workspace`
415
+
416
+
```json
417
+
{
418
+
"folders": [
419
+
{
420
+
"path": "."
421
+
}
422
+
],
423
+
"settings": {
424
+
"ada.projectFile": "prj2.gpr"
425
+
}
426
+
}
427
+
```
428
+
429
+
(while the name indicates _multi-root_, we are using a single root folder in each workspace)
430
+
431
+
Each of these workspaces can be opened in a different VS Code window, allowing to work on both projects side by side.
432
+
Alternatively, the root workspace materialized by `.vscode/settings.json` can be kept as the main workspace with `prj1.gpr`, and the other multi-root workspace is created as `prj2.code-workspace` for working with `prj2.gpr`.
433
+
434
+
In the use case of GNATtest, this allows us to load the main application project in a window and the test harness project in another window, and work on both simultaneously.
435
+
436
+
Note that a separate Ada Language Server instance is used for each VS Code window, so you might observe high memory consumption in this situation.
437
+
378
438
### Commands and Shortcuts
379
439
380
440
The extension contributes commands and a few default key bindings.
0 commit comments