Skip to content

Commit 3bb3db8

Browse files
Merge branch 'topic/als.1193.is_called_by.child_library_procedure' into 'master'
Improve node returns by prepareCallHierarchy See merge request eng/ide/ada_language_server!1410
2 parents b2ebac8 + 4de1cbc commit 3bb3db8

File tree

8 files changed

+631
-3
lines changed

8 files changed

+631
-3
lines changed

source/ada/lsp-ada_handlers.adb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3351,7 +3351,6 @@ package body LSP.Ada_Handlers is
33513351
Call_Hierarchy.Find_Incoming_Calls
33523352
(Self, Response, Filter, C, Definition);
33533353
end if;
3354-
33553354
end Process_Context;
33563355

33573356
begin
@@ -3751,14 +3750,21 @@ package body LSP.Ada_Handlers is
37513750
Node : constant Libadalang.Analysis.Defining_Name :=
37523751
Decl.P_Defining_Name;
37533752

3753+
-- In case the Defining_Name is a Dotted_Name then we need
3754+
-- to point to the func which is the last.
37543755
Location : constant LSP.Structures.Location :=
3755-
Self.To_LSP_Location (Node);
3756+
Self.To_LSP_Location
3757+
(if Node.First_Child.Kind
3758+
in Libadalang.Common.Ada_Dotted_Name_Range
3759+
then Node.First_Child.As_Dotted_Name.F_Suffix
3760+
else Node);
37563761

37573762
Item : constant LSP.Structures.CallHierarchyItem :=
37583763
(name => VSS.Strings.To_Virtual_String (Node.Text),
37593764
kind => Utils.Get_Decl_Kind (Decl),
37603765
tags => <>,
3761-
detail => Utils.Node_Location_Image (Node),
3766+
detail =>
3767+
Utils.Node_Location_Image (Node),
37623768
uri => Location.uri,
37633769
a_range => Span,
37643770
selectionRange => Location.a_range,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
with Root.Child;
2+
with Root.Child.Do_Something;
3+
procedure Main is
4+
begin
5+
Root.Child.Do_Something;
6+
Root.Child.Hello;
7+
end Main;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
procedure Root.Child.Do_Something is
2+
begin
3+
null;
4+
end Root.Child.Do_Something;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package Root.Child is
2+
3+
procedure Hello is null;
4+
5+
end Root.Child;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package Root is
2+
3+
end Root;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
project Test is
2+
for Source_Dirs use ("src");
3+
for Main use ("main.adb");
4+
end Test;

0 commit comments

Comments
 (0)