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
39
39
is
40
40
use all type Libadalang.Analysis.Base_Id;
41
41
use all type Libadalang.Common.Ada_Node_Kind_Type;
42
+ use type Libadalang.Common.Token_Kind;
42
43
43
44
Parent : Libadalang.Analysis.Ada_Node;
44
45
-- The parent of the node to complete.
@@ -50,6 +51,21 @@ package body LSP.Ada_Completions.Names is
50
51
51
52
Use_Snippets : Boolean := Self.Snippets_Enabled;
52
53
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;
53
69
begin
54
70
-- Get the outermost dotted name of which node is a prefix, so that when
55
71
-- completing in a situation such as the following:
@@ -172,7 +188,7 @@ package body LSP.Ada_Completions.Names is
172
188
173
189
Names.Include
174
190
(DN.P_Canonical_Part,
175
- (Is_Dot_Call (Item),
191
+ (Error_Dotted_Recovery or else Is_Dot_Call (Item),
176
192
Is_Visible (Item),
177
193
Use_Snippets,
178
194
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