@@ -27,7 +27,6 @@ with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
2727with Ada.Unchecked_Deallocation ;
2828
2929with GNAT.OS_Lib ; use GNAT.OS_Lib;
30- with GNATCOLL.JSON ;
3130with GNATCOLL.Utils ; use GNATCOLL.Utils;
3231
3332with GPR2.Containers ;
@@ -325,11 +324,6 @@ package body LSP.Ada_Handlers is
325324 -- Attempt to load the given project file, with the scenario provided.
326325 -- This unloads all currently loaded project contexts.
327326
328- procedure Change_Configuration
329- (Self : access Message_Handler;
330- Ada : LSP.Types.LSP_Any);
331- -- Change server configuration with settings from Ada JSON object.
332-
333327 procedure Mark_Source_Files_For_Indexing (Self : access Message_Handler);
334328 -- Mark all sources in all projects for indexing. This factorizes code
335329 -- between Load_Project and Load_Implicit_Project.
@@ -4225,8 +4219,8 @@ package body LSP.Ada_Handlers is
42254219 -- ------------------------
42264220
42274221 procedure Change_Configuration
4228- (Self : access Message_Handler;
4229- Ada : LSP.Types.LSP_Any )
4222+ (Self : access Message_Handler;
4223+ Options : GNATCOLL.JSON.JSON_Value'Class )
42304224 is
42314225 use type GNATCOLL.JSON.JSON_Value_Type;
42324226
@@ -4266,9 +4260,9 @@ package body LSP.Ada_Handlers is
42664260 Variables : Scenario_Variable_List;
42674261
42684262 function Property (Name : String) return VSS.Strings.Virtual_String is
4269- (if Ada .Has_Field (Name)
4263+ (if Options .Has_Field (Name)
42704264 then VSS.Strings.Conversions.To_Virtual_String
4271- (String'(Get (Get (Ada, Name) )))
4265+ (String'(Options. Get (Name)))
42724266 else VSS.Strings.Empty_Virtual_String);
42734267
42744268 -- ----------------
@@ -4300,7 +4294,7 @@ package body LSP.Ada_Handlers is
43004294 Value.dynamicRegistration.Is_Set = True;
43014295
43024296 begin
4303- if Ada .Kind = GNATCOLL.JSON.JSON_Object_Type then
4297+ if Options .Kind = GNATCOLL.JSON.JSON_Object_Type then
43044298 Relocate := Property (relocateBuildTree);
43054299 Root := Property (rootDir);
43064300 Charset := Property (defaultCharset);
@@ -4311,76 +4305,80 @@ package body LSP.Ada_Handlers is
43114305 File := Self.URI_To_File (File);
43124306 end if ;
43134307
4314- if Ada.Has_Field (scenarioVariables) and then
4315- Ada.Get (scenarioVariables).Kind = GNATCOLL.JSON.JSON_Object_Type
4308+ if Options.Has_Field (scenarioVariables) and then
4309+ Options.Get
4310+ (scenarioVariables).Kind = GNATCOLL.JSON.JSON_Object_Type
43164311 then
4317- Ada.Get (scenarioVariables).Map_JSON_Object (Add_Variable'Access );
4312+ Options.Get
4313+ (scenarioVariables).Map_JSON_Object (Add_Variable'Access );
43184314 end if ;
43194315
43204316 -- It looks like the protocol does not allow clients to say whether
43214317 -- or not they want diagnostics as part of
43224318 -- InitializeParams.capabilities.textDocument. So we support
43234319 -- deactivating of diagnostics via a setting here.
4324- if Ada .Has_Field (enableDiagnostics) then
4325- Self.Diagnostics_Enabled := Ada .Get (enableDiagnostics);
4320+ if Options .Has_Field (enableDiagnostics) then
4321+ Self.Diagnostics_Enabled := Options .Get (enableDiagnostics);
43264322 end if ;
43274323
43284324 -- Similarly to diagnostics, we support selectively activating
43294325 -- indexing in the parameters to this request.
4330- if Ada .Has_Field (enableIndexing) then
4331- Self.Indexing_Enabled := Ada .Get (enableIndexing);
4326+ if Options .Has_Field (enableIndexing) then
4327+ Self.Indexing_Enabled := Options .Get (enableIndexing);
43324328 end if ;
43334329
43344330 -- Retrieve the different textDocument/rename options if specified
43354331
4336- if Ada .Has_Field (renameInComments) then
4332+ if Options .Has_Field (renameInComments) then
43374333 Self.Options.Refactoring.Renaming.In_Comments :=
4338- Ada .Get (renameInComments);
4334+ Options .Get (renameInComments);
43394335 end if ;
43404336
4341- if Ada .Has_Field (foldComments) then
4342- Self.Options.Folding.Comments := Ada .Get (foldComments);
4337+ if Options .Has_Field (foldComments) then
4338+ Self.Options.Folding.Comments := Options .Get (foldComments);
43434339 end if ;
43444340
43454341 -- Retrieve the number of parameters / components at which point
43464342 -- named notation is used for subprogram/aggregate completion
43474343 -- snippets.
43484344
4349- if Ada.Has_Field (namedNotationThreshold) then
4350- Self.Named_Notation_Threshold := Ada.Get (namedNotationThreshold);
4345+ if Options.Has_Field (namedNotationThreshold) then
4346+ Self.Named_Notation_Threshold :=
4347+ Options.Get (namedNotationThreshold);
43514348 end if ;
43524349
4353- if Ada .Has_Field (logThreshold) then
4354- Self.Log_Threshold := Ada .Get (logThreshold);
4350+ if Options .Has_Field (logThreshold) then
4351+ Self.Log_Threshold := Options .Get (logThreshold);
43554352 end if ;
43564353
43574354 -- Check the 'useCompletionSnippets' flag to see if we should use
43584355 -- snippets in completion (if the client supports it).
43594356 if not Self.Completion_Snippets_Enabled then
43604357 Self.Use_Completion_Snippets := False;
4361- elsif Ada.Has_Field (useCompletionSnippets) then
4362- Self.Use_Completion_Snippets := Ada.Get (useCompletionSnippets);
4358+ elsif Options.Has_Field (useCompletionSnippets) then
4359+ Self.Use_Completion_Snippets :=
4360+ Options.Get (useCompletionSnippets);
43634361 end if ;
43644362
43654363 -- Retrieve the policy for displaying type hierarchy on navigation
43664364 -- requests.
4367- if Ada .Has_Field (displayMethodAncestryOnNavigation) then
4365+ if Options .Has_Field (displayMethodAncestryOnNavigation) then
43684366 Self.Display_Method_Ancestry_Policy :=
43694367 LSP.Messages.AlsDisplayMethodAncestryOnNavigationPolicy'Value
4370- (Ada .Get (displayMethodAncestryOnNavigation));
4368+ (Options .Get (displayMethodAncestryOnNavigation));
43714369 end if ;
43724370
43734371 -- Retrieve the follow symlinks policy.
43744372
4375- if Ada .Has_Field (followSymlinks) then
4376- Self.Follow_Symlinks := Ada .Get (followSymlinks);
4373+ if Options .Has_Field (followSymlinks) then
4374+ Self.Follow_Symlinks := Options .Get (followSymlinks);
43774375 end if ;
43784376
4379- if Ada .Has_Field (documentationStyle) then
4377+ if Options .Has_Field (documentationStyle) then
43804378 begin
43814379 Self.Options.Documentation.Style :=
43824380 GNATdoc.Comments.Options.Documentation_Style'Value
4383- (Ada .Get (documentationStyle));
4381+ (Options .Get (documentationStyle));
43844382
43854383 exception
43864384 when Constraint_Error =>
@@ -4392,12 +4390,12 @@ package body LSP.Ada_Handlers is
43924390
43934391 if not File.Is_Empty then
43944392 Self.Load_Project
4395- (File,
4396- Variables,
4397- Charset,
4398- Valid_Project_Configured,
4399- Relocate,
4400- Root);
4393+ (Project_File => File,
4394+ Scenario => Variables,
4395+ Charset => Charset ,
4396+ Status => Valid_Project_Configured,
4397+ Relocate_Build_Tree => Relocate,
4398+ Root_Dir => Root);
44014399 end if ;
44024400
44034401 Self.Ensure_Project_Loaded;
0 commit comments