Skip to content

Commit 4dd4055

Browse files
committed
Add test for the hover on incomplete types
The hover should get the complete type when it is in the public part. For #1320
1 parent 88e23c7 commit 4dd4055

File tree

5 files changed

+314
-0
lines changed

5 files changed

+314
-0
lines changed
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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
with P;
2+
3+
procedure Main
4+
is
5+
Foo : P.Incomplete;
6+
Bar : P.Incomplete_2;
7+
begin
8+
null;
9+
end Main;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package P is
2+
type Incomplete;
3+
type Incomplete_2;
4+
5+
type Something is record
6+
X : Incomplete;
7+
end record;
8+
9+
type Incomplete is record
10+
Y : Integer;
11+
end record;
12+
13+
private
14+
type Incomplete_2 is record
15+
Z : Integer;
16+
end record;
17+
end P;
Lines changed: 285 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
[
2+
{
3+
"comment": [
4+
"This test checks that the textDocument/hover request works fine ",
5+
"on predefined entities (pragmas, aspects, attributes)."
6+
]
7+
},
8+
{
9+
"start": {
10+
"cmd": ["${ALS}"]
11+
}
12+
},
13+
{
14+
"send": {
15+
"request": {
16+
"jsonrpc": "2.0",
17+
"id": 1,
18+
"method": "initialize",
19+
"params": {
20+
"processId": 2357134,
21+
"rootUri": "$URI{.}",
22+
"capabilities": {
23+
"workspace": {
24+
"applyEdit": true,
25+
"workspaceEdit": {
26+
"documentChanges": true,
27+
"resourceOperations": ["rename"]
28+
}
29+
},
30+
"textDocument": {
31+
"synchronization": {},
32+
"completion": {
33+
"dynamicRegistration": true,
34+
"completionItem": {
35+
"snippetSupport": false,
36+
"documentationFormat": ["plaintext", "markdown"],
37+
"resolveSupport": {
38+
"properties": ["detail", "documentation"]
39+
}
40+
}
41+
},
42+
"hover": {},
43+
"signatureHelp": {},
44+
"declaration": {},
45+
"definition": {},
46+
"typeDefinition": {},
47+
"implementation": {},
48+
"documentSymbol": {
49+
"hierarchicalDocumentSymbolSupport": true
50+
},
51+
"codeAction": {
52+
"codeActionLiteralSupport": {
53+
"codeActionKind": {
54+
"valueSet": [
55+
"",
56+
"quickfix",
57+
"refactor",
58+
"refactor.extract",
59+
"refactor.inline",
60+
"refactor.rewrite",
61+
"source",
62+
"source.organizeImports"
63+
]
64+
}
65+
}
66+
},
67+
"formatting": {
68+
"dynamicRegistration": false
69+
},
70+
"rangeFormatting": {
71+
"dynamicRegistration": false
72+
},
73+
"onTypeFormatting": {
74+
"dynamicRegistration": false
75+
},
76+
"publishDiagnostics": {
77+
"relatedInformation": true
78+
},
79+
"foldingRange": {
80+
"lineFoldingOnly": true
81+
}
82+
},
83+
"experimental": {
84+
"advanced_refactorings": ["add_parameter"]
85+
}
86+
}
87+
}
88+
},
89+
"wait": [
90+
{
91+
"id": 1,
92+
"result": {
93+
"capabilities": {
94+
"textDocumentSync": 2,
95+
"completionProvider": {
96+
"triggerCharacters": [".", ",", "'", "("],
97+
"resolveProvider": true
98+
},
99+
"hoverProvider": true,
100+
"signatureHelpProvider": {
101+
"triggerCharacters": [",", "("],
102+
"retriggerCharacters": ["\b"]
103+
},
104+
"declarationProvider": true,
105+
"definitionProvider": true,
106+
"typeDefinitionProvider": true,
107+
"implementationProvider": true,
108+
"referencesProvider": true,
109+
"documentHighlightProvider": true,
110+
"documentSymbolProvider": true,
111+
"codeActionProvider": {
112+
"workDoneProgress": false,
113+
"codeActionKinds": ["quickfix", "refactor.rewrite"],
114+
"resolveProvider": false
115+
},
116+
"workspaceSymbolProvider": true,
117+
"documentFormattingProvider": true,
118+
"documentRangeFormattingProvider": true,
119+
"documentOnTypeFormattingProvider": {
120+
"firstTriggerCharacter": "\n"
121+
},
122+
"renameProvider": {
123+
"prepareProvider": true
124+
},
125+
"foldingRangeProvider": true,
126+
"executeCommandProvider": {
127+
"commands": ["<HAS>", "als-other-file"]
128+
},
129+
"callHierarchyProvider": true,
130+
"semanticTokensProvider": {
131+
"legend": {
132+
"tokenTypes": [],
133+
"tokenModifiers": []
134+
},
135+
"range": true,
136+
"full": true
137+
},
138+
"workspace": {},
139+
"alsReferenceKinds": ["<HAS>", "reference"]
140+
}
141+
}
142+
}
143+
]
144+
}
145+
},
146+
{
147+
"send": {
148+
"request": {
149+
"jsonrpc": "2.0",
150+
"method": "initialized"
151+
},
152+
"wait": []
153+
}
154+
},
155+
{
156+
"send": {
157+
"request": {
158+
"jsonrpc": "2.0",
159+
"method": "workspace/didChangeConfiguration",
160+
"params": {
161+
"settings": {
162+
"ada": {
163+
"scenarioVariables": {},
164+
"defaultCharset": "ISO-8859-1",
165+
"enableDiagnostics": false,
166+
"followSymlinks": false,
167+
"documentationStyle": "gnat",
168+
"namedNotationThreshold": 3,
169+
"foldComments": false
170+
}
171+
}
172+
}
173+
},
174+
"wait": []
175+
}
176+
},
177+
{
178+
"send": {
179+
"request": {
180+
"jsonrpc": "2.0",
181+
"method": "textDocument/didOpen",
182+
"params": {
183+
"textDocument": {
184+
"uri": "$URI{main.adb}",
185+
"languageId": "Ada",
186+
"version": 0,
187+
"text": "with P;\n\nprocedure Main\nis\n Foo : P.Incomplete;\n Bar : P.Incomplete_2;\nbegin\n null;\nend Main;"
188+
}
189+
}
190+
},
191+
"wait": []
192+
}
193+
},
194+
{
195+
"send": {
196+
"request": {
197+
"jsonrpc": "2.0",
198+
"id": 4,
199+
"method": "textDocument/hover",
200+
"params": {
201+
"textDocument": {
202+
"uri": "$URI{main.adb}"
203+
},
204+
"position": {
205+
"line": 4,
206+
"character": 14
207+
}
208+
}
209+
},
210+
"wait": [
211+
{
212+
"id": 4,
213+
"result": {
214+
"contents": [
215+
{
216+
"language": "ada",
217+
"value": "type Incomplete is record\n Y : Integer;\nend record;"
218+
},
219+
"at p.ads (2:4)"
220+
]
221+
}
222+
}
223+
]
224+
}
225+
},
226+
{
227+
"send": {
228+
"request": {
229+
"jsonrpc": "2.0",
230+
"id": 5,
231+
"method": "textDocument/hover",
232+
"params": {
233+
"textDocument": {
234+
"uri": "$URI{main.adb}"
235+
},
236+
"position": {
237+
"line": 5,
238+
"character": 14
239+
}
240+
}
241+
},
242+
"wait": [
243+
{
244+
"id": 5,
245+
"result": null
246+
}
247+
]
248+
}
249+
},
250+
251+
{
252+
"send": {
253+
"request": {
254+
"jsonrpc": "2.0",
255+
"method": "textDocument/didClose",
256+
"params": {
257+
"textDocument": {
258+
"uri": "$URI{main.adb}"
259+
}
260+
}
261+
},
262+
"wait": []
263+
}
264+
},
265+
{
266+
"send": {
267+
"request": {
268+
"jsonrpc": "2.0",
269+
"id": 7,
270+
"method": "shutdown"
271+
},
272+
"wait": [
273+
{
274+
"id": 7,
275+
"result": null
276+
}
277+
]
278+
}
279+
},
280+
{
281+
"stop": {
282+
"exit_code": 0
283+
}
284+
}
285+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
title: 'hover.predefined_entities'

0 commit comments

Comments
 (0)