Skip to content

Commit e50444e

Browse files
committed
Merge branch 'topic/als-config-comments' into 'master'
Support comments in ALS JSON configuration files Closes #1577 See merge request eng/ide/ada_language_server!1882
2 parents d40ef7d + 8f967df commit e50444e

File tree

7 files changed

+32
-2
lines changed

7 files changed

+32
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
section below it for the last release. -->
55
## \<next>
66

7+
* Support single-line (`//`) and multi-line (`/* */`) comments in ALS JSON configuration files
8+
79
## 26.0.202412190
810

911
* The configured project is now automatically reloaded when adding/renaming/deleting a file in a known source directory.

integration/vscode/ada/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,9 @@
914914
"[ada]": {
915915
"editor.tabSize": 3,
916916
"editor.detectIndentation": false
917+
},
918+
"files.associations": {
919+
".als.json": "jsonc"
917920
}
918921
},
919922
"walkthroughs": [

source/ada/lsp-ada_configurations.adb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ with GNATCOLL.VFS;
2525
with LSP.GNATCOLL_Tracers;
2626
with LSP.Utils;
2727

28-
with VSS.JSON.Pull_Readers.Simple;
28+
with VSS.JSON.Pull_Readers.JSON5;
2929
with VSS.JSON.Streams;
3030
with VSS.Strings.Conversions;
3131
with VSS.Strings.Formatters.Booleans;
@@ -384,7 +384,7 @@ package body LSP.Ada_Configurations is
384384
File : VSS.Strings.Virtual_String)
385385
is
386386
Input : aliased VSS.Text_Streams.File_Input.File_Input_Text_Stream;
387-
Reader : VSS.JSON.Pull_Readers.Simple.JSON_Simple_Pull_Reader;
387+
Reader : VSS.JSON.Pull_Readers.JSON5.JSON5_Pull_Reader;
388388
JSON : LSP.Structures.LSPAny;
389389
begin
390390
Input.Open (File, "utf-8");
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
// Single line comment
3+
/* multi-line
4+
comment
5+
*/
6+
"projectFile": "non-root/p2.gpr"
7+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
project P2 is
2+
end P2;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""
2+
The goal of this test is to check that comments are supported in .als.json files
3+
4+
To test that, we create a non-root/p2.gpr project file and configure it in a .als.json
5+
with comments. We can determine if the config loading was successful (i.e. comments are
6+
supported) by querying for the current project.
7+
"""
8+
9+
from drivers.pylsp import URI, ALSLanguageClient, assertEqual, test
10+
11+
12+
@test()
13+
async def func(lsp: ALSLanguageClient) -> None:
14+
response = await lsp.getCurrentProject()
15+
assertEqual(response, URI("non-root/p2.gpr"))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
driver: pylsp

0 commit comments

Comments
 (0)