@@ -2,6 +2,7 @@ defmodule ElixirLS.LanguageServer.Providers.FormattingTest do
2
2
use ElixirLS.Utils.MixTest.Case , async: false
3
3
import ElixirLS.LanguageServer.Test.PlatformTestHelpers
4
4
alias ElixirLS.LanguageServer.Providers.Formatting
5
+ alias ElixirLS.LanguageServer.Protocol.TextEdit
5
6
alias ElixirLS.LanguageServer.SourceFile
6
7
alias ElixirLS.LanguageServer.Test.FixtureHelpers
7
8
@@ -32,25 +33,25 @@ defmodule ElixirLS.LanguageServer.Providers.FormattingTest do
32
33
assert { :ok , changes } = Formatting . format ( source_file , uri , project_dir )
33
34
34
35
assert changes == [
35
- % {
36
- " newText" => ")" ,
37
- " range" => % {
36
+ % TextEdit {
37
+ newText: ")" ,
38
+ range: % {
38
39
"end" => % { "character" => 23 , "line" => 4 } ,
39
40
"start" => % { "character" => 23 , "line" => 4 }
40
41
}
41
42
} ,
42
- % {
43
- " newText" => "(" ,
44
- " range" => % {
43
+ % TextEdit {
44
+ newText: "(" ,
45
+ range: % {
45
46
"end" => % { "character" => 16 , "line" => 4 } ,
46
47
"start" => % { "character" => 15 , "line" => 4 }
47
48
}
48
49
}
49
50
]
50
51
51
52
assert Enum . all? ( changes , fn change ->
52
- assert_position_type ( change [ " range" ] [ "end" ] ) and
53
- assert_position_type ( change [ " range" ] [ "start" ] )
53
+ assert_position_type ( change . range [ "end" ] ) and
54
+ assert_position_type ( change . range [ "start" ] )
54
55
end )
55
56
end )
56
57
end
@@ -82,25 +83,25 @@ defmodule ElixirLS.LanguageServer.Providers.FormattingTest do
82
83
assert { :ok , changes } = Formatting . format ( source_file , uri , project_dir )
83
84
84
85
assert changes == [
85
- % {
86
- " newText" => ")" ,
87
- " range" => % {
86
+ % TextEdit {
87
+ newText: ")" ,
88
+ range: % {
88
89
"end" => % { "character" => 23 , "line" => 4 } ,
89
90
"start" => % { "character" => 23 , "line" => 4 }
90
91
}
91
92
} ,
92
- % {
93
- " newText" => "(" ,
94
- " range" => % {
93
+ % TextEdit {
94
+ newText: "(" ,
95
+ range: % {
95
96
"end" => % { "character" => 16 , "line" => 4 } ,
96
97
"start" => % { "character" => 15 , "line" => 4 }
97
98
}
98
99
}
99
100
]
100
101
101
102
assert Enum . all? ( changes , fn change ->
102
- assert_position_type ( change [ " range" ] [ "end" ] ) and
103
- assert_position_type ( change [ " range" ] [ "start" ] )
103
+ assert_position_type ( change . range [ "end" ] ) and
104
+ assert_position_type ( change . range [ "start" ] )
104
105
end )
105
106
end )
106
107
end
@@ -132,25 +133,25 @@ defmodule ElixirLS.LanguageServer.Providers.FormattingTest do
132
133
assert { :ok , changes } = Formatting . format ( source_file , uri , project_dir )
133
134
134
135
assert changes == [
135
- % {
136
- " newText" => ")" ,
137
- " range" => % {
136
+ % TextEdit {
137
+ newText: ")" ,
138
+ range: % {
138
139
"end" => % { "character" => 23 , "line" => 4 } ,
139
140
"start" => % { "character" => 23 , "line" => 4 }
140
141
}
141
142
} ,
142
- % {
143
- " newText" => "(" ,
144
- " range" => % {
143
+ % TextEdit {
144
+ newText: "(" ,
145
+ range: % {
145
146
"end" => % { "character" => 16 , "line" => 4 } ,
146
147
"start" => % { "character" => 15 , "line" => 4 }
147
148
}
148
149
}
149
150
]
150
151
151
152
assert Enum . all? ( changes , fn change ->
152
- assert_position_type ( change [ " range" ] [ "end" ] ) and
153
- assert_position_type ( change [ " range" ] [ "start" ] )
153
+ assert_position_type ( change . range [ "end" ] ) and
154
+ assert_position_type ( change . range [ "start" ] )
154
155
end )
155
156
end )
156
157
end
@@ -184,60 +185,60 @@ defmodule ElixirLS.LanguageServer.Providers.FormattingTest do
184
185
assert { :ok , changes } = Formatting . format ( source_file , uri , project_dir )
185
186
186
187
assert changes == [
187
- % {
188
- " newText" => "\n " ,
189
- " range" => % {
188
+ % TextEdit {
189
+ newText: "\n " ,
190
+ range: % {
190
191
"end" => % { "character" => 0 , "line" => 7 } ,
191
192
"start" => % { "character" => 3 , "line" => 6 }
192
193
}
193
194
} ,
194
- % {
195
- " newText" => "\n " ,
196
- " range" => % {
195
+ % TextEdit {
196
+ newText: "\n " ,
197
+ range: % {
197
198
"end" => % { "character" => 0 , "line" => 6 } ,
198
199
"start" => % { "character" => 5 , "line" => 5 }
199
200
}
200
201
} ,
201
- % {
202
- " newText" => ")\n " ,
203
- " range" => % {
202
+ % TextEdit {
203
+ newText: ")\n " ,
204
+ range: % {
204
205
"end" => % { "character" => 0 , "line" => 5 } ,
205
206
"start" => % { "character" => 23 , "line" => 4 }
206
207
}
207
208
} ,
208
- % {
209
- " newText" => "(" ,
210
- " range" => % {
209
+ % TextEdit {
210
+ newText: "(" ,
211
+ range: % {
211
212
"end" => % { "character" => 16 , "line" => 4 } ,
212
213
"start" => % { "character" => 15 , "line" => 4 }
213
214
}
214
215
} ,
215
- % {
216
- " newText" => "\n " ,
217
- " range" => % {
216
+ % TextEdit {
217
+ newText: "\n " ,
218
+ range: % {
218
219
"end" => % { "character" => 0 , "line" => 4 } ,
219
220
"start" => % { "character" => 25 , "line" => 3 }
220
221
}
221
222
} ,
222
- % {
223
- " newText" => "\n \n " ,
224
- " range" => % {
223
+ % TextEdit {
224
+ newText: "\n \n " ,
225
+ range: % {
225
226
"end" => % { "character" => 0 , "line" => 3 } ,
226
227
"start" => % { "character" => 16 , "line" => 1 }
227
228
}
228
229
} ,
229
- % {
230
- " newText" => "\n " ,
231
- " range" => % {
230
+ % TextEdit {
231
+ newText: "\n " ,
232
+ range: % {
232
233
"end" => % { "character" => 0 , "line" => 1 } ,
233
234
"start" => % { "character" => 21 , "line" => 0 }
234
235
}
235
236
}
236
237
]
237
238
238
239
assert Enum . all? ( changes , fn change ->
239
- assert_position_type ( change [ " range" ] [ "end" ] ) and
240
- assert_position_type ( change [ " range" ] [ "start" ] )
240
+ assert_position_type ( change . range [ "end" ] ) and
241
+ assert_position_type ( change . range [ "start" ] )
241
242
end )
242
243
end )
243
244
end
@@ -302,25 +303,25 @@ defmodule ElixirLS.LanguageServer.Providers.FormattingTest do
302
303
assert { :ok , changes } = Formatting . format ( source_file , uri , project_dir )
303
304
304
305
assert changes == [
305
- % {
306
- " newText" => ")" ,
307
- " range" => % {
306
+ % TextEdit {
307
+ newText: ")" ,
308
+ range: % {
308
309
"end" => % { "character" => 2 , "line" => 7 } ,
309
310
"start" => % { "character" => 2 , "line" => 7 }
310
311
}
311
312
} ,
312
- % {
313
- " newText" => "(" ,
314
- " range" => % {
313
+ % TextEdit {
314
+ newText: "(" ,
315
+ range: % {
315
316
"end" => % { "character" => 20 , "line" => 4 } ,
316
317
"start" => % { "character" => 15 , "line" => 4 }
317
318
}
318
319
}
319
320
]
320
321
321
322
assert Enum . all? ( changes , fn change ->
322
- assert_position_type ( change [ " range" ] [ "end" ] ) and
323
- assert_position_type ( change [ " range" ] [ "start" ] )
323
+ assert_position_type ( change . range [ "end" ] ) and
324
+ assert_position_type ( change . range [ "start" ] )
324
325
end )
325
326
end )
326
327
end
@@ -378,16 +379,16 @@ defmodule ElixirLS.LanguageServer.Providers.FormattingTest do
378
379
assert { :ok , changes } = Formatting . format ( source_file , uri , project_dir )
379
380
380
381
assert changes == [
381
- % {
382
- " newText" => ")" ,
383
- " range" => % {
382
+ % TextEdit {
383
+ newText: ")" ,
384
+ range: % {
384
385
"end" => % { "character" => 12 , "line" => 0 } ,
385
386
"start" => % { "character" => 12 , "line" => 0 }
386
387
}
387
388
} ,
388
- % {
389
- " newText" => "(" ,
390
- " range" => % {
389
+ % TextEdit {
390
+ newText: "(" ,
391
+ range: % {
391
392
"end" => % { "character" => 8 , "line" => 0 } ,
392
393
"start" => % { "character" => 7 , "line" => 0 }
393
394
}
@@ -417,16 +418,16 @@ defmodule ElixirLS.LanguageServer.Providers.FormattingTest do
417
418
assert { :ok , changes } = Formatting . format ( source_file , uri , project_dir )
418
419
419
420
assert changes == [
420
- % {
421
- " newText" => ")" ,
422
- " range" => % {
421
+ % TextEdit {
422
+ newText: ")" ,
423
+ range: % {
423
424
"end" => % { "character" => 16 , "line" => 0 } ,
424
425
"start" => % { "character" => 16 , "line" => 0 }
425
426
}
426
427
} ,
427
- % {
428
- " newText" => "(" ,
429
- " range" => % {
428
+ % TextEdit {
429
+ newText: "(" ,
430
+ range: % {
430
431
"end" => % { "character" => 8 , "line" => 0 } ,
431
432
"start" => % { "character" => 7 , "line" => 0 }
432
433
}
@@ -456,16 +457,16 @@ defmodule ElixirLS.LanguageServer.Providers.FormattingTest do
456
457
assert { :ok , changes } = Formatting . format ( source_file , uri , project_dir )
457
458
458
459
assert changes == [
459
- % {
460
- " newText" => ")" ,
461
- " range" => % {
460
+ % TextEdit {
461
+ newText: ")" ,
462
+ range: % {
462
463
"end" => % { "character" => 213 , "line" => 0 } ,
463
464
"start" => % { "character" => 213 , "line" => 0 }
464
465
}
465
466
} ,
466
- % {
467
- " newText" => "(" ,
468
- " range" => % {
467
+ % TextEdit {
468
+ newText: "(" ,
469
+ range: % {
469
470
"end" => % { "character" => 8 , "line" => 0 } ,
470
471
"start" => % { "character" => 7 , "line" => 0 }
471
472
}
0 commit comments