Skip to content

Commit 91b229c

Browse files
author
automatic-merge
committed
Merge remote branch 'origin/master' into edge
2 parents b6ee150 + 14d1b16 commit 91b229c

29 files changed

+936
-313
lines changed

source/ada/lsp-ada_contexts.ads

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@ package LSP.Ada_Contexts is
8282
-- Release the memory associated to Self. You should not use the
8383
-- context after calling this.
8484

85-
-- function URI_To_File
86-
-- (Self : Context;
87-
-- URI : LSP.Types.LSP_URI)
88-
-- return Ada.Strings.UTF_Encoding.UTF_8_String;
89-
--
9085
function URI_To_File
9186
(Self : Context;
9287
URI : LSP.Structures.DocumentUri)

source/ada/lsp-ada_driver.adb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ with GNATCOLL.Utils;
4040
with LSP.Ada_Commands;
4141
with LSP.Ada_Did_Change_Configurations;
4242
with LSP.Ada_Did_Change_Document;
43+
with LSP.Ada_References;
4344
with LSP.Ada_Handlers;
4445
with LSP.Ada_Handlers.Executables_Commands;
4546
with LSP.Ada_Handlers.Mains_Commands;
@@ -74,6 +75,7 @@ with LSP.Predefined_Completion;
7475
with LSP.Secure_Message_Loggers;
7576
with LSP.Server_Notifications.DidChange;
7677
with LSP.Server_Notifications.DidChangeConfiguration;
78+
with LSP.Server_Requests.References;
7779
with LSP.Servers;
7880
with LSP.Stdio_Streams;
7981

