Skip to content

Commit 9dba4f8

Browse files
Merge branch 'topic/foldingRange' into 'master'
Fix foldingRange request for 'loop' statements See merge request eng/ide/ada_language_server!2082
2 parents 894141f + fc54626 commit 9dba4f8

File tree

5 files changed

+166
-2
lines changed

5 files changed

+166
-2
lines changed

source/ada/lsp-ada_folding_range.adb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ package body LSP.Ada_Folding_Range is
157157
Ada_Access_To_Subp_Def |
158158
Ada_Case_Stmt |
159159
Ada_If_Stmt |
160-
Ada_For_Loop_Stmt |
161-
Ada_While_Loop_Stmt |
160+
Ada_Base_Loop_Stmt |
162161
Ada_Begin_Block |
163162
Ada_Decl_Block |
164163
Ada_Extended_Return_Stmt_Object_Decl |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
procedure Main is
2+
begin
3+
for I in 1 .. 10 loop
4+
while True loop
5+
loop
6+
exit when I > 5;
7+
-- Inner loop body
8+
end loop;
9+
end loop;
10+
end loop;
11+
end Main;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
project p is
2+
end p;
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
[
2+
{
3+
"comment": [
4+
"Test whether foldingRange works fine with all loop statements (while, for, loop)"
5+
]
6+
},
7+
{
8+
"start": {
9+
"cmd": ["${ALS}"]
10+
}
11+
},
12+
{
13+
"send": {
14+
"request": {
15+
"params": {
16+
"processId": 18560,
17+
"capabilities": {
18+
"textDocument": {
19+
"foldingRange": {
20+
"lineFoldingOnly": true
21+
}
22+
}
23+
},
24+
"rootUri": "$URI{.}"
25+
},
26+
"jsonrpc": "2.0",
27+
"id": 1,
28+
"method": "initialize"
29+
},
30+
"wait": []
31+
}
32+
},
33+
{
34+
"send": {
35+
"request": {
36+
"jsonrpc": "2.0",
37+
"method": "initialized"
38+
},
39+
"wait": []
40+
}
41+
},
42+
{
43+
"send": {
44+
"request": {
45+
"params": {
46+
"settings": {
47+
"ada": {
48+
"projectFile": "$URI{p.gpr}",
49+
"scenarioVariables": {},
50+
"adaFileDiagnostics": false,
51+
"defaultCharset": "ISO-8859-1"
52+
}
53+
}
54+
},
55+
"jsonrpc": "2.0",
56+
"method": "workspace/didChangeConfiguration"
57+
},
58+
"wait": []
59+
}
60+
},
61+
{
62+
"send": {
63+
"request": {
64+
"params": {
65+
"textDocument": {
66+
"text": "procedure Main is\nbegin\n for I in 1 .. 10 loop\n while True loop\n loop\n exit when I > 5;\n -- Inner loop body\n end loop;\n end loop;\n end loop;\nend Main;\n",
67+
"version": 0,
68+
"uri": "$URI{main.adb}",
69+
"languageId": "Ada"
70+
}
71+
},
72+
"jsonrpc": "2.0",
73+
"method": "textDocument/didOpen"
74+
},
75+
"wait": []
76+
}
77+
},
78+
{
79+
"send": {
80+
"request": {
81+
"params": {
82+
"settings": {
83+
"ada": {
84+
"foldComments": false
85+
}
86+
}
87+
},
88+
"jsonrpc": "2.0",
89+
"method": "workspace/didChangeConfiguration"
90+
},
91+
"wait": []
92+
}
93+
},
94+
{
95+
"send": {
96+
"request": {
97+
"params": {
98+
"textDocument": {
99+
"uri": "$URI{main.adb}"
100+
}
101+
},
102+
"jsonrpc": "2.0",
103+
"id": 3,
104+
"method": "textDocument/foldingRange"
105+
},
106+
"wait": [
107+
{
108+
"id": 3,
109+
"jsonrpc": "2.0",
110+
"result": [
111+
{
112+
"endLine": 10,
113+
"kind": "region",
114+
"startLine": 0
115+
},
116+
{
117+
"endLine": 9,
118+
"kind": "region",
119+
"startLine": 2
120+
},
121+
{
122+
"endLine": 8,
123+
"kind": "region",
124+
"startLine": 3
125+
},
126+
{
127+
"endLine": 7,
128+
"kind": "region",
129+
"startLine": 4
130+
}
131+
]
132+
}
133+
]
134+
}
135+
},
136+
{
137+
"send": {
138+
"request": {
139+
"jsonrpc": "2.0",
140+
"id": 4,
141+
"method": "shutdown"
142+
},
143+
"wait": []
144+
}
145+
},
146+
{
147+
"stop": {
148+
"exit_code": 0
149+
}
150+
}
151+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
title: 'als.1704.folding.loops'

0 commit comments

Comments
 (0)