Skip to content

Commit 8367488

Browse files
committed
Merge branch 'topic/gnatdoc' into 'master'
Remove use of LAL fallback to extract documentation See merge request eng/ide/ada_language_server!1180
2 parents 945e796 + f537b1e commit 8367488

File tree

3 files changed

+9
-25
lines changed

3 files changed

+9
-25
lines changed

source/ada/lsp-ada_driver.adb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ procedure LSP.Ada_Driver is
115115
begin
116116
Trace (Server_Trace,
117117
"EXCEPTION: " & Exception_Name (E) &
118+
Ada.Characters.Latin_1.LF &
119+
"INFORMATION: " & Exception_Information (E) &
118120
Ada.Characters.Latin_1.LF &
119121
Symbolic_Traceback (E));
120122
Ada_Handler.Handle_Error;
@@ -128,6 +130,8 @@ procedure LSP.Ada_Driver is
128130
begin
129131
Trace (Server_Trace,
130132
"EXCEPTION: " & Exception_Name (E) &
133+
Ada.Characters.Latin_1.LF &
134+
"INFORMATION: " & Exception_Information (E) &
131135
Ada.Characters.Latin_1.LF &
132136
Symbolic_Traceback (E));
133137
-- An exception occurred while fuzzing: make it fatal.

source/ada/lsp-lal_utils.adb

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------------
22
-- Language Server Protocol --
33
-- --
4-
-- Copyright (C) 2018-2021, AdaCore --
4+
-- Copyright (C) 2018-2023, 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- --
@@ -31,7 +31,6 @@ with VSS.Unicode;
3131
with Langkit_Support;
3232
with Langkit_Support.Symbols; use Langkit_Support.Symbols;
3333
with Libadalang.Common; use Libadalang.Common;
34-
with Libadalang.Doc_Utils;
3534
with Libadalang.Sources;
3635

3736
with Laltools.Call_Hierarchy;
@@ -805,6 +804,8 @@ package body LSP.Lal_Utils is
805804
Doc_Text : out VSS.Strings.Virtual_String;
806805
Decl_Text : out VSS.Strings.Virtual_String)
807806
is
807+
pragma Unreferenced (Trace);
808+
808809
Options : constant
809810
GNATdoc.Comments.Options.Extractor_Options :=
810811
(Style => Style,
@@ -833,27 +834,6 @@ package body LSP.Lal_Utils is
833834
Decl_Text := Get_Decl_Text (BD);
834835
end if;
835836

836-
-- Obtain documentation via the old engine when GNATdoc fails to extract
837-
-- the comments.
838-
if Doc_Text.Is_Empty then
839-
840-
-- Property_Errors can occur when calling
841-
-- Libadalang.Doc_Utils.Get_Documentation on unsupported
842-
-- docstrings, so add an exception handler to catch them and recover.
843-
begin
844-
Doc_Text :=
845-
VSS.Strings.To_Virtual_String
846-
(Libadalang.Doc_Utils.Get_Documentation
847-
(BD).Doc.To_String);
848-
exception
849-
when Libadalang.Common.Property_Error =>
850-
Trace.Trace
851-
("Failed to compute documentation with LAL"
852-
& "(unsupported docstring) for: " & BD.Image);
853-
Doc_Text := VSS.Strings.Empty_Virtual_String;
854-
end;
855-
end if;
856-
857837
Loc_Text := LSP.Lal_Utils.Node_Location_Image (BD);
858838
end Get_Tooltip_Text;
859839

testsuite/ada_lsp/T713-012.completion.generic_package/test.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@
276276
"label": "Params of G",
277277
"kind": 15,
278278
"detail": "generic\n type Elt_Type(<>) is limited private;\n type Elt_Ptr is access all Elt_Type;\npackage G is\n type T(Length: Natural) is private;\n type T_Ptr is access all T;\nprivate\n type Elt_Array is array(Positive range <>) of Elt_Ptr;\n type T(Length: Natural) is\n\trecord\n\t Elts: Elt_Array(1..Length);\n\tend record;\nend G;",
279-
"documentation": "at g.ads (3:1)\n\nSource:",
279+
"documentation": "at g.ads (3:1)\n\nSource:\n\n@formal Elt_Type\n@formal Elt_Ptr",
280280
"sortText": "+0",
281281
"insertText": "${1:Elt_Type : type Elt_Type(<>) is limited private;}, ${2:Elt_Ptr : type Elt_Ptr is access all Elt_Type;})$0",
282282
"insertTextFormat": 2,
@@ -517,7 +517,7 @@
517517
"label": "Params of G",
518518
"kind": 15,
519519
"detail": "generic\n type Elt_Type(<>) is limited private;\n type Elt_Ptr is access all Elt_Type;\npackage G is\n type T(Length: Natural) is private;\n type T_Ptr is access all T;\nprivate\n type Elt_Array is array(Positive range <>) of Elt_Ptr;\n type T(Length: Natural) is\n\trecord\n\t Elts: Elt_Array(1..Length);\n\tend record;\nend G;",
520-
"documentation": "at g.ads (3:1)\n\nSource:",
520+
"documentation": "at g.ads (3:1)\n\nSource:\n\n@formal Elt_Type\n@formal Elt_Ptr",
521521
"sortText": "+0",
522522
"insertText": " Elt_Ptr => ${2:type Elt_Ptr is access all Elt_Type;})$0",
523523
"insertTextFormat": 2,

0 commit comments

Comments
 (0)