Skip to content

Commit 1b2924a

Browse files
Merge branch 'topic/als.1423.remove_project_problem_row' into 'master'
Change project diagnostics format See merge request eng/ide/ada_language_server!1706
2 parents 8a633f2 + 00b2b9a commit 1b2924a

File tree

29 files changed

+58
-1004
lines changed

29 files changed

+58
-1004
lines changed

source/ada/lsp-ada_project_loading.adb

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ package body LSP.Ada_Project_Loading is
8686
("The project file has errors and could not be loaded.");
8787
when Valid_Project_With_Warning =>
8888
return VSS.Strings.To_Virtual_String
89-
("The project file was loaded but contains Warnings.");
89+
("The project file was loaded but contains warnings.");
9090
end case;
9191
end Load_Status_Message;
9292

@@ -159,17 +159,7 @@ package body LSP.Ada_Project_Loading is
159159
Parent_Diagnostic.source := "ada.project";
160160
Parent_Diagnostic.severity :=
161161
(True, Load_Status_Severity (Project));
162-
163-
Parent_Diagnostic.message := "Project Problems";
164-
Parent_Diagnostic.relatedInformation.Append
165-
(LSP.Structures.DiagnosticRelatedInformation'
166-
(location =>
167-
LSP.Structures.Location'
168-
(uri => Project_URI,
169-
a_range => Backup_Sloc,
170-
others => <>),
171-
message =>
172-
Load_Status_Message (Project)));
162+
Parent_Diagnostic.message := Load_Status_Message (Project);
173163
end Create_Project_Loading_Diagnostic;
174164

175165
-----------------------------
@@ -178,7 +168,6 @@ package body LSP.Ada_Project_Loading is
178168

179169
procedure Append_GPR2_Diagnostics is
180170
use GPR2.Message;
181-
use LSP.Enumerations;
182171
begin
183172
for Msg of GPR2_Messages loop
184173
if Msg.Level in GPR2.Message.Warning .. GPR2.Message.Error then
@@ -206,19 +195,6 @@ package body LSP.Ada_Project_Loading is
206195
(Msg.Message)));
207196
end if;
208197
end;
209-
210-
-- If we have one error in the GPR2 messages, the parent
211-
-- diagnostic's severity should be "error" too, otherwise
212-
-- "warning".
213-
if Msg.Level = GPR2.Message.Error then
214-
Parent_Diagnostic.severity :=
215-
(True, LSP.Enumerations.Error);
216-
elsif Parent_Diagnostic.severity.Value /=
217-
LSP.Enumerations.Error
218-
then
219-
Parent_Diagnostic.severity :=
220-
(True, LSP.Enumerations.Warning);
221-
end if;
222198
end if;
223199
end loop;
224200
end Append_GPR2_Diagnostics;

testsuite/ada_lsp/editor.incremental/test.json

