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
@@ -254,7 +255,15 @@ For example, if the project defines a `main1.adb` and `main2.adb` located under
254
255
*`ada: Run main - src/main2.adb`
255
256
*`ada: Build and run main - src/main2.adb`
256
257
257
-
#### GNATtest Support
258
+
### Alire Support
259
+
260
+
When the workspace is an Alire crate (i.e. it contains an `alire.toml` file), the extension uses Alire to determine the GPR project that should be loaded and to obtain an environment where the crate's dependencies have been provisioned.
261
+
262
+
Moreover when working with an Alire crate, VS Code tasks automatically use standard Alire commands. For example, the `ada: Build current project` task uses the command `alr build` and the `ada: Clean current project` task uses the command `alr clean`.
263
+
264
+
All other tasks use `alr exec -- ...` to execute the command in the environment provided by Alire.
265
+
266
+
### GNATtest Support
258
267
259
268
If you install GNATtest, the Ada & SPARK extension for VS Code will provide the following functionalities:
260
269
@@ -264,15 +273,15 @@ If you install GNATtest, the Ada & SPARK extension for VS Code will provide the
264
273
265
274
* Tests created with GNATtest will be loaded in the VS Code **Testing** view as follows.
266
275
267
-
<imgsrc="doc/gnattest-test-tree.png"width="650"alt="GNATtest Test Tree">
276
+
<imgsrc="doc/gnattest-test-tree.png"width="650"alt="GNATtest Test Tree"/>
268
277
269
278
* Tests can be executed individually or in batch through the available buttons in the interface, or through the `Test: Run All Tests` command or related commands.
270
279
271
280
* Test execution always starts by executing the `ada: Build GNATtest test harness project` task to make sure that test executables are up to date.
272
281
273
282
* Test execution results are reflected in the test tree.
274
283
275
-
<imgsrc="doc/gnattest-results.png"width="500"alt="GNATtest Test Results">
284
+
<imgsrc="doc/gnattest-results.png"width="500"alt="GNATtest Test Results"/>
276
285
277
286
GNATtest support has the following known limitations:
278
287
@@ -284,13 +293,34 @@ GNATtest support has the following known limitations:
284
293
* Sections of test sources delimited by `begin read only` and `end read only` comments are not really protected from inadvertant edits.
285
294
To ensure proper interactions with GNATtest, you must refrain from making edits in those sections.
286
295
287
-
#### ALIRE Support
296
+
### GNATcoverage Support
297
+
298
+
GNATcoverage coverage reports can be imported in VS Code as follows:
299
+
300
+
1. Instruct GNATcoverage to produce an [XML report](https://docs.adacore.com/live/wave/gnatdas/html/gnatdas_ug/gnatcov/cov_source.html#xml-report-xml-xml)
301
+
2. Invoke the VS Code command `ada: GNATcoverage - Load an existing XML coverage report`
302
+
3. Browse to the location of the GNATcoverage XML report and select the `index.xml` file
303
+
304
+
<imgsrc="doc/gnatcov-report.png"width="1000"alt="GNATcoverage report in VS Code" />
305
+
306
+
Note that importing coverage reports does not require GNATcoverage to be installed. In particular, this enables a workflow where the coverage report is produced in CI and downloaded and imported into VS Code for visualization and analysis.
307
+
308
+
The GNATtest integration in VS Code also supports running tests in coverage mode, if GNATcoverage is installed on the development machine.
288
309
289
-
When the workspace is an ALIRE project (i.e. it contains an `alire.toml` file), tasks automatically use standard ALIRE commands.
310
+
1. Run the task `ada: GNATcoverage - Setup runtime library` once to set up the GNATcoverage runtime library
311
+
2. If you don't already have a test harness project created, use the task `ada: Create or update GNATtest test framework` to create one
312
+
3. Switch to the _Test Explorer_ view or use the `Testing: Focus on Test Explorer View` command to do that
313
+
4. Run the tests in coverage mode using the command `Test: Run All Tests with Coverage`, or use the "play" icon next to a single test or group of tests with the label _Run Test with Coverage_.
For example, the `ada: Build current project` task uses the command `alr build` and the `ada: Clean current project` task uses the command `alr clean`.
321
+
<imgsrc="doc/gnattest-gnatcov.png"width="1000"alt="GNATtest with GNATcoverage in VS Code" />
292
322
293
-
All other tasks use `alr exec -- ...` to execute the command in the environment provided by ALIRE.
323
+
Integrating the steps of source instrumentation and test harness build into the test execution workflow allows for a quick feedback loop: run a test, observe results and coverage, edit the test or the tested code, repeat... In this context invoking the VS Code commands `Test: Rerun Last Run` and `Test: Rerun Last Run with Coverage` with their respective keyboard shortcuts can be valuable.
294
324
295
325
### Commands and Shortcuts
296
326
@@ -349,13 +379,13 @@ The VS Code extension has a few limitations and some differences compared to [GN
349
379
***Indentation/formatting**: it does not support automatic indentation when adding a newline and range/document
350
380
formatting might no succeed on incomplete/illegal code.
351
381
352
-
***Tooling support**: we currently provide support for some *SPARK*, *GNATtest*and *GNAT SAS*[Tasks](#tasks), but there is no support for tools such as *GNATcheck* or *GNATcoverage* yet.
382
+
***Tooling support**: we currently provide support for some *SPARK*, *GNATtest*, *GNATcoverage*and *GNAT SAS*[Tasks](#tasks), but some workflows may not be supported yet.
353
383
354
384
***Alire support**: if the root folder contains an `alire.toml` file and
355
385
there is `alr` executable in the `PATH`, then the language server fetches
356
386
the project's search path, environment variables and the project's file
357
387
name from the crate description. [Tasks](#tasks) are also automatically
358
-
invoked with ALIRE in this case.
388
+
invoked with Alire in this case.
359
389
360
390
***Project support**: there is no `Scenario` view: users should configure scenarios via the *ada.scenarioVariables* setting (see the settings list available [here](doc/settings.md)). Saving the settings file after changing the values will automatically reload the project and update the
361
391
predefined tasks to take into account the new scenario values.
0 commit comments