Skip to content

Commit 92b9622

Browse files
author
mergerepo
committed
Merge remote branch 'origin/master' into edge
(no-precommit-check no-tn-check)
2 parents ff71a9b + b37053b commit 92b9622

File tree

5 files changed

+309
-2
lines changed

5 files changed

+309
-2
lines changed

source/ada/lsp-ada_completions-aggregates.adb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ package body LSP.Ada_Completions.Aggregates is
5050

5151
function Get_Snippet_For_Component
5252
(Param : Base_Formal_Param_Decl;
53-
Idx : Natural;
53+
Idx : in out Natural;
5454
Use_Named_Notation : Boolean) return VSS.Strings.Virtual_String;
5555
-- Return a snippet for the given component
5656

@@ -73,7 +73,7 @@ package body LSP.Ada_Completions.Aggregates is
7373

7474
function Get_Snippet_For_Component
7575
(Param : Base_Formal_Param_Decl;
76-
Idx : Natural;
76+
Idx : in out Natural;
7777
Use_Named_Notation : Boolean) return VSS.Strings.Virtual_String
7878
is
7979
Snippet : VSS.Strings.Virtual_String;
@@ -117,8 +117,12 @@ package body LSP.Ada_Completions.Aggregates is
117117
(VSS.Strings.To_Virtual_String (Param_Type.Text));
118118
Snippet.Append ("}, ");
119119
end if;
120+
121+
Idx := Idx + 1;
120122
end loop;
121123

