Skip to content

Commit 1e01626

Browse files
committed
Apply auto-formatting
1 parent 170edf8 commit 1e01626

File tree

1 file changed

+69
-64
lines changed

1 file changed

+69
-64
lines changed

source/ada/lsp-ada_handlers-project_loading.adb

Lines changed: 69 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,24 @@ package body LSP.Ada_Handlers.Project_Loading is
5959
LSP.GNATCOLL_Tracers.Create ("ALS.PROJECT", GNATCOLL.Traces.On);
6060

6161
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);
6463
-- Trace to enable/disable runtime indexing. Useful for the testsuite.
6564

6665
type GPR2_Reporter is new GPR2.Reporter.Object with record
6766
Log : GPR2.Log.Object;
6867
end record;
6968

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);
7372

74-
overriding function Verbosity
73+
overriding
74+
function Verbosity
7575
(Self : GPR2_Reporter) return GPR2.Reporter.Verbosity_Level
7676
is (GPR2.Reporter.Regular);
7777

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;
7980

8081
procedure Load_Project
8182
(Self : in out Message_Handler'Class;
@@ -106,8 +107,7 @@ package body LSP.Ada_Handlers.Project_Loading is
106107
(Self : in out Message_Handler'Class);
107108
-- Fill Self.Project_Predefined_Sources with loaded project tree runtime
108109

109-
procedure Enqueue_Indexing_Job
110-
(Self : in out Message_Handler'Class);
110+
procedure Enqueue_Indexing_Job (Self : in out Message_Handler'Class);
111111
-- Enqueue the indexing job, which indexes all the project's sources.
112112
-- This also indexes immediately any already opened document, creating
113113
-- the handler's fallback context before for that purpose.
@@ -228,8 +228,7 @@ package body LSP.Ada_Handlers.Project_Loading is
228228
then
229229
VSS.Strings.Virtual_String'
230230
("utf-8") -- Alire projects tend to prefer utf-8
231-
else
232-
"iso-8859-1");
231+
else "iso-8859-1");
233232

234233
begin
235234
-- We have an Alire crate and we did not encounter any issue
@@ -261,7 +260,8 @@ package body LSP.Ada_Handlers.Project_Loading is
261260
VSS.Strings.Conversions.To_Virtual_String
262261
(URIs.Conversions.To_File
263262
(VSS.Strings.Conversions.To_UTF_8_String
264-
(GPR_Configuration_File), True));
263+
(GPR_Configuration_File),
264+
True));
265265
end if;
266266

267267
Load_Project
@@ -300,9 +300,9 @@ package body LSP.Ada_Handlers.Project_Loading is
300300
-- Internal_Report --
301301
---------------------
302302

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
306306
begin
307307
Self.Log.Append (Msg);
308308
end Internal_Report;
@@ -321,12 +321,11 @@ package body LSP.Ada_Handlers.Project_Loading is
321321

322322
C : constant Context_Access := new Context (Self.Tracer);
323323

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);
326326
Root : GNATCOLL.VFS.Virtual_File;
327327
begin
328-
Tracer.Trace
329-
("Loading the implicit project because " & Status'Image);
328+
Tracer.Trace ("Loading the implicit project because " & Status'Image);
330329

331330
LSP.Ada_Project_Loading.Set_Project_Type
332331
(Self.Project_Status, LSP.Ada_Project_Loading.Implicit_Project);
@@ -400,12 +399,12 @@ package body LSP.Ada_Handlers.Project_Loading is
400399
use type VSS.Strings.Virtual_String;
401400
use type GNATCOLL.VFS.Virtual_File;
402401

403-
Project_File : GNATCOLL.VFS.Virtual_File :=
402+
Project_File : GNATCOLL.VFS.Virtual_File :=
404403
LSP.Utils.To_Virtual_File (Project_Path);
405404

406405
GPR_Config_File : GNATCOLL.VFS.Virtual_File;
407406

408-
Root : GNATCOLL.VFS.Virtual_File;
407+
Root : GNATCOLL.VFS.Virtual_File;
409408

410409
procedure Create_Context_For_Non_Aggregate
411410
(View : GPR2.Project.View.Object;
@@ -428,11 +427,12 @@ package body LSP.Ada_Handlers.Project_Loading is
428427
use LSP.Ada_Context_Sets;
429428
use LSP.Ada_Contexts;
430429

431-
C : constant Context_Access :=
430+
C : constant Context_Access :=
432431
new LSP.Ada_Contexts.Context (Self.Tracer);
433432

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);
436436

437437
Default_Config : Libadalang.Preprocessing.File_Config;
438438
File_Configs : Libadalang.Preprocessing.File_Config_Maps.Map;
@@ -485,8 +485,9 @@ package body LSP.Ada_Handlers.Project_Loading is
485485
Tree => Self.Project_Tree,
486486
Charset => VSS.Strings.Conversions.To_UTF_8_String (Charset));
487487

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));
490491
Self.Contexts.Prepend (C);
491492
end Create_Context_For_Non_Aggregate;
492493

