Skip to content

Commit a830c15

Browse files
committed
Ignore null nodes in Append_Location.
1 parent 9576f08 commit a830c15

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

source/ada/lsp-ada_declaration.adb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ package body LSP.Ada_Declaration is
219219
(Self.Response,
220220
Self.Filter,
221221
Prev_Part);
222-
elsif not Definition.Is_Null then
223-
-- No previous part, return definition itself.
222+
else
223+
-- No previous part, return definition itself, if not null.
224224
Self.Parent.Context.Append_Location
225225
(Self.Response,
226226
Self.Filter,

source/ada/lsp-ada_definition.adb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,12 @@ package body LSP.Ada_Definition is
248248
Manual_Fallback := Laltools.Common.Find_Other_Part_Fallback
249249
(Definition, Trace);
250250

251-
if not Manual_Fallback.Is_Null then
252-
-- We have found a result using the imprecise heuristics.
253-
-- We'll warn the user and send the result.
254-
Self.Parent.Context.Append_Location
255-
(Self.Response,
256-
Self.Filter,
257-
Manual_Fallback);
258-
end if;
251+
-- If we have found a result using the imprecise heuristics then
252+
-- append it.
253+
Self.Parent.Context.Append_Location
254+
(Self.Response,
255+
Self.Filter,
256+
Manual_Fallback);
259257
else
260258
Self.Parent.Context.Append_Location
261259
(Self.Response,

source/ada/lsp-ada_handlers-locations.adb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ package body LSP.Ada_Handlers.Locations is
4747
Node : Libadalang.Analysis.Ada_Node'Class;
4848
Kinds : LSP.Structures.AlsReferenceKind_Set := LSP.Constants.Empty) is
4949
begin
50-
if not LSP.Utils.Is_Synthetic (Node) then
50+
if not Node.Is_Null and then not LSP.Utils.Is_Synthetic (Node) then
5151
declare
5252
Value : constant LSP.Structures.Location :=
5353
To_LSP_Location (Self, Node, Kinds);

source/ada/lsp-ada_handlers-locations.ads

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ package LSP.Ada_Handlers.Locations is
8080
Kinds : LSP.Structures.AlsReferenceKind_Set := LSP.Constants.Empty);
8181
-- Append given Node location to the Result.
8282
-- Do nothing if the item inside of an synthetic file (like __standard).
83+
-- Null Node is ignored.
8384

8485
procedure Append_Location
8586
(Result : in out LSP.Structures.DocumentHighlight_Vector;

0 commit comments

Comments
 (0)