124+
Idx := Idx - 1;
125+
122126
return Snippet;
123127
end Get_Snippet_For_Component;
124128

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
project Default is
2+
3+
package Compiler is
4+
for Switches ("Ada") use ("-g", "-O2");
5+
end Compiler;
6+
7+
for Main use ("main.adb") & project'Main;
8+
9+
end Default;
10+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
procedure Main is
2+
type Aggr_Type_1 is record
3+
A, B, C : Integer;
4+
end record;
5+
6+
Obj : Aggr_Type_1;
7+
begin
8+
Obj :=
9+
end Main;
Lines changed: 283 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
[
2+
{
3+
"comment": [
4+
"This test verifies that snippet for aggregates have correct indexes",
5+
" when the record fields are put on the same line (i.e: A, B : Integer)."
6+
]
7+
},
8+
{
9+
"start": {
10+
"cmd": [
11+
"${ALS}"
12+
]
13+
}
14+
},
15+
{
16+
"send": {
17+
"request": {
18+
"jsonrpc": "2.0",
19+
"id": 1,
20+
"method": "initialize",
21+
"params": {
22+
"processId": 657005,
23+
"rootUri": "$URI{.}",
24+
"capabilities": {
25+
"workspace": {
26+
"applyEdit": true,
27+
"workspaceEdit": {
28+
"documentChanges": true,
29+
"resourceOperations": [
30+
"rename"
31+
]
32+
}
33+
},
34+
"textDocument": {
35+
"synchronization": {},
36+
"completion": {
37+
"dynamicRegistration": true,
38+
"completionItem": {
39+
"snippetSupport": false,
40+
"documentationFormat": [
41+
"plaintext",
42+
"markdown"
43+
],
44+
"resolveSupport": {
45+
"properties": [
46+
"detail",
47+
"documentation"
48+
]
49+
}
50+
}
51+
},
52+
"hover": {},
53+
"signatureHelp": {},
54+
"declaration": {},
55+
"definition": {},
56+
"typeDefinition": {},
57+
"implementation": {},
58+
"documentSymbol": {
59+
"hierarchicalDocumentSymbolSupport": true
60+
},
61+
"formatting": {
62+
"dynamicRegistration": false
63+
},
64+
"rangeFormatting": {
65+
"dynamicRegistration": false
66+
},
67+
"onTypeFormatting": {
68+
"dynamicRegistration": false
69+
},
70+
"foldingRange": {
71+
"lineFoldingOnly": true
72+
}
73+
}
74+
}
75+
}
76+
},
77+
"wait": [
78+
{
79+
"id": 1,
80+
"result": {
81+
"capabilities": {
82+
"textDocumentSync": 2,
83+
"completionProvider": {
84+
"triggerCharacters": [
85+
".",
86+
",",
87+
"'",
88+
"("
89+
],
90+
"resolveProvider": true
91+
},
92+
"hoverProvider": true,
93+
"signatureHelpProvider": {
94+
"triggerCharacters": [
95+
",",
96+
"("
97+
],
98+
"retriggerCharacters": [
99+
"\b"
100+
]
101+
},
102+
"declarationProvider": true,
103+
"definitionProvider": true,
104+
"typeDefinitionProvider": true,
105+
"implementationProvider": true,
106+
"referencesProvider": true,
107+
"documentHighlightProvider": true,
108+
"documentSymbolProvider": true,
109+
"codeActionProvider": {},
110+
"documentFormattingProvider": true,
111+
"renameProvider": {},
112+
"foldingRangeProvider": true,
113+
"workspaceSymbolProvider": true,
114+
"callHierarchyProvider": {},
115+
"alsShowDepsProvider": true,
116+
"alsReferenceKinds": [
117+
"reference",
118+
"access",
119+
"write",
120+
"call",
121+
"dispatching call",
122+
"parent",
123+
"child",
124+
"overriding"
125+
],
126+
"alsCheckSyntaxProvider": true
127+
}
128+
}
129+
}
130+
]
131+
}
132+
},
133+
{
134+
"send": {
135+
"request": {
136+
"jsonrpc": "2.0",
137+
"method": "initialized"
138+
},
139+
"wait": []
140+
}
141+
},
142+
{
143+
"send": {
144+
"request": {
145+
"jsonrpc": "2.0",
146+
"method": "workspace/didChangeConfiguration",
147+
"params": {
148+
"settings": {
149+
"ada": {
150+
"scenarioVariables": {},
151+
"defaultCharset": "ISO-8859-1",
152+
"enableDiagnostics": false,
153+
"followSymlinks": false,
154+
"documentationStyle": "gnat",
155+
"foldComments": false
156+
}
157+
}
158+
}
159+
},
160+
"wait": []
161+
}
162+
},
163+
{
164+
"send": {
165+
"request": {
166+
"jsonrpc": "2.0",
167+
"method": "textDocument/didOpen",
168+
"params": {
169+
"textDocument": {
170+
"uri": "$URI{main.adb}",
171+
"languageId": "Ada",
172+
"version": 0,
173+
"text": "procedure Main is\n type Aggr_Type_1 is record\n A, B, C : Integer;\n end record;\n\n Obj : Aggr_Type_1;\nbegin\n Obj :=\nend Main;\n"
174+
}
175+
}
176+
},
177+
"wait": []
178+
}
179+
},
180+
{
181+
"send": {
182+
"request": {
183+
"jsonrpc": "2.0",
184+
"method": "textDocument/didChange",
185+
"params": {
186+
"textDocument": {
187+
"uri": "$URI{main.adb}",
188+
"version": 1
189+
},
190+
"contentChanges": [
191+
{
192+
"range": {
193+
"start": {
194+
"line": 7,
195+
"character": 9
196+
},
197+
"end": {
198+
"line": 7,
199+
"character": 9
200+
}
201+
},
202+
"text": "("
203+
}
204+
]
205+
}
206+
},
207+
"wait": []
208+
}
209+
},
210+
{
211+
"send": {
212+
"request": {
213+
"jsonrpc": "2.0",
214+
"id": 5,
215+
"method": "textDocument/completion",
216+
"params": {
217+
"textDocument": {
218+
"uri": "$URI{main.adb}"
219+
},
220+
"position": {
221+
"line": 7,
222+
"character": 10
223+
},
224+
"context": {
225+
"triggerKind": 2
226+
}
227+
}
228+
},
229+
"wait": [
230+
{
231+
"id": 5,
232+
"result": {
233+
"isIncomplete": false,
234+
"items": [
235+
{
236+
"label": "Aggregate for Aggr_Type_1",
237+
"kind": 15,
238+
"detail": "type Aggr_Type_1 is record\n A, B, C : Integer;\nend record;",
239+
"insertText": "A => ${1:Integer}, B => ${2:Integer}, C => ${3:Integer})$0",
240+
"insertTextFormat": 2,
241+
"additionalTextEdits": []
242+
}
243+
]
244+
}
245+
}
246+
]
247+
}
248+
},
249+
{
250+
"send": {
251+
"request": {
252+
"jsonrpc": "2.0",
253+
"method": "textDocument/didClose",
254+
"params": {
255+
"textDocument": {
256+
"uri": "$URI{main.adb}"
257+
}
258+
}
259+
},
260+
"wait": []
261+
}
262+
},
263+
{
264+
"send": {
265+
"request": {
266+
"jsonrpc": "2.0",
267+
"id": 9,
268+
"method": "shutdown"
269+
},
270+
"wait": [
271+
{
272+
"id": 9,
273+
"result": null
274+
}
275+
]
276+
}
277+
},
278+
{
279+
"stop": {
280+
"exit_code": 0
281+
}
282+
}
283+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
title: 'completion.aggregates.snippet_indexes'

0 commit comments

Comments
 (0)