@@ -28,7 +28,6 @@ with Ada.Unchecked_Deallocation;
28
28
29
29
with GNAT.OS_Lib ; use GNAT.OS_Lib;
30
30
with GNAT.Strings ;
31
- with GNATCOLL.JSON ;
32
31
with GNATCOLL.Utils ; use GNATCOLL.Utils;
33
32
34
33
with VSS.Characters.Latin ;
@@ -319,11 +318,6 @@ package body LSP.Ada_Handlers is
319
318
-- Attempt to load the given project file, with the scenario provided.
320
319
-- This unloads all currently loaded project contexts.
321
320
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
-
327
321
procedure Mark_Source_Files_For_Indexing (Self : access Message_Handler);
328
322
-- Mark all sources in all projects for indexing. This factorizes code
329
323
-- between Load_Project and Load_Implicit_Project.
@@ -4234,8 +4228,8 @@ package body LSP.Ada_Handlers is
4234
4228
-- ------------------------
4235
4229
4236
4230
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 )
4239
4233
is
4240
4234
use type GNATCOLL.JSON.JSON_Value_Type;
4241
4235
@@ -4275,9 +4269,9 @@ package body LSP.Ada_Handlers is
4275
4269
Variables : Scenario_Variable_List;
4276
4270
4277
4271
function Property (Name : String) return VSS.Strings.Virtual_String is
4278
- (if Ada .Has_Field (Name)
4272
+ (if Options .Has_Field (Name)
4279
4273
then VSS.Strings.Conversions.To_Virtual_String
4280
- (String'(Get (Get (Ada, Name) )))
4274
+ (String'(Options. Get (Name)))
4281
4275
else VSS.Strings.Empty_Virtual_String);
4282
4276
4283
4277
-- ----------------
@@ -4309,7 +4303,7 @@ package body LSP.Ada_Handlers is
4309
4303
Value.dynamicRegistration.Is_Set = True;
4310
4304
4311
4305
begin
4312
- if Ada .Kind = GNATCOLL.JSON.JSON_Object_Type then
4306
+ if Options .Kind = GNATCOLL.JSON.JSON_Object_Type then
4313
4307
Relocate := Property (relocateBuildTree);
4314
4308
Root := Property (rootDir);
4315
4309
Charset := Property (defaultCharset);
@@ -4320,76 +4314,80 @@ package body LSP.Ada_Handlers is
4320
4314
File := Self.URI_To_File (File);
4321
4315
end if ;
4322
4316
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
4325
4320
then
4326
- Ada.Get (scenarioVariables).Map_JSON_Object (Add_Variable'Access );
4321
+ Options.Get
4322
+ (scenarioVariables).Map_JSON_Object (Add_Variable'Access );
4327
4323
end if ;
4328
4324
4329
4325
-- It looks like the protocol does not allow clients to say whether
4330
4326
-- or not they want diagnostics as part of
4331
4327
-- InitializeParams.capabilities.textDocument. So we support
4332
4328
-- 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);
4335
4331
end if ;
4336
4332
4337
4333
-- Similarly to diagnostics, we support selectively activating
4338
4334
-- 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);
4341
4337
end if ;
4342
4338
4343
4339
-- Retrieve the different textDocument/rename options if specified
4344
4340
4345
- if Ada .Has_Field (renameInComments) then
4341
+ if Options .Has_Field (renameInComments) then
4346
4342
Self.Options.Refactoring.Renaming.In_Comments :=
4347
- Ada .Get (renameInComments);
4343
+ Options .Get (renameInComments);
4348
4344
end if ;
4349
4345
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);
4352
4348
end if ;
4353
4349
4354
4350
-- Retrieve the number of parameters / components at which point
4355
4351
-- named notation is used for subprogram/aggregate completion
4356
4352
-- snippets.
4357
4353
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);
4360
4357
end if ;
4361
4358
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);
4364
4361
end if ;
4365
4362
4366
4363
-- Check the 'useCompletionSnippets' flag to see if we should use
4367
4364
-- snippets in completion (if the client supports it).
4368
4365
if not Self.Completion_Snippets_Enabled then
4369
4366
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);
4372
4370
end if ;
4373
4371
4374
4372
-- Retrieve the policy for displaying type hierarchy on navigation
4375
4373
-- requests.
4376
- if Ada .Has_Field (displayMethodAncestryOnNavigation) then
4374
+ if Options .Has_Field (displayMethodAncestryOnNavigation) then
4377
4375
Self.Display_Method_Ancestry_Policy :=
4378
4376
LSP.Messages.AlsDisplayMethodAncestryOnNavigationPolicy'Value
4379
- (Ada .Get (displayMethodAncestryOnNavigation));
4377
+ (Options .Get (displayMethodAncestryOnNavigation));
4380
4378
end if ;
4381
4379
4382
4380
-- Retrieve the follow symlinks policy.
4383
4381
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);
4386
4384
end if ;
4387
4385
4388
- if Ada .Has_Field (documentationStyle) then
4386
+ if Options .Has_Field (documentationStyle) then
4389
4387
begin
4390
4388
Self.Options.Documentation.Style :=
4391
4389
GNATdoc.Comments.Options.Documentation_Style'Value
4392
- (Ada .Get (documentationStyle));
4390
+ (Options .Get (documentationStyle));
4393
4391
4394
4392
exception
4395
4393
when Constraint_Error =>
@@ -4401,12 +4399,12 @@ package body LSP.Ada_Handlers is
4401
4399
4402
4400
if not File.Is_Empty then
4403
4401
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);
4410
4408
end if ;
4411
4409
4412
4410
Self.Ensure_Project_Loaded;
0 commit comments