Skip to content

Commit 410891a

Browse files
Merge branch 'topic/eng/ide/gnatstudio#400' into 'master'
Don't create empty project diagnostics See merge request eng/ide/ada_language_server!1755
2 parents d76b239 + 3143c2a commit 410891a

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

source/ada/lsp-ada_project_loading.adb

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,23 +170,28 @@ package body LSP.Ada_Project_Loading is
170170
use GPR2.Message;
171171
begin
172172
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
174178
declare
175179
Sloc : constant GPR2.Source_Reference.Object :=
176180
GPR2.Message.Sloc (Msg);
177181
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);
183187
begin
184188
-- Display a diagnostic for GPR2 messages only if the file
185189
-- attached to the message is defined.
186190
if File.Is_Defined and then File.Has_Value then
187191
Parent_Diagnostic.relatedInformation.Append
188192
(LSP.Structures.DiagnosticRelatedInformation'
189-
(location => LSP.Structures.Location'
193+
(location =>
194+
LSP.Structures.Location'
190195
(uri => LSP.Utils.To_URI (File),
191196
a_range => LSP.Utils.To_Range (Sloc),
192197
others => <>),

0 commit comments

Comments
 (0)