From 3fb406f1eea0edde966e343b9610460fb0bd11e6 Mon Sep 17 00:00:00 2001 From: Nicolas Setton Date: Wed, 3 Jul 2024 10:40:31 +0000 Subject: [PATCH 1/2] XFAIL a test which is expected to fail for now Pending eng/libadalang/libadalang#1409 --- testsuite/ada_lsp/C825-005.xrefs.extending/test.yaml | 2 +- testsuite/ada_lsp/F131-024.xrefs.separate_body/test.yaml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/testsuite/ada_lsp/C825-005.xrefs.extending/test.yaml b/testsuite/ada_lsp/C825-005.xrefs.extending/test.yaml index 895f1dbea..7ff817d4b 100644 --- a/testsuite/ada_lsp/C825-005.xrefs.extending/test.yaml +++ b/testsuite/ada_lsp/C825-005.xrefs.extending/test.yaml @@ -1,6 +1,6 @@ title: 'C825-005.xrefs.extending' # This test needs a change of behaviour in gpr2, -# see https://gitlab.adacore-it.com/eng/gpr/gpr-issues/-/issues/328 +# see eng/gpr/gpr-issues#328 skip: - ['XFAIL', 'True'] diff --git a/testsuite/ada_lsp/F131-024.xrefs.separate_body/test.yaml b/testsuite/ada_lsp/F131-024.xrefs.separate_body/test.yaml index e51005203..832a9b08f 100644 --- a/testsuite/ada_lsp/F131-024.xrefs.separate_body/test.yaml +++ b/testsuite/ada_lsp/F131-024.xrefs.separate_body/test.yaml @@ -1 +1,6 @@ title: 'F131-024.xrefs.separate_body' + +# This test is expected to fail until eng/libadalang/libadalang#1409 +# is fixed. +skip: + - ['XFAIL', 'True'] From 2d1c7f2dfc787147206b1b3611133b064bbc2c34 Mon Sep 17 00:00:00 2001 From: Nicolas Setton Date: Wed, 3 Jul 2024 13:01:32 +0000 Subject: [PATCH 2/2] gpr server: fix project loading Call Update_Sources and Set_Context, and properly catch errors from these steps. For eng/gpr/gpr-issues#317 --- source/gpr/lsp-gpr_documents.adb | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/source/gpr/lsp-gpr_documents.adb b/source/gpr/lsp-gpr_documents.adb index b7f49f953..9106c8ea9 100644 --- a/source/gpr/lsp-gpr_documents.adb +++ b/source/gpr/lsp-gpr_documents.adb @@ -185,8 +185,9 @@ package body LSP.GPR_Documents is Self.Tree.Unload; declare - Opts : GPR2.Options.Object; - Success : Boolean; + Opts : GPR2.Options.Object; + Success : Boolean; + Update_Log : GPR2.Log.Object; begin Opts.Add_Switch (GPR2.Options.P, String (Self.File.Value)); @@ -198,16 +199,29 @@ package body LSP.GPR_Documents is Environment => LSP.GPR_Files.Environment); if Success then - Success := Self.Tree.Set_Context (Configuration.Context); + Self.Tree.Update_Sources (Update_Log); + if Update_Log.Has_Error then + Self.Has_Messages := True; + else + Success := Self.Tree.Set_Context (Configuration.Context); + end if; end if; if not Success then - for C in Self.Tree.Log_Messages.Iterate loop - Self.Tracer.Trace (C.Element.Format); - Self.Messages.Append (C.Element); - end loop; Self.Has_Messages := True; end if; + + -- Collect all messages coming from Load... + for C in Self.Tree.Log_Messages.Iterate loop + Self.Tracer.Trace (C.Element.Format); + Self.Messages.Append (C.Element); + end loop; + + -- ... and all messages coming from Update_Sources + for C in Update_Log.Iterate loop + Self.Tracer.Trace (C.Element.Format); + Self.Messages.Append (C.Element); + end loop; end; Update_Diagnostics;