Skip to content

Commit

Permalink
Merge branch 'topic/als.1509.goto_manual_fallback_defensive_code' int…
Browse files Browse the repository at this point in the history
…o 'master'

Add defensive code for goto manual fallback

Closes ada_language_server#1509

See merge request eng/ide/libadalang-tools!263
  • Loading branch information
AnthonyLeonardoGracio committed Nov 20, 2024
2 parents 28e8b0c + 5fe76e0 commit f3094da
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/laltools-common.adb
Original file line number Diff line number Diff line change
Expand Up @@ -1194,19 +1194,26 @@ package body Laltools.Common is
-- finding the best through a distance/scoring heuristics.
if Node.Kind in Libadalang.Common.Ada_Basic_Decl then
declare
Decl : constant Basic_Decl := Node.As_Basic_Decl;
Def : constant Defining_Name := Decl.P_Defining_Name;
Def_Name : constant Langkit_Support.Text.Text_Type :=
Def.P_Fully_Qualified_Name;
Decl : constant Basic_Decl := Node.As_Basic_Decl;
Def : constant Defining_Name := Decl.P_Defining_Name;
begin
-- Search a declaration with the same qualified_name which is
-- not Definition itself.
if Def /= Definition
and then Def_Name = Qualified_Name
then
Found := Def;
return Libadalang.Common.Stop;
if Def.Is_Null then
return Libadalang.Common.Into;
end if;

declare
Def_Name : constant Langkit_Support.Text.Text_Type :=
Def.P_Fully_Qualified_Name;
begin
-- Search a declaration with the same qualified_name
-- which is not Definition itself.
if Def /= Definition
and then Def_Name = Qualified_Name
then
Found := Def;
return Libadalang.Common.Stop;
end if;
end;
end;
end if;

Expand Down

0 comments on commit f3094da

Please sign in to comment.