@@ -170,23 +170,28 @@ package body LSP.Ada_Project_Loading is
170
170
use GPR2.Message;
171
171
begin
172
172
for Msg of GPR2_Messages loop
173
- if Msg.Level in GPR2.Message.Warning .. GPR2.Message.Error then
173
+ -- Display a diagnostic only if we are dealing with an error or
174
+ -- a warning, with a non-empty message attached to it.
175
+ if Msg.Level in GPR2.Message.Warning .. GPR2.Message.Error
176
+ and then Msg.Message /= " "
177
+ then
174
178
declare
175
179
Sloc : constant GPR2.Source_Reference.Object :=
176
180
GPR2.Message.Sloc (Msg);
177
181
File : constant GPR2.Path_Name.Object :=
178
- (if Sloc.Is_Defined then
179
- GPR2.Path_Name.Create_File
180
- ( GPR2.Filename_Type (Sloc.Filename))
181
- else
182
- GPR2.Path_Name.Undefined);
182
+ (if Sloc.Is_Defined
183
+ then
184
+ GPR2.Path_Name.Create_File
185
+ (GPR2.Filename_Type (Sloc.Filename))
186
+ else GPR2.Path_Name.Undefined);
183
187
begin
184
188
-- Display a diagnostic for GPR2 messages only if the file
185
189
-- attached to the message is defined.
186
190
if File.Is_Defined and then File.Has_Value then
187
191
Parent_Diagnostic.relatedInformation.Append
188
192
(LSP.Structures.DiagnosticRelatedInformation'
189
- (location => LSP.Structures.Location'
193
+ (location =>
194
+ LSP.Structures.Location'
190
195
(uri => LSP.Utils.To_URI (File),
191
196
a_range => LSP.Utils.To_Range (Sloc),
192
197
others => <>),
0 commit comments