Skip to content

Commit b0e1d05

Browse files
author
mergerepo
committed
Merge remote branch 'origin/master' into edge
(no-precommit-check no-tn-check)
2 parents 6305638 + 29d470d commit b0e1d05

File tree

7 files changed

+391
-20
lines changed

7 files changed

+391
-20
lines changed

source/ada/lsp-ada_handlers.adb

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3952,15 +3952,26 @@ package body LSP.Ada_Handlers is
39523952
Request.params;
39533953
Response : LSP.Messages.Server_Responses.CompletionItemResolve_Response
39543954
(Is_Error => False);
3955-
C : constant Context_Access :=
3956-
Self.Contexts.Get_Best_Context (Item.data.Value.uri);
3957-
Node : Libadalang.Analysis.Ada_Node := Get_Node_At
3955+
C : Context_Access;
3956+
Node : Libadalang.Analysis.Ada_Node;
3957+
begin
3958+
-- Return immediately if we don't have data that allows us to compute
3959+
-- additional information for the given item.
3960+
-- This is the case when all the completion item's fields have already
3961+
-- been computed.
3962+
if not Item.data.Is_Set then
3963+
Response.result := Item;
3964+
return Response;
3965+
end if;
3966+
3967+
C := Self.Contexts.Get_Best_Context (Item.data.Value.uri);
3968+
Node := Get_Node_At
39583969
(Self => C.all,
39593970
Document => null,
39603971
Position => LSP.Messages.TextDocumentPositionParams'
39613972
(textDocument => (uri => Item.data.Value.uri),
39623973
position => Item.data.Value.span.first));
3963-
begin
3974+
39643975
-- Retrieve the Basic_Decl from the completion item's SLOC
39653976
while not Node.Is_Null
39663977
and then Node.Kind not in Libadalang.Common.Ada_Basic_Decl

testsuite/ada_lsp/completion.invisible.runtime/test.json

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
}
163163
}
164164
},
165-
"waitFactor": "4000",
165+
"waitFactor": "40",
166166
"wait": [
167167
{
168168
"jsonrpc": "2.0",
@@ -212,21 +212,22 @@
212212
},
213213
"wait": [
214214
{
215-
"id": 6,
216-
"result": {
217-
"isIncomplete": true,
218-
"items": ["<HAS>",
219-
{
220-
"label": "Text_IO (invisible)",
221-
"kind": 9,
222-
"detail": "package Ada.Text_IO with\n Abstract_State => (File_System),\n Initializes => (File_System),\n Initial_Condition => Line_Length = 0 and Page_Length = 0\n",
223-
"documentation": "at a-textio.ads (58:1)\n\nPreconditions in this unit are meant for analysis only, not for run-time\nchecking, so that the expected exceptions are raised. This is enforced by\nsetting the corresponding assertion policy to Ignore. These preconditions\nare partial. They protect fully against Status_Error and Mode_Error,\npartially against Layout_Error (see SPARK User's Guide for details), and\nnot against other types of errors.",
224-
"sortText": "~Text_IO",
225-
"filterText": "Text_IO",
226-
"insertText": "Text_IO",
227-
"additionalTextEdits": []
228-
}
229-
]
215+
"id": 6,
216+
"result": {
217+
"isIncomplete": true,
218+
"items": ["<HAS>",
219+
{
220+
"label": "Short_Float_Text_IO (invisible)",
221+
"kind": 9,
222+
"detail": "package Ada.Short_Float_Text_IO is\nnew Ada.Text_IO.Float_IO (Short_Float);",
223+
"documentation": "at a-sfteio.ads (18:1)",
224+
"sortText": "~Short_Float_Text_IO",
225+
"filterText": "Short_Float_Text_IO",
226+
"insertText": "Short_Float_Text_IO",
227+
"additionalTextEdits": [
228+
]
229+
}
230+
]
230231
}
231232
}
232233
]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
project Default is
2+
end Default;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
with Test; use Test;
2+
3+
procedure Main is
4+
begin
5+
Selec
6+
end Main;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package Test is
2+
3+
procedure Select_Some is null;
4+
-- This a very useful comment.
5+
6+
end Test;

0 commit comments

Comments
 (0)