Skip to content

Commit 811cb18

Browse files
BoulangerAdrienBoulanger
Boulanger
authored andcommitted
Project loading failing when projects were sharing the same name
Contexts were creating using the base_name of the project which can create conflict when multiple project are sharing the same name. Use the project full path instead. For eng/ide/gnatstudio#305
1 parent 9663cec commit 811cb18

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

source/ada/lsp-ada_contexts.adb

+4-1
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,11 @@ package body LSP.Ada_Contexts is
729729
end Pretty_Printer_Setup;
730730

731731
begin
732+
-- Use the full path for the ID to avoid conflict when project are
733+
-- sharing the same name. For example for GNATTest stubs.
732734
Self.Id := VSS.Strings.Conversions.To_Virtual_String
733-
(String (Root.Name));
735+
(URIs.Conversions.From_File
736+
(String (Root.Path_Name.Value)));
734737
Self.Tree := Tree.Reference;
735738
Self.Charset := Ada.Strings.Unbounded.To_Unbounded_String (Charset);
736739

source/ada/lsp-ada_handlers-project_loading.adb

+2
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ package body LSP.Ada_Handlers.Project_Loading is
299299
Root => View,
300300
Charset => VSS.Strings.Conversions.To_UTF_8_String (Charset));
301301

302+
Self.Tracer.Trace ("Prepend Context Id: "
303+
& VSS.Strings.Conversions.To_UTF_8_String (C.Id));
302304
Self.Contexts.Prepend (C);
303305
end Create_Context_For_Non_Aggregate;
304306

0 commit comments

Comments
 (0)