@@ -59,23 +59,24 @@ package body LSP.Ada_Handlers.Project_Loading is
59
59
LSP.GNATCOLL_Tracers.Create (" ALS.PROJECT" , GNATCOLL.Traces.On);
60
60
61
61
Runtime_Indexing : constant GNATCOLL.Traces.Trace_Handle :=
62
- GNATCOLL.Traces.Create (" ALS.RUNTIME_INDEXING" ,
63
- GNATCOLL.Traces.On);
62
+ GNATCOLL.Traces.Create (" ALS.RUNTIME_INDEXING" , GNATCOLL.Traces.On);
64
63
-- Trace to enable/disable runtime indexing. Useful for the testsuite.
65
64
66
65
type GPR2_Reporter is new GPR2.Reporter.Object with record
67
66
Log : GPR2.Log.Object;
68
67
end record ;
69
68
70
- overriding procedure Internal_Report
71
- (Self : in out GPR2_Reporter;
72
- Msg : GPR2.Message.Object);
69
+ overriding
70
+ procedure Internal_Report
71
+ (Self : in out GPR2_Reporter; Msg : GPR2.Message.Object);
73
72
74
- overriding function Verbosity
73
+ overriding
74
+ function Verbosity
75
75
(Self : GPR2_Reporter) return GPR2.Reporter.Verbosity_Level
76
76
is (GPR2.Reporter.Regular);
77
77
78
- LF : VSS.Characters.Virtual_Character renames VSS.Characters.Latin.Line_Feed;
78
+ LF : VSS.Characters.Virtual_Character
79
+ renames VSS.Characters.Latin.Line_Feed;
79
80
80
81
procedure Load_Project
81
82
(Self : in out Message_Handler'Class;
@@ -106,8 +107,7 @@ package body LSP.Ada_Handlers.Project_Loading is
106
107
(Self : in out Message_Handler'Class);
107
108
-- Fill Self.Project_Predefined_Sources with loaded project tree runtime
108
109
109
- procedure Enqueue_Indexing_Job
110
- (Self : in out Message_Handler'Class);
110
+ procedure Enqueue_Indexing_Job (Self : in out Message_Handler'Class);
111
111
-- Enqueue the indexing job, which indexes all the project's sources.
112
112
-- This also indexes immediately any already opened document, creating
113
113
-- the handler's fallback context before for that purpose.
@@ -228,8 +228,7 @@ package body LSP.Ada_Handlers.Project_Loading is
228
228
then
229
229
VSS.Strings.Virtual_String'
230
230
(" utf-8" ) -- Alire projects tend to prefer utf-8
231
- else
232
- " iso-8859-1" );
231
+ else " iso-8859-1" );
233
232
234
233
begin
235
234
-- We have an Alire crate and we did not encounter any issue
@@ -261,7 +260,8 @@ package body LSP.Ada_Handlers.Project_Loading is
261
260
VSS.Strings.Conversions.To_Virtual_String
262
261
(URIs.Conversions.To_File
263
262
(VSS.Strings.Conversions.To_UTF_8_String
264
- (GPR_Configuration_File), True));
263
+ (GPR_Configuration_File),
264
+ True));
265
265
end if ;
266
266
267
267
Load_Project
@@ -300,9 +300,9 @@ package body LSP.Ada_Handlers.Project_Loading is
300
300
-- Internal_Report --
301
301
-- -------------------
302
302
303
- overriding procedure Internal_Report
304
- (Self : in out GPR2_Reporter;
305
- Msg : GPR2.Message.Object) is
303
+ overriding
304
+ procedure Internal_Report
305
+ (Self : in out GPR2_Reporter; Msg : GPR2.Message.Object) is
306
306
begin
307
307
Self.Log.Append (Msg);
308
308
end Internal_Report ;
@@ -321,12 +321,11 @@ package body LSP.Ada_Handlers.Project_Loading is
321
321
322
322
C : constant Context_Access := new Context (Self.Tracer);
323
323
324
- Reader : LSP.Ada_Handlers.File_Readers.LSP_File_Reader
325
- (Self'Unchecked_Access);
324
+ Reader :
325
+ LSP.Ada_Handlers.File_Readers.LSP_File_Reader (Self'Unchecked_Access);
326
326
Root : GNATCOLL.VFS.Virtual_File;
327
327
begin
328
- Tracer.Trace
329
- (" Loading the implicit project because " & Status'Image);
328
+ Tracer.Trace (" Loading the implicit project because " & Status'Image);
330
329
331
330
LSP.Ada_Project_Loading.Set_Project_Type
332
331
(Self.Project_Status, LSP.Ada_Project_Loading.Implicit_Project);
@@ -400,12 +399,12 @@ package body LSP.Ada_Handlers.Project_Loading is
400
399
use type VSS.Strings.Virtual_String;
401
400
use type GNATCOLL.VFS.Virtual_File;
402
401
403
- Project_File : GNATCOLL.VFS.Virtual_File :=
402
+ Project_File : GNATCOLL.VFS.Virtual_File :=
404
403
LSP.Utils.To_Virtual_File (Project_Path);
405
404
406
405
GPR_Config_File : GNATCOLL.VFS.Virtual_File;
407
406
408
- Root : GNATCOLL.VFS.Virtual_File;
407
+ Root : GNATCOLL.VFS.Virtual_File;
409
408
410
409
procedure Create_Context_For_Non_Aggregate
411
410
(View : GPR2.Project.View.Object;
@@ -428,11 +427,12 @@ package body LSP.Ada_Handlers.Project_Loading is
428
427
use LSP.Ada_Context_Sets;
429
428
use LSP.Ada_Contexts;
430
429
431
- C : constant Context_Access :=
430
+ C : constant Context_Access :=
432
431
new LSP.Ada_Contexts.Context (Self.Tracer);
433
432
434
- Reader : LSP.Ada_Handlers.File_Readers.LSP_File_Reader
435
- (Self'Unchecked_Access);
433
+ Reader :
434
+ LSP.Ada_Handlers.File_Readers.LSP_File_Reader
435
+ (Self'Unchecked_Access);
436
436
437
437
Default_Config : Libadalang.Preprocessing.File_Config;
438
438
File_Configs : Libadalang.Preprocessing.File_Config_Maps.Map;
@@ -485,8 +485,9 @@ package body LSP.Ada_Handlers.Project_Loading is
485
485
Tree => Self.Project_Tree,
486
486
Charset => VSS.Strings.Conversions.To_UTF_8_String (Charset));
487
487
488
- Tracer.Trace (" Prepend Context Id: "
489
- & VSS.Strings.Conversions.To_UTF_8_String (C.Id));
488
+ Tracer.Trace
489
+ (" Prepend Context Id: "
490
+ & VSS.Strings.Conversions.To_UTF_8_String (C.Id));
490
491
Self.Contexts.Prepend (C);
491
492
end Create_Context_For_Non_Aggregate ;
492
493
@@ -496,15 +497,16 @@ package body LSP.Ada_Handlers.Project_Loading is
496
497
497
498
procedure Log_GPR2_Diagnostics is
498
499
Log : constant GPR2.Log.Object'Class :=
499
- GPR2_Reporter (Self.Project_Tree.Reporter.Element.all ).Log;
500
+ GPR2_Reporter (Self.Project_Tree.Reporter.Element.all ).Log;
500
501
begin
501
502
Tracer.Increase_Indent;
502
503
if Log.Is_Empty then
503
504
Tracer.Trace (" No GPR2 messages" );
504
505
else
505
506
for Msg of Log loop
506
507
declare
507
- Message : constant String := Msg.Format (Full_Path_Name => True);
508
+ Message : constant String :=
509
+ Msg.Format (Full_Path_Name => True);
508
510
begin
509
511
Tracer.Trace (Message);
510
512
end ;
@@ -556,11 +558,12 @@ package body LSP.Ada_Handlers.Project_Loading is
556
558
end if ;
557
559
558
560
-- Set Valid Status for now, it can be overwritten in case of errors
559
- Self.Project_Status.Set_Load_Status (LSP.Ada_Project_Loading.Valid_Project);
561
+ Self.Project_Status.Set_Load_Status
562
+ (LSP.Ada_Project_Loading.Valid_Project);
560
563
561
564
declare
562
- Opts : GPR2.Options.Object;
563
- Success : Boolean;
565
+ Opts : GPR2.Options.Object;
566
+ Success : Boolean;
564
567
565
568
Reporter : GPR2_Reporter;
566
569
-- This reporter object is passed to the GPR2 Load function, but it
@@ -579,18 +582,20 @@ package body LSP.Ada_Handlers.Project_Loading is
579
582
580
583
Tracer.Trace (" Loading project with GPR2" );
581
584
582
- Success := Self.Project_Tree.Load
583
- (Opts,
584
- Reporter => Reporter,
585
- With_Runtime => True,
586
- Absent_Dir_Error => GPR2.No_Error,
587
- Environment => Environment);
585
+ Success :=
586
+ Self.Project_Tree.Load
587
+ (Opts,
588
+ Reporter => Reporter,
589
+ With_Runtime => True,
590
+ Absent_Dir_Error => GPR2.No_Error,
591
+ Environment => Environment);
588
592
589
593
Tracer.Trace (" GPR2 messages after load:" );
590
594
Log_GPR2_Diagnostics;
591
595
592
596
if not Success then
593
- Self.Project_Status.Set_Load_Status (LSP.Ada_Project_Loading.Invalid_Project);
597
+ Self.Project_Status.Set_Load_Status
598
+ (LSP.Ada_Project_Loading.Invalid_Project);
594
599
end if ;
595
600
596
601
if Success then
@@ -607,7 +612,8 @@ package body LSP.Ada_Handlers.Project_Loading is
607
612
exception
608
613
when E : others =>
609
614
Tracer.Trace_Exception (E);
610
- Self.Project_Status.Set_Load_Status (LSP.Ada_Project_Loading.Invalid_Project);
615
+ Self.Project_Status.Set_Load_Status
616
+ (LSP.Ada_Project_Loading.Invalid_Project);
611
617
end ;
612
618
613
619
if Self.Project_Status.Is_Project_Loaded then
@@ -617,11 +623,11 @@ package body LSP.Ada_Handlers.Project_Loading is
617
623
Self.Project_Tree.Root_Project;
618
624
begin
619
625
-- Only check runtime issues for Ada
620
- Self.Project_Status.Set_Missing_Ada_Runtime (
621
- Value =>
626
+ Self.Project_Status.Set_Missing_Ada_Runtime
627
+ ( Value =>
622
628
(not Root.Is_Defined
623
629
or else Root.Language_Ids.Contains (GPR2.Ada_Language))
624
- and then not Self.Project_Tree.Has_Runtime_Project);
630
+ and then not Self.Project_Tree.Has_Runtime_Project);
625
631
end ;
626
632
627
633
Update_Project_Predefined_Sources (Self);
@@ -644,9 +650,10 @@ package body LSP.Ada_Handlers.Project_Loading is
644
650
else
645
651
declare
646
652
Provider : GPR2_Provider_And_Projects :=
647
- (Provider => Create_Project_Unit_Provider
648
- (Tree => Self.Project_Tree,
649
- Project => Self.Project_Tree.Root_Project),
653
+ (Provider =>
654
+ Create_Project_Unit_Provider
655
+ (Tree => Self.Project_Tree,
656
+ Project => Self.Project_Tree.Root_Project),
650
657
Projects => <>);
651
658
begin
652
659
Provider.Projects.Append (Self.Project_Tree.Root_Project);
@@ -657,7 +664,8 @@ package body LSP.Ada_Handlers.Project_Loading is
657
664
end if ;
658
665
end if ;
659
666
660
- Tracer.Trace (" Project status after loading: " & Self.Project_Status'Image);
667
+ Tracer.Trace
668
+ (" Project status after loading: " & Self.Project_Status'Image);
661
669
662
670
-- We have successfully loaded a real project: monitor the filesystem
663
671
-- for any changes on the sources of the project
@@ -672,9 +680,7 @@ package body LSP.Ada_Handlers.Project_Loading is
672
680
-- Enqueue_Indexing_Job --
673
681
-- ------------------------
674
682
675
- procedure Enqueue_Indexing_Job
676
- (Self : in out Message_Handler'Class)
677
- is
683
+ procedure Enqueue_Indexing_Job (Self : in out Message_Handler'Class) is
678
684
procedure Create_Fallback_Context (Self : in out Message_Handler'Class);
679
685
-- Create a fallback context for the given handler's contexts' set.
680
686
@@ -776,13 +782,12 @@ package body LSP.Ada_Handlers.Project_Loading is
776
782
-- Reload_Implicit_Project_Dirs --
777
783
-- --------------------------------
778
784
779
- procedure Reload_Implicit_Project_Dirs
780
- (Self : in out Message_Handler'Class)
785
+ procedure Reload_Implicit_Project_Dirs (Self : in out Message_Handler'Class)
781
786
is
782
787
Project : GPR2.Project.Tree.View_Builder.Object :=
783
- GPR2.Project.Tree.View_Builder.Create
784
- (Project_Dir => GPR2.Path_Name.Create_Directory (" ." ),
785
- Name => " default" );
788
+ GPR2.Project.Tree.View_Builder.Create
789
+ (Project_Dir => GPR2.Path_Name.Create_Directory (" ." ),
790
+ Name => " default" );
786
791
Values : GPR2.Containers.Value_List;
787
792
Opts : GPR2.Options.Object;
788
793
Success : Boolean;
@@ -797,15 +802,15 @@ package body LSP.Ada_Handlers.Project_Loading is
797
802
end loop ;
798
803
799
804
Project.Set_Attribute
800
- (GPR2.Project.Registry.Attribute.Source_Dirs,
801
- Values);
805
+ (GPR2.Project.Registry.Attribute.Source_Dirs, Values);
802
806
803
807
-- First we load the fallback project
804
- Success := Self.Project_Tree.Load_Virtual_View
805
- (Project,
806
- Opts,
807
- With_Runtime => True,
808
- Absent_Dir_Error => GPR2.No_Error);
808
+ Success :=
809
+ Self.Project_Tree.Load_Virtual_View
810
+ (Project,
811
+ Opts,
812
+ With_Runtime => True,
813
+ Absent_Dir_Error => GPR2.No_Error);
809
814
810
815
if not Success then
811
816
for C in Self.Project_Tree.Log_Messages.Iterate loop
@@ -830,7 +835,8 @@ package body LSP.Ada_Handlers.Project_Loading is
830
835
831
836
procedure Reload_Project (Self : in out Message_Handler'CLass) is
832
837
begin
833
- Tracer.Trace (" Reload_Project was called. Releasing current project context." );
838
+ Tracer.Trace
839
+ (" Reload_Project was called. Releasing current project context." );
834
840
Release_Contexts_And_Project_Info (Self);
835
841
Self.Project_Status := LSP.Ada_Project_Loading.No_Project_Status;
836
842
Ensure_Project_Loaded (Self);
@@ -840,8 +846,7 @@ package body LSP.Ada_Handlers.Project_Loading is
840
846
-- Reload_Implicit_Project --
841
847
-- ---------------------------
842
848
843
- procedure Reload_Implicit_Project
844
- (Self : in out Message_Handler'Class) is
849
+ procedure Reload_Implicit_Project (Self : in out Message_Handler'Class) is
845
850
begin
846
851
Load_Implicit_Project (Self, Self.Project_Status.Get_Load_Status);
847
852
end Reload_Implicit_Project ;
0 commit comments