Skip to content

Commit 57e4ba0

Browse files
U915-024: Don't insert 'invisible' in supbs snippets
Add an automatic test.
1 parent 8a198fc commit 57e4ba0

File tree

6 files changed

+276
-1
lines changed

6 files changed

+276
-1
lines changed

source/ada/lsp-ada_documents.adb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1890,7 +1890,7 @@ package body LSP.Ada_Documents is
18901890
end if;
18911891

18921892
declare
1893-
Insert_Text : VSS.Strings.Virtual_String := Item.label;
1893+
Insert_Text : VSS.Strings.Virtual_String := Label;
18941894
All_Params : constant Param_Spec_Array := Subp_Spec_Node.P_Params;
18951895

18961896
Params : constant Param_Spec_Array :=
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
project Default is
2+
3+
for Main use ("main.adb") & project'Main;
4+
5+
end Default;
6+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
procedure Main is
2+
begin
3+
Do_S
4+
end Main;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package Test is
2+
3+
procedure Do_Something (A : Integer);
4+
5+
end Test;
Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
[
2+
{
3+
"comment": [
4+
"Test that '(invisible)' is not present in snippets"
5+
]
6+
},
7+
{
8+
"start": {
9+
"cmd": [
10+
"${ALS}"
11+
]
12+
}
13+
},
14+
{
15+
"send": {
16+
"request": {
17+
"jsonrpc": "2.0",
18+
"id": 1,
19+
"method": "initialize",
20+
"params": {
21+
"processId": 715504,
22+
"rootUri": "$URI{.}",
23+
"capabilities": {
24+
"workspace": {
25+
"applyEdit": true,
26+
"workspaceEdit": {}
27+
},
28+
"textDocument": {
29+
"synchronization": {},
30+
"completion": {
31+
"dynamicRegistration": true,
32+
"completionItem": {
33+
"snippetSupport": true,
34+
"documentationFormat": [
35+
"plaintext",
36+
"markdown"
37+
],
38+
"resolveSupport": {
39+
"properties": [
40+
"detail",
41+
"documentation"
42+
]
43+
}
44+
}
45+
},
46+
"hover": {},
47+
"signatureHelp": {},
48+
"declaration": {},
49+
"definition": {},
50+
"typeDefinition": {},
51+
"implementation": {},
52+
"documentSymbol": {
53+
"hierarchicalDocumentSymbolSupport": true
54+
},
55+
"formatting": {
56+
"dynamicRegistration": false
57+
},
58+
"rangeFormatting": {
59+
"dynamicRegistration": false
60+
},
61+
"onTypeFormatting": {
62+
"dynamicRegistration": false
63+
},
64+
"foldingRange": {
65+
"lineFoldingOnly": true
66+
}
67+
}
68+
}
69+
}
70+
},
71+
"wait": [
72+
{
73+
"id": 1,
74+
"result": {
75+
"capabilities": {
76+
"textDocumentSync": 2,
77+
"completionProvider": {
78+
"triggerCharacters": [
79+
".",
80+
"("
81+
],
82+
"resolveProvider": true
83+
},
84+
"hoverProvider": true,
85+
"signatureHelpProvider": {
86+
"triggerCharacters": [
87+
",",
88+
"("
89+
],
90+
"retriggerCharacters": [
91+
"\b"
92+
]
93+
},
94+
"declarationProvider": true,
95+
"definitionProvider": true,
96+
"typeDefinitionProvider": true,
97+
"implementationProvider": true,
98+
"referencesProvider": true,
99+
"documentHighlightProvider": true,
100+
"documentSymbolProvider": true,
101+
"codeActionProvider": {},
102+
"documentFormattingProvider": true,
103+
"renameProvider": {},
104+
"foldingRangeProvider": true,
105+
"executeCommandProvider": {
106+
"commands": [
107+
"als-other-file",
108+
"als-named-parameters",
109+
"als-refactor-imports",
110+
"als-refactor-remove-parameters",
111+
"als-refactor-move-parameter",
112+
"als-refactor-change-parameter-mode",
113+
"als-suppress-separate"
114+
]
115+
},
116+
"workspaceSymbolProvider": true,
117+
"callHierarchyProvider": {},
118+
"alsShowDepsProvider": true,
119+
"alsReferenceKinds": [
120+
"reference",
121+
"access",
122+
"write",
123+
"call",
124+
"dispatching call",
125+
"parent",
126+
"child"
127+
]
128+
}
129+
}
130+
}
131+
]
132+
}
133+
},
134+
{
135+
"send": {
136+
"request": {
137+
"jsonrpc": "2.0",
138+
"method": "initialized"
139+
},
140+
"wait": []
141+
}
142+
},
143+
{
144+
"send": {
145+
"request": {
146+
"jsonrpc": "2.0",
147+
"method": "workspace/didChangeConfiguration",
148+
"params": {
149+
"settings": {
150+
"ada": {
151+
"scenarioVariables": {},
152+
"defaultCharset": "ISO-8859-1",
153+
"enableDiagnostics": false,
154+
"followSymlinks": false
155+
}
156+
}
157+
}
158+
},
159+
"wait": [
160+
{
161+
"jsonrpc": "2.0",
162+
"method": "$/progress",
163+
"params": {
164+
"token": "<ANY>",
165+
"value": {
166+
"kind": "end"
167+
}
168+
}
169+
}
170+
]
171+
}
172+
},
173+
{
174+
"send": {
175+
"request": {
176+
"jsonrpc": "2.0",
177+
"method": "textDocument/didOpen",
178+
"params": {
179+
"textDocument": {
180+
"uri": "$URI{main.adb}",
181+
"languageId": "Ada",
182+
"version": 0,
183+
"text": "procedure Main is\nbegin\n Do_S\nend Main;\n"
184+
}
185+
}
186+
},
187+
"wait": []
188+
}
189+
},
190+
{
191+
"send": {
192+
"request": {
193+
"jsonrpc": "2.0",
194+
"id": 6,
195+
"method": "textDocument/completion",
196+
"params": {
197+
"textDocument": {
198+
"uri": "$URI{main.adb}"
199+
},
200+
"position": {
201+
"line": 2,
202+
"character": 7
203+
}
204+
}
205+
},
206+
"wait": [
207+
{
208+
"id": 6,
209+
"result": {
210+
"isIncomplete": false,
211+
"items": [
212+
{
213+
"label": "Do_Something (invisible)",
214+
"kind": 3,
215+
"sortText": "~Do_Something",
216+
"filterText": "Do_Something",
217+
"insertText": "Do_Something",
218+
"additionalTextEdits": [],
219+
"data": {
220+
"uri": "$URI{test.ads}",
221+
"range": {
222+
"start": {
223+
"line": 2,
224+
"character": 3
225+
},
226+
"end": {
227+
"line": 2,
228+
"character": 40
229+
}
230+
}
231+
}
232+
}
233+
]
234+
}
235+
}
236+
]
237+
}
238+
},
239+
{
240+
"send": {
241+
"request": {
242+
"jsonrpc": "2.0",
243+
"id": 8,
244+
"method": "shutdown"
245+
},
246+
"wait": [
247+
{
248+
"id": 8,
249+
"result": null
250+
}
251+
]
252+
}
253+
},
254+
{
255+
"stop": {
256+
"exit_code": 0
257+
}
258+
}
259+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
title: 'U915-024.completion.invisible_snippets'

0 commit comments

Comments
 (0)