Skip to content

Commit 80ca8c1

Browse files
author
mergerepo
committed
Merge remote branch 'origin/master' into edge
(no-precommit-check no-tn-check)
2 parents 62fd4df + fda1058 commit 80ca8c1

File tree

6 files changed

+212
-6
lines changed

6 files changed

+212
-6
lines changed

scripts/traces_to_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525

2626
test = traces_to_test(inout_file, root)
2727

28+
print("create test directory {}".format(root))
29+
os.makedirs(root, exist_ok=True)
30+
2831
test_yaml_file = os.path.join(root, 'test.yaml')
2932
print("generating {}".format(test_yaml_file))
3033
with open(test_yaml_file, "w") as f:

source/ada/lsp-ada_documents.adb

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2607,18 +2607,26 @@ package body LSP.Ada_Documents is
26072607
Start_Line : constant LSP.Types.Line_Number :=
26082608
LSP.Types.Line_Number (Segment.Start_Line) - 1;
26092609
Start_Line_Text : constant VSS.Strings.Virtual_String :=
2610-
Self.Text.Slice
2611-
(Self.Line_To_Marker (Start_Line),
2612-
Self.Line_To_Marker (Start_Line + 1));
2610+
(if Self.Line_To_Marker.Last_Index = Start_Line then
2611+
Self.Text.Slice
2612+
(Self.Line_To_Marker (Start_Line), Self.Text.After_Last_Character)
2613+
else
2614+
Self.Text.Slice
2615+
(Self.Line_To_Marker (Start_Line),
2616+
Self.Line_To_Marker (Start_Line + 1)));
26132617
Start_Iterator : VSS.Strings.Character_Iterators.Character_Iterator :=
26142618
Start_Line_Text.At_First_Character;
26152619

26162620
End_Line : constant LSP.Types.Line_Number :=
26172621
LSP.Types.Line_Number (Segment.End_Line) - 1;
26182622
End_Line_Text : constant VSS.Strings.Virtual_String :=
2619-
Self.Text.Slice
2620-
(Self.Line_To_Marker (End_Line),
2621-
Self.Line_To_Marker (End_Line + 1));
2623+
(if Self.Line_To_Marker.Last_Index = End_Line then
2624+
Self.Text.Slice
2625+
(Self.Line_To_Marker (End_Line), Self.Text.After_Last_Character)
2626+
else
2627+
Self.Text.Slice
2628+
(Self.Line_To_Marker (End_Line),
2629+
Self.Line_To_Marker (End_Line + 1)));
26222630
End_Iterator : VSS.Strings.Character_Iterators.Character_Iterator :=
26232631
End_Line_Text.At_First_Character;
26242632
Success : Boolean with Unreferenced;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
project Default is
2+
for Main use ("main.adb");
3+
end Default;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
procedure Main is
2+
3+
begin
4+
declare
5+
A : Integer;
6+
begin
7+
null;
8+
end;
9+
10+
end Main;
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
[
2+
{
3+
"comment": [
4+
"test automatically generated"
5+
]
6+
},
7+
{
8+
"start": {
9+
"cmd": [
10+
"${ALS}"
11+
]
12+
}
13+
},
14+
{
15+
"send": {
16+
"request": {
17+
"jsonrpc": "2.0",
18+
"id": 0,
19+
"method": "initialize",
20+
"params": {
21+
"processId": 84339,
22+
"locale": "en-gb",
23+
"rootPath": "$URI{.}",
24+
"rootUri": "$URI{.}",
25+
"capabilities": {
26+
"workspace": {
27+
"applyEdit": true,
28+
"workspaceEdit": {
29+
"documentChanges": true,
30+
"resourceOperations": [
31+
"create",
32+
"rename",
33+
"delete"
34+
]
35+
},
36+
"executeCommand": {
37+
"dynamicRegistration": true
38+
}
39+
},
40+
"textDocument": {
41+
"codeAction": {
42+
"dynamicRegistration": true,
43+
"codeActionLiteralSupport": {
44+
"codeActionKind": {
45+
"valueSet": [
46+
"<HAS>",
47+
"refactor",
48+
"refactor.extract",
49+
"refactor.inline",
50+
"refactor.rewrite"
51+
]
52+
}
53+
}
54+
}
55+
}
56+
}
57+
}
58+
},
59+
"wait": [
60+
{
61+
"jsonrpc": "2.0",
62+
"id": 0
63+
}
64+
]
65+
}
66+
},
67+
{
68+
"send": {
69+
"request": {
70+
"jsonrpc": "2.0",
71+
"method": "initialized",
72+
"params": {}
73+
},
74+
"wait": []
75+
}
76+
},
77+
{
78+
"send": {
79+
"request": {
80+
"jsonrpc": "2.0",
81+
"method": "workspace/didChangeConfiguration",
82+
"params": {
83+
"settings": {
84+
"ada": {
85+
"trace": {
86+
"server": "verbose"
87+
},
88+
"projectFile": "default.gpr",
89+
"scenarioVariables": {},
90+
"defaultCharset": "iso-8859-1",
91+
"displayMethodAncestryOnNavigation": "usage_and_abstract_only",
92+
"enableDiagnostics": true,
93+
"useCompletionSnippets": true,
94+
"renameInComments": true
95+
}
96+
}
97+
}
98+
},
99+
"wait": [
100+
{
101+
"jsonrpc": "2.0",
102+
"id": 2,
103+
"method": "window/workDoneProgress/create",
104+
"params": {
105+
"token": "<ANY>"
106+
}
107+
}
108+
]
109+
}
110+
},
111+
{
112+
"send": {
113+
"request": {
114+
"jsonrpc": "2.0",
115+
"method": "textDocument/didOpen",
116+
"params": {
117+
"textDocument": {
118+
"uri": "$URI{main.adb}",
119+
"languageId": "ada",
120+
"version": 1,
121+
"text": "procedure Main is\n\nbegin\n declare\n A : Integer;\n begin\n null;\n end;\n\nend Main;"
122+
}
123+
}
124+
},
125+
"wait": []
126+
}
127+
},
128+
{
129+
"send": {
130+
"request": {
131+
"jsonrpc": "2.0",
132+
"id": 12,
133+
"method": "textDocument/rangeFormatting",
134+
"params": {
135+
"textDocument": {
136+
"uri": "$URI{main.adb}"
137+
},
138+
"range": {
139+
"start": {
140+
"line": 0,
141+
"character": 12
142+
},
143+
"end": {
144+
"line": 9,
145+
"character": 6
146+
}
147+
},
148+
"options": {
149+
"tabSize": 3,
150+
"insertSpaces": true
151+
}
152+
}
153+
},
154+
"wait": [
155+
{
156+
"id": 12,
157+
"result": [
158+
{
159+
"range": {
160+
"start": {
161+
"line": 0,
162+
"character": 0
163+
},
164+
"end": {
165+
"line": 9,
166+
"character": 9
167+
}
168+
},
169+
"newText": "procedure Main is\n\nbegin\n declare\n A : Integer;\n begin\n null;\n end;\n\nend Main;"
170+
}
171+
]
172+
}
173+
]
174+
}
175+
},
176+
{
177+
"stop": {
178+
"exit_code": 0
179+
}
180+
}
181+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
title: 'UB30-006_range_format_whole_document'

0 commit comments

Comments
 (0)