Skip to content

Commit 7b1137c

Browse files
BoulangerAdrienBoulanger
authored andcommitted
Simplify function snippet parameters
The output for "Name completion snippet" was: "Name => Name in out Type" The new output is similar to the "Param completion snippet": "Name => in out Type" Add a test. eng/ide/gnatstudio#85
1 parent 33f9b1c commit 7b1137c

File tree

6 files changed

+248
-3
lines changed

6 files changed

+248
-3
lines changed

source/ada/lsp-ada_documents.adb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2454,9 +2454,6 @@ package body LSP.Ada_Documents is
24542454
(VSS.Strings.Conversions.To_Virtual_String
24552455
(GNATCOLL.Utils.Image (Idx, Min_Width => 1)));
24562456
Insert_Text.Append (':');
2457-
Insert_Text.Append
2458-
(LSP.Lal_Utils.To_Virtual_String (Id.Text));
2459-
Insert_Text.Append (" : ");
24602457
Insert_Text.Append
24612458
((if Mode /= ""
24622459
then LSP.Lal_Utils.To_Virtual_String (Mode & " ")
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 Languages use ("Ada");
4+
for Source_Dirs use ("src");
5+
for Main use ("main.adb");
6+
end Default;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
with Pack; use Pack;
2+
3+
procedure Main is
4+
begin
5+
Fo
6+
end Main;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package Pack is
2+
3+
procedure Foo (I : Integer; J : Integer) is null;
4+
procedure Foo (S : String) is null;
5+
6+
end Pack;
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
[
2+
{
3+
"comment": [
4+
"Test namedNotationThreshold configuration"
5+
]
6+
},
7+
{
8+
"start": {
9+
"cmd": [
10+
"${ALS}"
11+
]
12+
}
13+
},{
14+
"send": {
15+
"request": {
16+
"jsonrpc": "2.0",
17+
"id": 1,
18+
"method": "initialize",
19+
"params": {
20+
"processId": 199714,
21+
"rootUri": "$URI{.}",
22+
"capabilities": {
23+
"workspace": {
24+
"applyEdit": true
25+
},
26+
"textDocument": {
27+
"completion": {
28+
"completionItem": {
29+
"snippetSupport": true,
30+
"documentationFormat": [
31+
"markdown",
32+
"plaintext"
33+
]
34+
}
35+
}
36+
},
37+
"window": {
38+
"workDoneProgress": true
39+
}
40+
}
41+
}
42+
},
43+
"wait": [
44+
{
45+
"jsonrpc": "2.0",
46+
"id": 1,
47+
"result": {
48+
"capabilities": {
49+
"textDocumentSync": 2,
50+
"completionProvider": {
51+
"triggerCharacters": [
52+
".",
53+
",",
54+
"'",
55+
"("
56+
],
57+
"resolveProvider": true
58+
}
59+
}
60+
}
61+
}
62+
]
63+
}
64+
},
65+
{
66+
"send": {
67+
"request": {
68+
"jsonrpc": "2.0",
69+
"method": "initialized"
70+
},
71+
"wait": []
72+
}
73+
},
74+
{
75+
"send": {
76+
"request": {
77+
"jsonrpc": "2.0",
78+
"method": "workspace/didChangeConfiguration",
79+
"params": {
80+
"settings": {
81+
"ada": {
82+
"projectFile": "$URI{default.gpr}",
83+
"scenarioVariables": {},
84+
"defaultCharset": "ISO-8859-1",
85+
"enableDiagnostics": true,
86+
"followSymlinks": false,
87+
"documentationStyle": "gnat",
88+
"namedNotationThreshold": 1,
89+
"foldComments": false
90+
}
91+
}
92+
}
93+
},
94+
"wait": []
95+
}
96+
},
97+
{
98+
"send": {
99+
"request": {
100+
"jsonrpc": "2.0",
101+
"method": "textDocument/didOpen",
102+
"params": {
103+
"textDocument": {
104+
"uri": "$URI{src/main.adb}",
105+
"languageId": "Ada",
106+
"version": 0,
107+
"text": "with Pack; use Pack;\n\nprocedure Main is\nbegin\n Fo\nend Main;\n"
108+
}
109+
}
110+
},
111+
"wait": []
112+
}
113+
},
114+
{
115+
"send": {
116+
"request": {
117+
"jsonrpc": "2.0",
118+
"method": "textDocument/didChange",
119+
"params": {
120+
"textDocument": {
121+
"uri": "$URI{src/main.adb}",
122+
"version": 1
123+
},
124+
"contentChanges": [
125+
{
126+
"range": {
127+
"start": {
128+
"line": 4,
129+
"character": 5
130+
},
131+
"end": {
132+
"line": 4,
133+
"character": 5
134+
}
135+
},
136+
"text": "o"
137+
}
138+
]
139+
}
140+
},
141+
"wait": []
142+
}
143+
},
144+
{
145+
"send": {
146+
"request": {
147+
"jsonrpc": "2.0",
148+
"id": 8,
149+
"method": "textDocument/completion",
150+
"params": {
151+
"textDocument": {
152+
"uri": "$URI{src/main.adb}"
153+
},
154+
"position": {
155+
"line": 4,
156+
"character": 6
157+
},
158+
"context": {
159+
"triggerKind": 1
160+
}
161+
}
162+
},
163+
"wait": [
164+
{
165+
"id": 8,
166+
"result": {
167+
"isIncomplete": false,
168+
"items": [
169+
{
170+
"label": "Foo",
171+
"kind": 3,
172+
"sortText": "100&1Foo",
173+
"insertText": "Foo (S => ${1:String})$0",
174+
"insertTextFormat": 2,
175+
"additionalTextEdits": [],
176+
"detail": "procedure Foo (S : String)",
177+
"documentation": "at pack.ads (4:4)"
178+
},
179+
{
180+
"label": "Foo",
181+
"kind": 3,
182+
"sortText": "100&2Foo",
183+
"insertText": "Foo (I => ${1:Integer}, J => ${2:Integer})$0",
184+
"insertTextFormat": 2,
185+
"additionalTextEdits": [],
186+
"detail": "procedure Foo (I : Integer; J : Integer)",
187+
"documentation": "at pack.ads (3:4)"
188+
}
189+
]
190+
}
191+
}
192+
]
193+
}
194+
},
195+
{
196+
"send": {
197+
"request": {
198+
"jsonrpc": "2.0",
199+
"method": "textDocument/didClose",
200+
"params": {
201+
"textDocument": {
202+
"uri": "$URI{src/main.adb}"
203+
}
204+
}
205+
},
206+
"wait": []
207+
}
208+
},
209+
{
210+
"send": {
211+
"request": {
212+
"jsonrpc": "2.0",
213+
"id": 13,
214+
"method": "shutdown"
215+
},
216+
"wait": [
217+
{
218+
"id": 13,
219+
"result": null
220+
}
221+
]
222+
}
223+
},
224+
{
225+
"stop": {
226+
"exit_code": 0
227+
}
228+
}
229+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
title: 'completion.param.threshold'

0 commit comments

Comments
 (0)