Skip to content

Commit 2810584

Browse files
committed
Variant of Imprecise_Resolve_Name...
... to return both definig name and origin nodes.
1 parent 23872d5 commit 2810584

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
------------------------------------------------------------------------------
2+
-- Language Server Protocol --
3+
-- --
4+
-- Copyright (C) 2025, AdaCore --
5+
-- --
6+
-- This is free software; you can redistribute it and/or modify it under --
7+
-- terms of the GNU General Public License as published by the Free Soft- --
8+
-- ware Foundation; either version 3, or (at your option) any later ver- --
9+
-- sion. This software is distributed in the hope that it will be useful, --
10+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
11+
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
12+
-- License for more details. You should have received a copy of the GNU --
13+
-- General Public License distributed with this software; see file --
14+
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy --
15+
-- of the license. --
16+
------------------------------------------------------------------------------
17+
18+
package body LSP.Ada_Job_Contexts is
19+
20+
----------------------------
21+
-- Imprecise_Resolve_Name --
22+
----------------------------
23+
24+
procedure Imprecise_Resolve_Name
25+
(Self : in out Ada_Job_Context'Class;
26+
Context : LSP.Ada_Contexts.Context;
27+
Position : LSP.Structures.TextDocumentPositionParams'Class;
28+
Name : out Libadalang.Analysis.Defining_Name;
29+
Origin : out Libadalang.Analysis.Ada_Node) is
30+
begin
31+
Origin := Self.Get_Node_At (Context, Position);
32+
Name :=
33+
Self.Imprecise_Resolve_Name
34+
(Laltools.Common.Get_Node_As_Name (Origin));
35+
end Imprecise_Resolve_Name;
36+
37+
end LSP.Ada_Job_Contexts;

source/ada/lsp-ada_job_contexts.ads

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Language Server Protocol --
33
-- --
4-
-- Copyright (C) 2024, AdaCore --
4+
-- Copyright (C) 2024-2025, 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- --
@@ -155,6 +155,13 @@ package LSP.Ada_Job_Contexts is
155155
(Laltools.Common.Get_Node_As_Name
156156
(Self.Get_Node_At (Context, Position))));
157157

158+
procedure Imprecise_Resolve_Name
159+
(Self : in out Ada_Job_Context'Class;
160+
Context : LSP.Ada_Contexts.Context;
161+
Position : LSP.Structures.TextDocumentPositionParams'Class;
162+
Name : out Libadalang.Analysis.Defining_Name;
163+
Origin : out Libadalang.Analysis.Ada_Node);
164+
158165
function To_LSP_Location
159166
(Self : in out Ada_Job_Context;
160167
Node : Libadalang.Analysis.Ada_Node'Class)

0 commit comments

Comments
 (0)