diff --git a/.markdownlint.jsonc b/.markdownlint.jsonc
new file mode 100644
index 000000000..3622a5dc6
--- /dev/null
+++ b/.markdownlint.jsonc
@@ -0,0 +1,7 @@
+{
+ "no-inline-html": {
+ "allowed_elements": ["img"]
+ },
+ "line-length": false,
+ "ul-style": false
+}
diff --git a/README.md b/README.md
index 76f9cd31c..45940de8b 100644
--- a/README.md
+++ b/README.md
@@ -52,6 +52,7 @@ extension at
- [Tasks](#tasks)
- [Task Customization](#task-customization)
- [Tasks for Project Mains](#tasks-for-project-mains)
+ - [GNATtest Support](#gnattest-support)
- [ALIRE Support](#alire-support)
- [Commands and Shortcuts](#commands-and-shortcuts)
- [Ada: Go to other file](#ada-go-to-other-file)
@@ -71,7 +72,6 @@ extension at
- [Contribute](#contribute)
- [License](#license)
-
## Install
You can build language server from sources.
@@ -275,6 +275,34 @@ For example, if the project defines a `main1.adb` and `main2.adb` located under
* `ada: Run main - src/main2.adb`
* `ada: Build and run main - src/main2.adb`
+#### GNATtest Support
+
+If you install GNATtest, the Ada & SPARK extension for VS Code will provide the following functionalities:
+
+* The task `ada: Create/update test skeletons for the project` will call `gnattest` to create test skeletons for your project automatically. You can use standard VS Code task customization to configure command line arguments to your liking in a `tasks.json` file.
+
+* Tests created with GNATtest will be loaded in the VS Code **Testing** view as follows.
+
+
+
+* 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.
+
+* Test execution results are reflected in the test tree.
+
+
+
+GNATtest support has the following known limitations:
+
+* The extension relies on the default conventions of GNATtest such as the naming, location and object directory of the test harness project.
+ If those aspects are configured or altered manually, the features may no longer work.
+
+* Test execution always starts with a `gprbuild` call on the test harness project. It is not possible to disable that call or customize its arguments. This limitation will be lifted in future releases.
+
+* 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.
+
+* Sections of test sources delimited by `begin read only` and `end read only` comments are not really protected from inadvertant edits.
+ To ensure proper interactions with GNATtest, you must refrain from making edits in those sections.
+
#### ALIRE Support
When the workspace is an ALIRE project (i.e. it contains an `alire.toml` file), tasks automatically use standard ALIRE commands.
diff --git a/doc/gnattest-results.png b/doc/gnattest-results.png
new file mode 100644
index 000000000..8cf649d9b
Binary files /dev/null and b/doc/gnattest-results.png differ
diff --git a/doc/gnattest-test-tree.png b/doc/gnattest-test-tree.png
new file mode 100644
index 000000000..5494882ad
Binary files /dev/null and b/doc/gnattest-test-tree.png differ
diff --git a/doc/traces.md b/doc/traces.md
index f8eff7ae6..20e658576 100644
--- a/doc/traces.md
+++ b/doc/traces.md
@@ -1,22 +1,27 @@
# ALS Trace File
-Default trace file name is `$HOME/.als/traces.cfg`.
-You can provide another file by `--tracefile=` command line option.
+Default trace file name is `$HOME/.als/traces.cfg`. This file gets automatically created
+if not present on the disk. The first line of the traces file
+defines the traces output stream (a filename in our case) and the other
+lines are used to enable or disable traces.
-Here is a list of supported settings.
+Note that you can provide another traces file via the `--tracefile=` command line option.
+
+Here is a list of the most useful supported traces:
## `ALS.IN` (default no)
-Show all the server input. Use this way:
+Shows all the server's input. Use this way:
- ALS.IN=yes > inout.txt:buffer_size=0
+ ALS.IN=yes
## `ALS.OUT` (default no)
-Show all the server output. Use this way:
+Shows all the server's output. Use this way:
- ALS.OUT=yes > inout.txt:buffer_size=0
+ ALS.OUT=yes
-## `ALS.MAIN` (default no)
-Trace requests, notifications and responses in an ALS log file.
+## `ALS.MAIN` (default yes)
+Trace requests, notifications and responses in ALS log files. Will
+also log any exception that occurs when handling LSP requests.
ALS.MAIN=yes
diff --git a/source/ada/lsp-ada_driver.adb b/source/ada/lsp-ada_driver.adb
index b56e991ac..889b05461 100644
--- a/source/ada/lsp-ada_driver.adb
+++ b/source/ada/lsp-ada_driver.adb
@@ -17,6 +17,7 @@
--
-- This is driver to run LSP server for Ada language.
+with Ada.Characters.Latin_1;
with Ada.Text_IO;
with Ada.Strings.Unbounded;
with GNAT.OS_Lib;
@@ -257,6 +258,14 @@ procedure LSP.Ada_Driver is
GNATdebug : constant Virtual_File := Create_From_Base
(".gnatdebug");
+ Default_Traces_File_Contents : constant String :=
+ ">als.$T.txt:buffer_size=0" & Ada.Characters.Latin_1.LF
+ & "ALS.MAIN=yes" & Ada.Characters.Latin_1.LF
+ & "ALS.IN=no" & Ada.Characters.Latin_1.LF
+ & "ALS.OUT=no" & Ada.Characters.Latin_1.LF;
+
+ Traces_File : Virtual_File;
+
Trace_File_Option : constant VSS.Command_Line.Value_Option :=
(Short_Name => "",
Long_Name => "tracefile",
@@ -309,31 +318,42 @@ begin
-- - in a .gnatdebug file locally
-- - in "traces.cfg" in the ALS home directory
if VSS.Command_Line.Is_Specified (Trace_File_Option) then
- declare
- Traces_File : constant Virtual_File := Create_From_UTF8
- (VSS.Strings.Conversions.To_UTF_8_String
- (VSS.Command_Line.Value (Trace_File_Option)));
- begin
- if not Traces_File.Is_Regular_File then
- Ada.Text_IO.Put_Line ("Could not find the specified traces file");
- GNAT.OS_Lib.OS_Exit (1);
- end if;
+ Traces_File := Create_From_UTF8
+ (VSS.Strings.Conversions.To_UTF_8_String
+ (VSS.Command_Line.Value (Trace_File_Option)));
+ if not Traces_File.Is_Regular_File then
+ Ada.Text_IO.Put_Line ("Could not find the specified traces file");
+ GNAT.OS_Lib.OS_Exit (1);
+ end if;
+
+ Parse_Config_File (Traces_File);
- Parse_Config_File (Traces_File);
- end;
elsif GNATdebug.Is_Regular_File then
Parse_Config_File (GNATdebug);
- elsif ALS_Dir.Is_Directory then
- Clean_ALS_Dir := True;
+ else
+ -- No $HOME/.als directory: create one first
+ if not ALS_Dir.Is_Directory then
+ Make_Dir (ALS_Dir);
+ end if;
- -- Search for custom traces config in traces.cfg
- Parse_Config_File (+Virtual_File'(ALS_Dir / "traces.cfg").Full_Name);
+ Traces_File := Create_From_Dir
+ (Dir => ALS_Dir,
+ Base_Name => "traces.cfg");
+
+ -- No default traces file found: create one
+ if not Traces_File.Is_Regular_File then
+ declare
+ W_Traces_File : Writable_File;
+ begin
+ W_Traces_File := Traces_File.Write_File;
+ W_Traces_File.Write (Default_Traces_File_Contents);
+ W_Traces_File.Close;
+ end;
+ end if;
- -- Set log file
- Set_Default_Stream
- (">" & (+Virtual_File'(ALS_Dir / "als").Full_Name) &
- ".$T.$$.log:buffer_size=0");
+ Clean_ALS_Dir := True;
+ Parse_Config_File (Traces_File);
end if;
-- Look for a config file, that contains the configuration for the server
diff --git a/testsuite/.als/traces.cfg b/testsuite/.als/traces.cfg
index c6befc953..beb53354e 100644
--- a/testsuite/.als/traces.cfg
+++ b/testsuite/.als/traces.cfg
@@ -20,3 +20,6 @@ ALS.RUNTIME_INDEXING=no
# Disable advanced PP formatting of snippet for most tests
ALS.COMPLETION.FORMATTING=no
+
+# Disable logging in LSP formatting module
+ALS.FORMATTING=no