Skip to content

Commit 5280cd7

Browse files
W103-015 Add tests that range formats the whole file
fix #1073 fix #1074 fix #1086
1 parent 5b09f22 commit 5280cd7

File tree

8 files changed

+554
-0
lines changed

8 files changed

+554
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
project Default is
2+
for Main use ("foo.adb");
3+
package Pretty_Printer is
4+
for Default_Switches ("Ada") use ("--source-line-breaks");
5+
end Pretty_Printer;
6+
end Default;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
with -- context_clause_start
2+
Ada.Text_IO;
3+
4+
procedure Debug
5+
is begin
6+
null;
7+
end Debug;
8+
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
[
2+
{
3+
"comment": [
4+
"Test that range formats the whole file"
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": 31570,
22+
"capabilities": {
23+
"textDocument": {
24+
"synchronization": {
25+
"dynamicRegistration": false,
26+
"willSave": true,
27+
"willSaveWaitUntil": true,
28+
"didSave": true
29+
},
30+
"completion": {},
31+
"definition": {},
32+
"hover": {},
33+
"formatting": {
34+
"dynamicRegistration": true
35+
},
36+
"implementation": {},
37+
"codeLens": {},
38+
"typeDefinition": {},
39+
"selectionRange": {},
40+
"documentHighlight": {},
41+
"documentSymbol": {
42+
"hierarchicalDocumentSymbolSupport": true
43+
},
44+
"references": {},
45+
"rangeFormatting": {},
46+
"onTypeFormatting": {},
47+
"declaration": {},
48+
"foldingRange": {
49+
"lineFoldingOnly": true
50+
},
51+
"colorProvider": {}
52+
},
53+
"workspace": {
54+
"applyEdit": true,
55+
"executeCommand": {},
56+
"didChangeWatchedFiles": {},
57+
"workspaceEdit": {},
58+
"didChangeConfiguration": {},
59+
"semanticTokens": {
60+
"refreshSupport": true
61+
}
62+
}
63+
},
64+
"rootUri": "$URI{.}"
65+
}
66+
},
67+
"wait": [
68+
{
69+
"jsonrpc": "2.0",
70+
"id": 1,
71+
"result": {
72+
"capabilities": {
73+
"documentFormattingProvider": true,
74+
"documentRangeFormattingProvider": true
75+
}
76+
}
77+
}
78+
]
79+
}
80+
},
81+
{
82+
"send": {
83+
"request": {
84+
"jsonrpc": "2.0",
85+
"method": "initialized"
86+
},
87+
"wait": []
88+
}
89+
},
90+
{
91+
"send": {
92+
"request": {
93+
"jsonrpc": "2.0",
94+
"method": "workspace/didChangeConfiguration",
95+
"params": {
96+
"settings": {
97+
"ada": {
98+
"projectFile": "$URI{default.gpr}",
99+
"scenarioVariables": {},
100+
"defaultCharset": "ISO-8859-1"
101+
}
102+
}
103+
}
104+
},
105+
"wait": []
106+
}
107+
},
108+
{
109+
"send": {
110+
"request": {
111+
"jsonrpc": "2.0",
112+
"method": "textDocument/didOpen",
113+
"params": {
114+
"textDocument": {
115+
"uri": "$URI{foo.adb}",
116+
"languageId": "Ada",
117+
"version": 0,
118+
"text": "with -- context_clause_start\n Ada.Text_IO;\n\nprocedure Debug\nis begin\n null;\nend Debug;\n"
119+
}
120+
}
121+
},
122+
"wait": []
123+
}
124+
},
125+
{
126+
"send": {
127+
"request": {
128+
"jsonrpc": "2.0",
129+
"id": 2,
130+
"method": "textDocument/rangeFormatting",
131+
"params": {
132+
"textDocument": {
133+
"uri": "$URI{foo.adb}"
134+
},
135+
"options": {
136+
"tabSize": 8,
137+
"insertSpaces": true,
138+
"insertFinalNewline": true,
139+
"trimFinalNewlines": true
140+
},
141+
"range": {
142+
"start": {
143+
"line": 0,
144+
"character": 0
145+
},
146+
"end": {
147+
"line": 7,
148+
"character": 0
149+
}
150+
}
151+
}
152+
},
153+
"wait": [
154+
{
155+
"jsonrpc": "2.0",
156+
"id": 2,
157+
"result": [
158+
{
159+
"range": {
160+
"start": {
161+
"line": 0,
162+
"character": 0
163+
},
164+
"end": {
165+
"line": 6,
166+
"character": 10
167+
}
168+
},
169+
"newText": "with -- context_clause_start\n Ada.Text_IO;\n\nprocedure Debug\nis begin\n null;\nend Debug;"
170+
}
171+
]
172+
}
173+
]
174+
}
175+
},
176+
{
177+
"send": {
178+
"request": {
179+
"jsonrpc": "2.0",
180+
"method": "textDocument/didClose",
181+
"params": {
182+
"textDocument": {
183+
"uri": "$URI{foo.adb}"
184+
}
185+
}
186+
},
187+
"wait": []
188+
}
189+
},
190+
{
191+
"stop": {
192+
"exit_code": 0
193+
}
194+
}
195+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
title: 'W103-015_GitHub-1073-1074'
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
project Default is
2+
for Main use ("foo.adb");
3+
package Pretty_Printer is
4+
for Default_Switches ("Ada") use ("--source-line-breaks");
5+
end Pretty_Printer;
6+
end Default;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
procedure Debug
2+
is
3+
4+
begin
5+
E := (1 => --
6+
'A');
7+
end Debug;

0 commit comments

Comments
 (0)