@@ -496,15 +497,16 @@ package body LSP.Ada_Handlers.Project_Loading is
496497

497498
procedure Log_GPR2_Diagnostics is
498499
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;
500501
begin
501502
Tracer.Increase_Indent;
502503
if Log.Is_Empty then
503504
Tracer.Trace ("No GPR2 messages");
504505
else
505506
for Msg of Log loop
506507
declare
507-
Message : constant String := Msg.Format (Full_Path_Name => True);
508+
Message : constant String :=
509+
Msg.Format (Full_Path_Name => True);
508510
begin
509511
Tracer.Trace (Message);
510512
end;
@@ -556,11 +558,12 @@ package body LSP.Ada_Handlers.Project_Loading is
556558
end if;
557559

558560
-- 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);
560563

561564
declare
562-
Opts : GPR2.Options.Object;
563-
Success : Boolean;
565+
Opts : GPR2.Options.Object;
566+
Success : Boolean;
564567

565568
Reporter : GPR2_Reporter;
566569
-- This reporter object is passed to the GPR2 Load function, but it
@@ -579,18 +582,20 @@ package body LSP.Ada_Handlers.Project_Loading is
579582

580583
Tracer.Trace ("Loading project with GPR2");
581584

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);
588592

589593
Tracer.Trace ("GPR2 messages after load:");
590594
Log_GPR2_Diagnostics;
591595

592596
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);
594599
end if;
595600

596601
if Success then
@@ -607,7 +612,8 @@ package body LSP.Ada_Handlers.Project_Loading is
607612
exception
608613
when E : others =>
609614
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);
611617
end;
612618

613619
if Self.Project_Status.Is_Project_Loaded then
@@ -617,11 +623,11 @@ package body LSP.Ada_Handlers.Project_Loading is
617623
Self.Project_Tree.Root_Project;
618624
begin
619625
-- 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 =>
622628
(not Root.Is_Defined
623629
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);
625631
end;
626632

627633
Update_Project_Predefined_Sources (Self);
@@ -644,9 +650,10 @@ package body LSP.Ada_Handlers.Project_Loading is
644650
else
645651
declare
646652
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),
650657
Projects => <>);
651658
begin
652659
Provider.Projects.Append (Self.Project_Tree.Root_Project);
@@ -657,7 +664,8 @@ package body LSP.Ada_Handlers.Project_Loading is
657664
end if;
658665
end if;
659666

660-
Tracer.Trace ("Project status after loading: " & Self.Project_Status'Image);
667+
Tracer.Trace
668+
("Project status after loading: " & Self.Project_Status'Image);
661669

662670
-- We have successfully loaded a real project: monitor the filesystem
663671
-- for any changes on the sources of the project
@@ -672,9 +680,7 @@ package body LSP.Ada_Handlers.Project_Loading is
672680
-- Enqueue_Indexing_Job --
673681
--------------------------
674682

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
678684
procedure Create_Fallback_Context (Self : in out Message_Handler'Class);
679685
-- Create a fallback context for the given handler's contexts' set.
680686

@@ -776,13 +782,12 @@ package body LSP.Ada_Handlers.Project_Loading is
776782
-- Reload_Implicit_Project_Dirs --
777783
----------------------------------
778784

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)
781786
is
782787
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");
786791
Values : GPR2.Containers.Value_List;
787792
Opts : GPR2.Options.Object;
788793
Success : Boolean;
@@ -797,15 +802,15 @@ package body LSP.Ada_Handlers.Project_Loading is
797802
end loop;
798803

799804
Project.Set_Attribute
800-
(GPR2.Project.Registry.Attribute.Source_Dirs,
801-
Values);
805+
(GPR2.Project.Registry.Attribute.Source_Dirs, Values);
802806

803807
-- 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);
809814

810815
if not Success then
811816
for C in Self.Project_Tree.Log_Messages.Iterate loop
@@ -830,7 +835,8 @@ package body LSP.Ada_Handlers.Project_Loading is
830835

831836
procedure Reload_Project (Self : in out Message_Handler'CLass) is
832837
begin
833-
Tracer.Trace ("Reload_Project was called. Releasing current project context.");
838+
Tracer.Trace
839+
("Reload_Project was called. Releasing current project context.");
834840
Release_Contexts_And_Project_Info (Self);
835841
Self.Project_Status := LSP.Ada_Project_Loading.No_Project_Status;
836842
Ensure_Project_Loaded (Self);
@@ -840,8 +846,7 @@ package body LSP.Ada_Handlers.Project_Loading is
840846
-- Reload_Implicit_Project --
841847
-----------------------------
842848

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
845850
begin
846851
Load_Implicit_Project (Self, Self.Project_Status.Get_Load_Status);
847852
end Reload_Implicit_Project;

0 commit comments

Comments
 (0)