File tree Expand file tree Collapse file tree 6 files changed +412
-1
lines changed
testsuite/ada_lsp/completion.dotted_call.keyword Expand file tree Collapse file tree 6 files changed +412
-1
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ package body LSP.Ada_Completions.Names is
3939 is
4040 use all type Libadalang.Analysis.Base_Id;
4141 use all type Libadalang.Common.Ada_Node_Kind_Type;
42+ use type Libadalang.Common.Token_Kind;
4243
4344 Parent : Libadalang.Analysis.Ada_Node;
4445 -- The parent of the node to complete.
@@ -50,6 +51,21 @@ package body LSP.Ada_Completions.Names is
5051
5152 Use_Snippets : Boolean := Self.Snippets_Enabled;
5253
54+ -- Error recovery for Obj.XXX with XXX a keyword => LAL will often
55+ -- consider it as:
56+ -- - CallStmt
57+ -- - Dotted_Name
58+ -- - ErrorStmt/LoopStmt/etc.
59+ Error_Dotted_Recovery : constant Boolean :=
60+ Libadalang.Analysis.Is_Keyword
61+ (Token => Token,
62+ Version => Libadalang.Common.Ada_2012)
63+ and then
64+ Libadalang.Common.Kind
65+ (Libadalang.Common.Data
66+ (Libadalang.Common.Previous
67+ (Token, Exclude_Trivia => True)))
68+ = Libadalang.Common.Ada_Dot;
5369 begin
5470 -- Get the outermost dotted name of which node is a prefix, so that when
5571 -- completing in a situation such as the following:
@@ -172,7 +188,7 @@ package body LSP.Ada_Completions.Names is
172188
173189 Names.Include
174190 (DN.P_Canonical_Part,
175- (Is_Dot_Call (Item),
191+ (Error_Dotted_Recovery or else Is_Dot_Call (Item),
176192 Is_Visible (Item),
177193 Use_Snippets,
178194 Completion_Count,
Original file line number Diff line number Diff line change 1+ package Bar is
2+
3+ type My_Int is tagged record
4+ A : Integer;
5+ end record ;
6+
7+ procedure Do_Nothing (Obj : My_Int; A :Integer; B : Integer) is null ;
8+
9+ end Bar ;
Original file line number Diff line number Diff line change 1+ project Default is
2+
3+ for Languages use ("Ada");
4+ for Main use ("main.adb");
5+ end Default;
Original file line number Diff line number Diff line change 1+ with Bar ; use Bar;
2+ with Ada.Text_IO ;
3+
4+ procedure Main is
5+ Obj : My_Int := (A => 10 );
6+ begin
7+ Obj.
8+ end Main ;
You can’t perform that action at this time.
0 commit comments