File tree Expand file tree Collapse file tree 9 files changed +147
-7
lines changed
testsuite/ada_lsp/commands.executables.aggregate Expand file tree Collapse file tree 9 files changed +147
-7
lines changed Original file line number Diff line number Diff line change @@ -55,18 +55,21 @@ package body LSP.Ada_Handlers.Executables_Commands is
5555 end Append ;
5656
5757 Value : VSS.Strings.Virtual_String;
58- Element : GPR2.Project.View.Object;
5958 begin
6059 Response := (Is_Null => False, Value => <>);
6160 Append ((Kind => VSS.JSON.Streams.Start_Array));
6261
6362 if Handler.Project_Tree.Is_Defined then
64- Element := Handler.Project_Tree.Root_Project;
65-
66- for Exec of Element.Executables loop
67- Value := VSS.Strings.Conversions.To_Virtual_String
68- (String (Exec.Value));
69- Append ((VSS.JSON.Streams.String_Value, Value));
63+ -- Iterate over all the root projects defined in the project tree
64+ -- to handle aggregate projects properly (i.e: by combining the
65+ -- executables defined for each aggregated project).
66+ for View of Handler.Project_Tree.Namespace_Root_Projects loop
67+ for Exec of View.Executables loop
68+ Value :=
69+ VSS.Strings.Conversions.To_Virtual_String
70+ (String (Exec.Value));
71+ Append ((VSS.JSON.Streams.String_Value, Value));
72+ end loop ;
7073 end loop ;
7174 end if ;
7275
Original file line number Diff line number Diff line change 1+ aggregate project Aggr is
2+ for Project_Files use ("project_1.gpr", "project_2.gpr");
3+ end Aggr;
Original file line number Diff line number Diff line change 1+ procedure Main_1 is
2+ begin
3+ null ;
4+ end Main_1 ;
Original file line number Diff line number Diff line change 1+ procedure Main_2 is
2+ begin
3+ null ;
4+ end Main_2 ;
Original file line number Diff line number Diff line change 1+ procedure Main_3 is
2+ begin
3+ null ;
4+ end Main_3 ;
Original file line number Diff line number Diff line change 1+ project Project_1 is
2+ for Main use ("main_1.adb", "main_2.adb");
3+
4+ package Builder is
5+ for Executable_Suffix use "";
6+ end Builder;
7+
8+ end Project_1;
Original file line number Diff line number Diff line change 1+ project Project_2 is
2+ for Main use ("main_3.adb");
3+
4+ package Builder is
5+ for Executable_Suffix use "";
6+ end Builder;
7+ end Project_2;
Original file line number Diff line number Diff line change 1+ [
2+ {
3+ "comment" : [
4+ " Check als-executable command for aggregate projects. " ,
5+ " The result should combine all the executables of all the projects being aggregated."
6+ ]
7+ },
8+ {
9+ "start" : {
10+ "cmd" : [" ${ALS}" ]
11+ }
12+ },
13+ {
14+ "send" : {
15+ "request" : {
16+ "jsonrpc" : " 2.0" ,
17+ "id" : 0 ,
18+ "method" : " initialize" ,
19+ "params" : {
20+ "processId" : 1 ,
21+ "rootUri" : " $URI{.}" ,
22+ "capabilities" : {}
23+ }
24+ },
25+ "wait" : [
26+ {
27+ "id" : 0 ,
28+ "result" : {
29+ "capabilities" : {
30+ "textDocumentSync" : 2 ,
31+ "executeCommandProvider" : {
32+ "commands" : [" <HAS>" , " als-executables" ]
33+ }
34+ }
35+ }
36+ }
37+ ]
38+ }
39+ },
40+ {
41+ "send" : {
42+ "request" : {
43+ "jsonrpc" : " 2.0" ,
44+ "method" : " workspace/didChangeConfiguration" ,
45+ "params" : {
46+ "settings" : {
47+ "ada" : {
48+ "projectFile" : " $URI{aggr.gpr}"
49+ }
50+ }
51+ }
52+ },
53+ "wait" : [
54+ {
55+ "jsonrpc" : " 2.0" ,
56+ "id" : 1 ,
57+ "method" : " window/workDoneProgress/create" ,
58+ "params" : {
59+ "token" : " <ANY>"
60+ }
61+ }
62+ ]
63+ }
64+ },
65+ {
66+ "send" : {
67+ "request" : {
68+ "jsonrpc" : " 2.0" ,
69+ "id" : " sw1" ,
70+ "method" : " workspace/executeCommand" ,
71+ "params" : {
72+ "command" : " als-executables"
73+ }
74+ },
75+ "wait" : [
76+ {
77+ "jsonrpc" : " 2.0" ,
78+ "id" : " sw1" ,
79+ "result" : [" $FILE{main_1}" , " $FILE{main_2}" , " $FILE{main_3}" ]
80+ }
81+ ]
82+ }
83+ },
84+ {
85+ "send" : {
86+ "request" : {
87+ "jsonrpc" : " 2.0" ,
88+ "id" : " shutdown" ,
89+ "method" : " shutdown" ,
90+ "params" : null
91+ },
92+ "wait" : [{ "id" : " shutdown" , "result" : null }]
93+ }
94+ },
95+ {
96+ "send" : {
97+ "request" : { "jsonrpc" : " 2.0" , "method" : " exit" },
98+ "wait" : []
99+ }
100+ },
101+ {
102+ "stop" : {
103+ "exit_code" : 0
104+ }
105+ }
106+ ]
Original file line number Diff line number Diff line change 1+ title : ' commands.executables.aggregate'
You can’t perform that action at this time.
0 commit comments