@@ -28,7 +28,6 @@ with Ada.Unchecked_Deallocation;
2828
2929with GNAT.OS_Lib ; use GNAT.OS_Lib;
3030with GNAT.Strings ;
31- with GNATCOLL.JSON ;
3231with GNATCOLL.Utils ; use GNATCOLL.Utils;
3332
3433with VSS.Characters.Latin ;
@@ -319,11 +318,6 @@ package body LSP.Ada_Handlers is
319318 -- Attempt to load the given project file, with the scenario provided.
320319 -- This unloads all currently loaded project contexts.
321320
322- procedure Change_Configuration
323- (Self : access Message_Handler;
324- Ada : LSP.Types.LSP_Any);
325- -- Change server configuration with settings from Ada JSON object.
326-
327321 procedure Mark_Source_Files_For_Indexing (Self : access Message_Handler);
328322 -- Mark all sources in all projects for indexing. This factorizes code
329323 -- between Load_Project and Load_Implicit_Project.
@@ -4234,8 +4228,8 @@ package body LSP.Ada_Handlers is
42344228 -- ------------------------
42354229
42364230 procedure Change_Configuration
4237- (Self : access Message_Handler;
4238- Ada : LSP.Types.LSP_Any )
4231+ (Self : access Message_Handler;
4232+ Options : GNATCOLL.JSON.JSON_Value'Class )
42394233 is
42404234 use type GNATCOLL.JSON.JSON_Value_Type;
42414235
@@ -4275,9 +4269,9 @@ package body LSP.Ada_Handlers is
42754269 Variables : Scenario_Variable_List;
42764270
42774271 function Property (Name : String) return VSS.Strings.Virtual_String is
4278- (if Ada .Has_Field (Name)
4272+ (if Options .Has_Field (Name)
42794273 then VSS.Strings.Conversions.To_Virtual_String
4280- (String'(Get (Get (Ada, Name) )))
4274+ (String'(Options. Get (Name)))
42814275 else VSS.Strings.Empty_Virtual_String);
42824276
42834277 -- ----------------
@@ -4309,7 +4303,7 @@ package body LSP.Ada_Handlers is
43094303 Value.dynamicRegistration.Is_Set = True;
43104304
43114305 begin
4312- if Ada .Kind = GNATCOLL.JSON.JSON_Object_Type then
4306+ if Options .Kind = GNATCOLL.JSON.JSON_Object_Type then
43134307 Relocate := Property (relocateBuildTree);
43144308 Root := Property (rootDir);
43154309 Charset := Property (defaultCharset);
@@ -4320,76 +4314,80 @@ package body LSP.Ada_Handlers is
43204314 File := Self.URI_To_File (File);
43214315 end if ;
43224316
4323- if Ada.Has_Field (scenarioVariables) and then
4324- Ada.Get (scenarioVariables).Kind = GNATCOLL.JSON.JSON_Object_Type
4317+ if Options.Has_Field (scenarioVariables) and then
4318+ Options.Get
4319+ (scenarioVariables).Kind = GNATCOLL.JSON.JSON_Object_Type
43254320 then
4326- Ada.Get (scenarioVariables).Map_JSON_Object (Add_Variable'Access );
4321+ Options.Get
4322+ (scenarioVariables).Map_JSON_Object (Add_Variable'Access );
43274323 end if ;
43284324
43294325 -- It looks like the protocol does not allow clients to say whether
43304326 -- or not they want diagnostics as part of
43314327 -- InitializeParams.capabilities.textDocument. So we support
43324328 -- deactivating of diagnostics via a setting here.
4333- if Ada .Has_Field (enableDiagnostics) then
4334- Self.Diagnostics_Enabled := Ada .Get (enableDiagnostics);
4329+ if Options .Has_Field (enableDiagnostics) then
4330+ Self.Diagnostics_Enabled := Options .Get (enableDiagnostics);
43354331 end if ;
43364332
43374333 -- Similarly to diagnostics, we support selectively activating
43384334 -- indexing in the parameters to this request.
4339- if Ada .Has_Field (enableIndexing) then
4340- Self.Indexing_Enabled := Ada .Get (enableIndexing);
4335+ if Options .Has_Field (enableIndexing) then
4336+ Self.Indexing_Enabled := Options .Get (enableIndexing);
43414337 end if ;
43424338
43434339 -- Retrieve the different textDocument/rename options if specified
43444340
4345- if Ada .Has_Field (renameInComments) then
4341+ if Options .Has_Field (renameInComments) then
43464342 Self.Options.Refactoring.Renaming.In_Comments :=
4347- Ada .Get (renameInComments);
4343+ Options .Get (renameInComments);
43484344 end if ;
43494345
4350- if Ada .Has_Field (foldComments) then
4351- Self.Options.Folding.Comments := Ada .Get (foldComments);
4346+ if Options .Has_Field (foldComments) then
4347+ Self.Options.Folding.Comments := Options .Get (foldComments);
43524348 end if ;
43534349
43544350 -- Retrieve the number of parameters / components at which point
43554351 -- named notation is used for subprogram/aggregate completion
43564352 -- snippets.
43574353
4358- if Ada.Has_Field (namedNotationThreshold) then
4359- Self.Named_Notation_Threshold := Ada.Get (namedNotationThreshold);
4354+ if Options.Has_Field (namedNotationThreshold) then
4355+ Self.Named_Notation_Threshold :=
4356+ Options.Get (namedNotationThreshold);
43604357 end if ;
43614358
4362- if Ada .Has_Field (logThreshold) then
4363- Self.Log_Threshold := Ada .Get (logThreshold);
4359+ if Options .Has_Field (logThreshold) then
4360+ Self.Log_Threshold := Options .Get (logThreshold);
43644361 end if ;
43654362
43664363 -- Check the 'useCompletionSnippets' flag to see if we should use
43674364 -- snippets in completion (if the client supports it).
43684365 if not Self.Completion_Snippets_Enabled then
43694366 Self.Use_Completion_Snippets := False;
4370- elsif Ada.Has_Field (useCompletionSnippets) then
4371- Self.Use_Completion_Snippets := Ada.Get (useCompletionSnippets);
4367+ elsif Options.Has_Field (useCompletionSnippets) then
4368+ Self.Use_Completion_Snippets :=
4369+ Options.Get (useCompletionSnippets);
43724370 end if ;
43734371
43744372 -- Retrieve the policy for displaying type hierarchy on navigation
43754373 -- requests.
4376- if Ada .Has_Field (displayMethodAncestryOnNavigation) then
4374+ if Options .Has_Field (displayMethodAncestryOnNavigation) then
43774375 Self.Display_Method_Ancestry_Policy :=
43784376 LSP.Messages.AlsDisplayMethodAncestryOnNavigationPolicy'Value
4379- (Ada .Get (displayMethodAncestryOnNavigation));
4377+ (Options .Get (displayMethodAncestryOnNavigation));
43804378 end if ;
43814379
43824380 -- Retrieve the follow symlinks policy.
43834381
4384- if Ada .Has_Field (followSymlinks) then
4385- Self.Follow_Symlinks := Ada .Get (followSymlinks);
4382+ if Options .Has_Field (followSymlinks) then
4383+ Self.Follow_Symlinks := Options .Get (followSymlinks);
43864384 end if ;
43874385
4388- if Ada .Has_Field (documentationStyle) then
4386+ if Options .Has_Field (documentationStyle) then
43894387 begin
43904388 Self.Options.Documentation.Style :=
43914389 GNATdoc.Comments.Options.Documentation_Style'Value
4392- (Ada .Get (documentationStyle));
4390+ (Options .Get (documentationStyle));
43934391
43944392 exception
43954393 when Constraint_Error =>
@@ -4401,12 +4399,12 @@ package body LSP.Ada_Handlers is
44014399
44024400 if not File.Is_Empty then
44034401 Self.Load_Project
4404- (File,
4405- Variables,
4406- Charset,
4407- Valid_Project_Configured,
4408- Relocate,
4409- Root);
4402+ (Project_File => File,
4403+ Scenario => Variables,
4404+ Charset => Charset ,
4405+ Status => Valid_Project_Configured,
4406+ Relocate_Build_Tree => Relocate,
4407+ Root_Dir => Root);
44104408 end if ;
44114409
44124410 Self.Ensure_Project_Loaded;
0 commit comments