Lines changed: 10 additions & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -418,24 +418,7 @@
418418
},
419419
"severity": 2,
420420
"source": "ada.project",
421-
"message": "Project Problems",
422-
"relatedInformation": [
423-
{
424-
"location": {
425-
"uri": "",
426-
"range": {
427-
"start": {
428-
"line": 0,
429-
"character": 0
430-
},
431-
"end": {
432-
"line": 0,
433-
"character": 0
434-
}
435-
}
436-
},
437-
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."
438-
} ]}
421+
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."}
439422
]
440423
},
441424
"method": "textDocument/publishDiagnostics"
@@ -484,24 +467,7 @@
484467
},
485468
"severity": 2,
486469
"source": "ada.project",
487-
"message": "Project Problems",
488-
"relatedInformation": [
489-
{
490-
"location": {
491-
"uri": "",
492-
"range": {
493-
"start": {
494-
"line": 0,
495-
"character": 0
496-
},
497-
"end": {
498-
"line": 0,
499-
"character": 0
500-
}
501-
}
502-
},
503-
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."
504-
} ]}
470+
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."}
505471
]
506472
},
507473
"method": "textDocument/publishDiagnostics"
@@ -563,24 +529,7 @@
563529
},
564530
"severity": 2,
565531
"source": "ada.project",
566-
"message": "Project Problems",
567-
"relatedInformation": [
568-
{
569-
"location": {
570-
"uri": "",
571-
"range": {
572-
"start": {
573-
"line": 0,
574-
"character": 0
575-
},
576-
"end": {
577-
"line": 0,
578-
"character": 0
579-
}
580-
}
581-
},
582-
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."
583-
} ]}
532+
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."}
584533
]
585534
},
586535
"method": "textDocument/publishDiagnostics"
@@ -629,24 +578,7 @@
629578
},
630579
"severity": 2,
631580
"source": "ada.project",
632-
"message": "Project Problems",
633-
"relatedInformation": [
634-
{
635-
"location": {
636-
"uri": "",
637-
"range": {
638-
"start": {
639-
"line": 0,
640-
"character": 0
641-
},
642-
"end": {
643-
"line": 0,
644-
"character": 0
645-
}
646-
}
647-
},
648-
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."
649-
} ]}
581+
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."}
650582
]
651583
},
652584
"method": "textDocument/publishDiagnostics"
@@ -721,24 +653,7 @@
721653
},
722654
"severity": 2,
723655
"source": "ada.project",
724-
"message": "Project Problems",
725-
"relatedInformation": [
726-
{
727-
"location": {
728-
"uri": "",
729-
"range": {
730-
"start": {
731-
"line": 0,
732-
"character": 0
733-
},
734-
"end": {
735-
"line": 0,
736-
"character": 0
737-
}
738-
}
739-
},
740-
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."
741-
} ]}
656+
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."}
742657
]
743658
},
744659
"method": "textDocument/publishDiagnostics"
@@ -787,24 +702,7 @@
787702
},
788703
"severity": 2,
789704
"source": "ada.project",
790-
"message": "Project Problems",
791-
"relatedInformation": [
792-
{
793-
"location": {
794-
"uri": "",
795-
"range": {
796-
"start": {
797-
"line": 0,
798-
"character": 0
799-
},
800-
"end": {
801-
"line": 0,
802-
"character": 0
803-
}
804-
}
805-
},
806-
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."
807-
} ]}
705+
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."}
808706
]
809707
},
810708
"method": "textDocument/publishDiagnostics"
@@ -879,24 +777,7 @@
879777
},
880778
"severity": 2,
881779
"source": "ada.project",
882-
"message": "Project Problems",
883-
"relatedInformation": [
884-
{
885-
"location": {
886-
"uri": "",
887-
"range": {
888-
"start": {
889-
"line": 0,
890-
"character": 0
891-
},
892-
"end": {
893-
"line": 0,
894-
"character": 0
895-
}
896-
}
897-
},
898-
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."
899-
} ]}
780+
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."}
900781
]
901782
},
902783
"method": "textDocument/publishDiagnostics"
@@ -945,24 +826,7 @@
945826
},
946827
"severity": 2,
947828
"source": "ada.project",
948-
"message": "Project Problems",
949-
"relatedInformation": [
950-
{
951-
"location": {
952-
"uri": "",
953-
"range": {
954-
"start": {
955-
"line": 0,
956-
"character": 0
957-
},
958-
"end": {
959-
"line": 0,
960-
"character": 0
961-
}
962-
}
963-
},
964-
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."
965-
} ]}
829+
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."}
966830
]
967831
},
968832
"method": "textDocument/publishDiagnostics"
@@ -1037,24 +901,7 @@
1037901
},
1038902
"severity": 2,
1039903
"source": "ada.project",
1040-
"message": "Project Problems",
1041-
"relatedInformation": [
1042-
{
1043-
"location": {
1044-
"uri": "",
1045-
"range": {
1046-
"start": {
1047-
"line": 0,
1048-
"character": 0
1049-
},
1050-
"end": {
1051-
"line": 0,
1052-
"character": 0
1053-
}
1054-
}
1055-
},
1056-
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."
1057-
} ]}
904+
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."}
1058905
]
1059906
},
1060907
"method": "textDocument/publishDiagnostics"
@@ -1103,24 +950,7 @@
1103950
},
1104951
"severity": 2,
1105952
"source": "ada.project",
1106-
"message": "Project Problems",
1107-
"relatedInformation": [
1108-
{
1109-
"location": {
1110-
"uri": "",
1111-
"range": {
1112-
"start": {
1113-
"line": 0,
1114-
"character": 0
1115-
},
1116-
"end": {
1117-
"line": 0,
1118-
"character": 0
1119-
}
1120-
}
1121-
},
1122-
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."
1123-
} ]}
953+
"message": "No project was found in the root directory. Please create a GPR project file and add it to the configuration."}
1124954
]
1125955
},
1126956
"method": "textDocument/publishDiagnostics"

testsuite/ada_lsp/project_config.missing_file/test.json

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,26 +77,10 @@
7777
"start": { "line": 0, "character": 0 },
7878
"end": { "line": 0, "character": 0 }
7979
},
80-
"severity": 1,
80+
"severity": 2,
8181
"source": "ada.project",
82-
"message": "Project Problems",
82+
"message": "The project file was loaded but contains warnings.",
8383
"relatedInformation": [
84-
{
85-
"location": {
86-
"uri": "$URI{prj1.gpr}",
87-
"range": {
88-
"start": {
89-
"line": 0,
90-
"character": 0
91-
},
92-
"end": {
93-
"line": 0,
94-
"character": 0
95-
}
96-
}
97-
},
98-
"message": "The project file was loaded but contains Warnings."
99-
},
10084
{
10185
"location": {
10286
"uri": "$URI{prj1.gpr}",

0 commit comments

Comments
 (0)