@@ -180,6 +182,9 @@ procedure LSP.Ada_Driver is
180182
LSP.Ada_Did_Change_Document.Ada_Did_Change_Handler
181183
(Ada_Handler'Unchecked_Access);
182184

185+
Ada_References_Handler : aliased LSP.Ada_References.Ada_References_Handler
186+
(Ada_Handler'Unchecked_Access);
187+
183188
GPR_Did_Change_Doc_Handler : aliased
184189
LSP.GPR_Did_Change_Document.GPR_Did_Change_Handler
185190
(GPR_Handler'Unchecked_Access);
@@ -388,6 +393,10 @@ begin
388393
(LSP.Server_Notifications.DidChange.Notification'Tag,
389394
Ada_Did_Change_Doc_Handler'Unchecked_Access);
390395

396+
Server.Register_Handler
397+
(LSP.Server_Requests.References.Request'Tag,
398+
Ada_References_Handler'Unchecked_Access);
399+
391400
Server.Run
392401
(Ada_Handler'Unchecked_Access,
393402
Tracer'Unchecked_Access,

source/ada/lsp-ada_handlers-call_hierarchy.adb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ with Laltools.Common;
2323
with Laltools.Call_Hierarchy;
2424

2525
with LSP.GNATCOLL_Tracers.Handle;
26+
with LSP.Ada_Handlers.Locations;
2627
with LSP.Utils;
2728

2829
package body LSP.Ada_Handlers.Call_Hierarchy is
@@ -69,7 +70,7 @@ package body LSP.Ada_Handlers.Call_Hierarchy is
6970
procedure Find_Incoming_Calls
7071
(Self : in out Message_Handler;
7172
Response : in out LSP.Structures.CallHierarchyIncomingCall_Vector;
72-
Filter : in out LSP.Ada_Handlers.Locations.File_Span_Sets.Set;
73+
Filter : in out LSP.Locations.File_Span_Sets.Set;
7374
Context : LSP.Ada_Contexts.Context;
7475
Definition : Libadalang.Analysis.Defining_Name)
7576
is
@@ -206,7 +207,7 @@ package body LSP.Ada_Handlers.Call_Hierarchy is
206207
procedure Find_Outgoing_Calls
207208
(Self : in out Message_Handler;
208209
Response : in out LSP.Structures.CallHierarchyOutgoingCall_Vector;
209-
Filter : in out LSP.Ada_Handlers.Locations.File_Span_Sets.Set;
210+
Filter : in out LSP.Locations.File_Span_Sets.Set;
210211
Definition : Libadalang.Analysis.Defining_Name)
211212
is
212213
use Laltools.Common.References_By_Subprogram;

source/ada/lsp-ada_handlers-call_hierarchy.ads

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
with Libadalang.Analysis;
1919

2020
with LSP.Ada_Contexts;
21-
with LSP.Ada_Handlers.Locations;
21+
with LSP.Locations;
2222

2323
package LSP.Ada_Handlers.Call_Hierarchy is
2424

2525
procedure Find_Incoming_Calls
2626
(Self : in out Message_Handler;
2727
Response : in out LSP.Structures.CallHierarchyIncomingCall_Vector;
28-
Filter : in out LSP.Ada_Handlers.Locations.File_Span_Sets.Set;
28+
Filter : in out LSP.Locations.File_Span_Sets.Set;
2929
Context : LSP.Ada_Contexts.Context;
3030
Definition : Libadalang.Analysis.Defining_Name)
3131
with Pre => Definition.P_Basic_Decl.P_Is_Subprogram;
@@ -36,7 +36,7 @@ package LSP.Ada_Handlers.Call_Hierarchy is
3636
procedure Find_Outgoing_Calls
3737
(Self : in out Message_Handler;
3838
Response : in out LSP.Structures.CallHierarchyOutgoingCall_Vector;
39-
Filter : in out LSP.Ada_Handlers.Locations.File_Span_Sets.Set;
39+
Filter : in out LSP.Locations.File_Span_Sets.Set;
4040
Definition : Libadalang.Analysis.Defining_Name)
4141
with Pre => Definition.P_Basic_Decl.P_Is_Subprogram;
4242
-- Return the list of all the calls made in the subprogram pointed at by

source/ada/lsp-ada_handlers-locations.adb

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ package body LSP.Ada_Handlers.Locations is
3838
procedure Append_Location
3939
(Self : in out Message_Handler;
4040
Result : in out LSP.Structures.Location_Vector;
41-
Filter : in out LSP.Ada_Handlers.Locations.File_Span_Sets.Set;
41+
Filter : in out LSP.Locations.File_Span_Sets.Set;
4242
Node : Libadalang.Analysis.Ada_Node'Class;
4343
Kinds : LSP.Structures.AlsReferenceKind_Set := LSP.Constants.Empty) is
4444
begin
@@ -132,17 +132,6 @@ package body LSP.Ada_Handlers.Locations is
132132
end;
133133
end Get_Node_At;
134134

135-
----------
136-
-- Hash --
137-
----------
138-
139-
function Hash
140-
(Value : LSP.Structures.Location) return Ada.Containers.Hash_Type is
141-
use type Ada.Containers.Hash_Type;
142-
begin
143-
return Value.uri.Get_Hash + LSP.Utils.Hash (Value.a_range);
144-
end Hash;
145-
146135
----------
147136
-- Sort --
148137
----------

source/ada/lsp-ada_handlers-locations.ads

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,10 @@ with Libadalang.Common;
2626

2727
with LSP.Ada_Contexts;
2828
with LSP.Constants;
29+
with LSP.Locations;
2930

3031
package LSP.Ada_Handlers.Locations is
3132

32-
function Hash
33-
(Value : LSP.Structures.Location) return Ada.Containers.Hash_Type;
34-
35-
package File_Span_Sets is new Ada.Containers.Hashed_Sets
36-
(Element_Type => LSP.Structures.Location,
37-
Hash => Hash,
38-
Equivalent_Elements => LSP.Structures."=",
39-
"=" => LSP.Structures."=");
40-
4133
function To_LSP_Location
4234
(Self : in out Message_Handler'Class;
4335
Node : Libadalang.Analysis.Ada_Node'Class;
@@ -66,7 +58,7 @@ package LSP.Ada_Handlers.Locations is
6658
procedure Append_Location
6759
(Self : in out Message_Handler;
6860
Result : in out LSP.Structures.Location_Vector;
69-
Filter : in out LSP.Ada_Handlers.Locations.File_Span_Sets.Set;
61+
Filter : in out LSP.Locations.File_Span_Sets.Set;
7062
Node : Libadalang.Analysis.Ada_Node'Class;
7163
Kinds : LSP.Structures.AlsReferenceKind_Set := LSP.Constants.Empty);
7264
-- Append given Node location to the Result.

source/ada/lsp-ada_handlers-project_loading.adb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Language Server Protocol --
33
-- --
4-
-- Copyright (C) 2018-2023, AdaCore --
4+
-- Copyright (C) 2018-2024, AdaCore --
55
-- --
66
-- This is free software; you can redistribute it and/or modify it under --
77
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -426,9 +426,7 @@ package body LSP.Ada_Handlers.Project_Loading is
426426
Self.Project_Tree.Update_Sources (With_Runtime => True);
427427

428428
exception
429-
when E : GPR2.Project_Error
430-
| GPR2.Processing_Error
431-
| GPR2.Attribute_Error =>
429+
when E : others =>
432430

433431
Self.Tracer.Trace_Exception (E);
434432

source/ada/lsp-ada_handlers-renaming.adb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ with LAL_Refactor.Safe_Rename;
2727

2828
with LSP.Ada_Contexts;
2929
with LSP.Ada_Handlers.Locations;
30-
with LSP.Utils;
30+
with LSP.Locations;
3131

3232
package body LSP.Ada_Handlers.Renaming is
3333

@@ -52,14 +52,14 @@ package body LSP.Ada_Handlers.Renaming is
5252
Result := @ + Ada.Containers.Hash_Type'Mod
5353
(Item.TextEdit.newText.Hash);
5454

55-
Result := @ + LSP.Utils.Hash (Item.TextEdit.a_range);
55+
Result := @ + LSP.Locations.Hash (Item.TextEdit.a_range);
5656

5757
when False =>
5858
Result := @ + Ada.Containers.Hash_Type'Mod
5959
(Item.AnnotatedTextEdit.newText.Hash);
6060

6161
Result := @ +
62-
LSP.Utils.Hash (Item.AnnotatedTextEdit.a_range);
62+
LSP.Locations.Hash (Item.AnnotatedTextEdit.a_range);
6363
end case;
6464
end loop;
6565

0 commit comments

Comments
 (0)