@@ -507,6 +507,39 @@ package body LSP.GPR_Handlers is
507507 others => <>)));
508508 end ;
509509
510+ -- If settings were given in initializationOptions, parse and apply them.
511+ if not Value.initializationOptions.Is_Empty then
512+ Self.Tracer.Trace
513+ (" Processing initializationOptions from initialize request" );
514+ declare
515+ New_Configuration : LSP.Ada_Configurations.Configuration :=
516+ Self.Configuration;
517+ -- Start from the existing configuration so that settings parsed
518+ -- from configuration files are preserved, and the settings from
519+ -- initialize request are applied on top.
520+
521+ Messages : VSS.String_Vectors.Virtual_String_Vector;
522+ begin
523+ -- Parse the configuration.
524+ New_Configuration.Read_JSON
525+ (Value.initializationOptions, Messages);
526+
527+ for Message of Messages loop
528+ Self.Sender.On_LogMessage_Notification
529+ ((LSP.Enumerations.Warning, Message));
530+ Self.Tracer.Trace_Text (Message);
531+ end loop ;
532+
533+ -- Set it as the current configuration.
534+ -- This will also save it as the initial configuration (if not done
535+ -- yet through config files) so that we can restore individual
536+ -- settings back to the initial state when
537+ -- 'onDidChangeConfiguration' provides null values.
538+ Self.Set_Configuration (New_Configuration);
539+ end ;
540+
541+ end if ;
542+
510543 Self.Sender.On_Initialize_Response (Id, Response);
511544 end On_Initialize_Request ;
512545
0 commit comments