ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / emmet / src / test / wrapWithAbbreviation.test.ts 521 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
import 'mocha' ;
import * as assert from 'assert' ;
import { Selection, workspace, ConfigurationTarget } from 'vscode' ;
import { withRandomFileEditor, closeAllEditors } from './testUtils' ;
import { wrapWithAbbreviation } from '../abbreviationActions' ;
const htmlContentsForBlockWrapTests = `
<ul class="nav main">
<li class="item1">img</li>
<li class="item2">$hithere</li>
<li class="item3">\${hithere}</li>
</ul>
` ;
const htmlContentsForInlineWrapTests = `
<ul class="nav main">
<em class="item1">img</em>
<em class="item2">$hithere</em>
<em class="item3">\${hithere}</em>
</ul>
wrapBlockElementExpected
wrapInlineElementExpected
wrapSnippetExpected
wrapMultiLineAbbrExpected
wrapInlineElementExpectedFormatFalse
closeAllEditors
multiCursors
multiCursorsWithSelection
multiCursorsWithFullLineSelection
oldValueForSyntaxProfiles workspace
multiCursors wrapBlockElementExpected htmlContentsForBlockWrapTests
multiCursors wrapInlineElementExpected htmlContentsForInlineWrapTests
multiCursors wrapSnippetExpected htmlContentsForBlockWrapTests
multiCursors wrapMultiLineAbbrExpected htmlContentsForBlockWrapTests
multiCursorsWithSelection wrapBlockElementExpected htmlContentsForBlockWrapTests
multiCursorsWithSelection wrapInlineElementExpected htmlContentsForInlineWrapTests
multiCursorsWithSelection wrapSnippetExpected htmlContentsForBlockWrapTests
multiCursorsWithSelection wrapMultiLineAbbrExpected htmlContentsForBlockWrapTests
multiCursorsWithFullLineSelection wrapBlockElementExpected htmlContentsForBlockWrapTests
multiCursorsWithFullLineSelection wrapInlineElementExpected htmlContentsForInlineWrapTests
multiCursorsWithFullLineSelection wrapSnippetExpected htmlContentsForBlockWrapTests
multiCursorsWithFullLineSelection wrapMultiLineAbbrExpected htmlContentsForBlockWrapTests
contents
expectedContents
expectedContents contents
contents
expectedContents
expectedContents contents
contents
expectedContents
expectedContents contents
contents
expectedContents
expectedContents contents
contents
expectedContents
expectedContents contents
contents
expectedContents
expectedContents contents
contents
expectedContents
expectedContents contents
contents
expectedContents
expectedContents contents
contents
wrapIndividualLinesExpected
wrapIndividualLinesExpected contents
contents
wrapIndividualLinesExpected
wrapIndividualLinesExpected contents
contents
wrapIndividualLinesExpected
wrapIndividualLinesExpected contents
contents
wrapIndividualLinesExpected
wrapIndividualLinesExpected contents
workspace ConfigurationTarget Global
multiCursors wrapInlineElementExpectedFormatFalse htmlContentsForBlockWrapTests
workspace oldValueForSyntaxProfiles oldValueForSyntaxProfiles globalValue ConfigurationTarget Global
htmlContentsForWrapMultiLineTests
wrapMultiLineExpected
wrapMultiLineExpected htmlContentsForWrapMultiLineTests
wrapMultiLineJsxExpected
wrapMultiLineJsxExpected htmlContentsForBlockWrapTests
wrapIndividualLinesJsxExpected
wrapIndividualLinesJsxExpected htmlContentsForBlockWrapTests
contents
expectedContents
expectedContents contents
contents
contents contents
selections Selection abbreviation expectedContents input fileExtension Thenable
input fileExtension editor _
editor selections selections
promise abbreviation
promise
assert
promise
assert editor document expectedContents
selections Selection abbreviation expectedContents input fileExtension Thenable
input fileExtension editor _
editor selections selections
promise abbreviation
promise
assert
promise
assert editor document expectedContents
`
;
const
=
`
<ul class="nav main">
<div>
<li class="item1">img</li>
</div>
<div>
<li class="item2">$hithere</li>
</div>
<div>
<li class="item3">\${hithere}</li>
</div>
</ul>
`
;
const
=
`
<ul class="nav main">
<span><em class="item1">img</em></span>
<span><em class="item2">$hithere</em></span>
<span><em class="item3">\${hithere}</em></span>
</ul>
`
;
const
=
`
<ul class="nav main">
<a href="">
<li class="item1">img</li>
</a>
<a href="">
<li class="item2">$hithere</li>
</a>
<a href="">
<li class="item3">\${hithere}</li>
</a>
</ul>
`
;
const
=
`
<ul class="nav main">
<ul>
<li>
<li class="item1">img</li>
</li>
</ul>
<ul>
<li>
<li class="item2">$hithere</li>
</li>
</ul>
<ul>
<li>
<li class="item3">\${hithere}</li>
</li>
</ul>
</ul>
`
;
const
=
`
<ul class="nav main">
<h1>
<li class="item1">img</li>
</h1>
<h1>
<li class="item2">$hithere</li>
</h1>
<h1>
<li class="item3">\${hithere}</li>
</h1>
</ul>
`
;
suite
(
'Tests for Wrap with Abbreviations'
,
(
)
=>
{
teardown
(
)
;
const
=
[
new
Selection
(
2
,
6
,
2
,
6
)
,
new
Selection
(
3
,
6
,
3
,
6
)
,
new
Selection
(
4
,
6
,
4
,
6
)
]
;
const
=
[
new
Selection
(
2
,
2
,
2
,
28
)
,
new
Selection
(
3
,
2
,
3
,
33
)
,
new
Selection
(
4
,
6
,
4
,
36
)
]
;
const
=
[
new
Selection
(
2
,
0
,
2
,
28
)
,
new
Selection
(
3
,
0
,
3
,
33
)
,
new
Selection
(
4
,
0
,
4
,
36
)
]
;
const
=
.
getConfiguration
(
'emmet'
)
.
inspect
(
'syntaxProfiles'
)
;
test
(
'Wrap with block element using multi cursor'
,
(
)
=>
{
return
testWrapWithAbbreviation
(
,
'div'
,
,
)
;
}
)
;
test
(
'Wrap with inline element using multi cursor'
,
(
)
=>
{
return
testWrapWithAbbreviation
(
,
'span'
,
,
)
;
}
)
;
test
(
'Wrap with snippet using multi cursor'
,
(
)
=>
{
return
testWrapWithAbbreviation
(
,
'a'
,
,
)
;
}
)
;
test
(
'Wrap with multi line abbreviation using multi cursor'
,
(
)
=>
{
return
testWrapWithAbbreviation
(
,
'ul>li'
,
,
)
;
}
)
;
test
(
'Wrap with block element using multi cursor selection'
,
(
)
=>
{
return
testWrapWithAbbreviation
(
,
'div'
,
,
)
;
}
)
;
test
(
'Wrap with inline element using multi cursor selection'
,
(
)
=>
{
return
testWrapWithAbbreviation
(
,
'span'
,
,
)
;
}
)
;
test
(
'Wrap with snippet using multi cursor selection'
,
(
)
=>
{
return
testWrapWithAbbreviation
(
,
'a'
,
,
)
;
}
)
;
test
(
'Wrap with multi line abbreviation using multi cursor selection'
,
(
)
=>
{
return
testWrapWithAbbreviation
(
,
'ul>li'
,
,
)
;
}
)
;
test
(
'Wrap with block element using multi cursor full line selection'
,
(
)
=>
{
return
testWrapWithAbbreviation
(
,
'div'
,
,
)
;
}
)
;
test
(
'Wrap with inline element using multi cursor full line selection'
,
(
)
=>
{
return
testWrapWithAbbreviation
(
,
'span'
,
,
)
;
}
)
;
test
(
'Wrap with snippet using multi cursor full line selection'
,
(
)
=>
{
return
testWrapWithAbbreviation
(
,
'a'
,
,
)
;
}
)
;
test
(
'Wrap with multi line abbreviation using multi cursor full line selection'
,
(
)
=>
{
return
testWrapWithAbbreviation
(
,
'ul>li'
,
,
)
;
}
)
;
test
(
'Wrap with abbreviation and comment filter'
,
(
)
=>
{
const
=
`
<ul class="nav main">
line
</ul>
`
;
const
=
`
<ul class="nav main">
<li class="hello">line</li>
<!-- /.hello -->
</ul>
`
;
return
testWrapWithAbbreviation
(
[
new
Selection
(
2
,
0
,
2
,
0
)
]
,
'li.hello|c'
,
,
)
;
}
)
;
test
(
'Wrap with abbreviation link'
,
(
)
=>
{
const
=
`
<ul class="nav main">
line
</ul>
`
;
const
=
`
<a href="https://example.com">
<div>
<ul class="nav main">
line
</ul>
</div>
</a>
`
;
return
testWrapWithAbbreviation
(
[
new
Selection
(
1
,
2
,
1
,
2
)
]
,
'a[href="https://example.com"]>div'
,
,
)
;
}
)
;
test
(
'Wrap with abbreviation entire node when cursor is on opening tag'
,
(
)
=>
{
const
=
`
<div class="nav main">
hello
</div>
`
;
const
=
`
<div>
<div class="nav main">
hello
</div>
</div>
`
;
return
testWrapWithAbbreviation
(
[
new
Selection
(
1
,
2
,
1
,
2
)
]
,
'div'
,
,
)
;
}
)
;
test
(
'Wrap with abbreviation entire node when cursor is on closing tag'
,
(
)
=>
{
const
=
`
<div class="nav main">
hello
</div>
`
;
const
=
`
<div>
<div class="nav main">
hello
</div>
</div>
`
;
return
testWrapWithAbbreviation
(
[
new
Selection
(
3
,
2
,
3
,
2
)
]
,
'div'
,
,
)
;
}
)
;
test
(
'Wrap with abbreviation inner node in cdata'
,
(
)
=>
{
const
=
`
<div class="nav main">
<![CDATA[
<div>
<p>Test 1</p>
</div>
<p>Test 2</p>
]]>
hello
</div>
`
;
const
=
`
<div class="nav main">
<![CDATA[
<div>
<p>Test 1</p>
</div>
<div>
<p>Test 2</p>
</div>
]]>
hello
</div>
`
;
return
testWrapWithAbbreviation
(
[
new
Selection
(
6
,
5
,
6
,
5
)
]
,
'div'
,
,
)
;
}
)
;
test
(
'Wrap with abbreviation inner node in script in cdata'
,
(
)
=>
{
const
=
`
<div class="nav main">
<![CDATA[
<script type="text/plain">
<p>Test 1</p>
</script>
<p>Test 2</p>
]]>
hello
</div>
`
;
const
=
`
<div class="nav main">
<![CDATA[
<script type="text/plain">
<div>
<p>Test 1</p>
</div>
</script>
<p>Test 2</p>
]]>
hello
</div>
`
;
return
testWrapWithAbbreviation
(
[
new
Selection
(
4
,
10
,
4
,
10
)
]
,
'div'
,
,
)
;
}
)
;
test
(
'Wrap with abbreviation inner node in cdata one-liner'
,
(
)
=>
{
const
=
`
<div class="nav main">
<![CDATA[<p>Test here</p>]]>
hello
</div>
`
;
const
=
`
<div class="nav main">
<div><![CDATA[<p>Test here</p>]]></div>
hello
</div>
`
;
return
testWrapWithAbbreviation
(
[
new
Selection
(
2
,
15
,
2
,
15
)
]
,
'div'
,
,
)
;
}
)
;
test
(
'Wrap with multiline abbreviation doesnt add extra spaces'
,
(
)
=>
{
const
=
`
hello
`
;
const
=
`
<ul>
<li><a href="">hello</a></li>
</ul>
`
;
return
testWrapWithAbbreviation
(
[
new
Selection
(
1
,
2
,
1
,
2
)
]
,
'ul>li>a'
,
,
)
;
}
)
;
test
(
'Wrap individual lines with abbreviation'
,
(
)
=>
{
const
=
`
<ul class="nav main">
<li class="item1">This $10 is not a tabstop</li>
<li class="item2">hi.there</li>
</ul>
`
;
const
=
`
<ul class="nav main">
<ul>
<li class="hello1">
<li class="item1">This $10 is not a tabstop</li>
</li>
<li class="hello2">
<li class="item2">hi.there</li>
</li>
</ul>
</ul>
`
;
return
testWrapIndividualLinesWithAbbreviation
(
[
new
Selection
(
2
,
2
,
3
,
33
)
]
,
'ul>li.hello$*'
,
,
)
;
}
)
;
test
(
'Wrap individual lines with abbreviation with extra space selected'
,
(
)
=>
{
const
=
`
<ul class="nav main">
<li class="item1">img</li>
<li class="item2">hi.there</li>
</ul>
`
;
const
=
`
<ul class="nav main">
<ul>
<li class="hello1">
<li class="item1">img</li>
</li>
<li class="hello2">
<li class="item2">hi.there</li>
</li>
</ul>
</ul>
`
;
return
testWrapIndividualLinesWithAbbreviation
(
[
new
Selection
(
2
,
1
,
4
,
0
)
]
,
'ul>li.hello$*'
,
,
)
;
}
)
;
test
(
'Wrap individual lines with abbreviation with comment filter'
,
(
)
=>
{
const
=
`
<ul class="nav main">
<li class="item1">img</li>
<li class="item2">hi.there</li>
</ul>
`
;
const
=
`
<ul class="nav main">
<ul>
<li class="hello">
<li class="item1">img</li>
</li>
<!-- /.hello -->
<li class="hello">
<li class="item2">hi.there</li>
</li>
<!-- /.hello -->
</ul>
</ul>
`
;
return
testWrapIndividualLinesWithAbbreviation
(
[
new
Selection
(
2
,
2
,
3
,
33
)
]
,
'ul>li.hello*|c'
,
,
)
;
}
)
;
test
(
'Wrap individual lines with abbreviation and trim'
,
(
)
=>
{
const
=
`
<ul class="nav main">
• lorem ipsum
• lorem ipsum
</ul>
`
;
const
=
`
<ul class="nav main">
<ul>
<li class="hello1">lorem ipsum</li>
<li class="hello2">lorem ipsum</li>
</ul>
</ul>
`
;
return
testWrapIndividualLinesWithAbbreviation
(
[
new
Selection
(
2
,
3
,
3
,
16
)
]
,
'ul>li.hello$*|t'
,
,
)
;
}
)
;
test
(
'Wrap with abbreviation and format set to false'
,
(
)
=>
{
return
.
getConfiguration
(
'emmet'
)
.
update
(
'syntaxProfiles'
,
{
'html'
:
{
'format'
:
false
}
}
,
.
)
.
then
(
(
)
=>
{
return
testWrapWithAbbreviation
(
,
'h1'
,
,
)
.
then
(
(
)
=>
{
return
.
getConfiguration
(
'emmet'
)
.
update
(
'syntaxProfiles'
,
?
.
:
undefined
,
.
)
;
}
)
;
}
)
;
}
)
;
test
(
'Wrap multi line selections with abbreviation'
,
(
)
=>
{
const
=
`
<ul class="nav main">
line1
line2
line3
line4
</ul>
`
;
const
=
`
<ul class="nav main">
<div>
line1
line2
</div>
<div>
line3
line4
</div>
</ul>
`
;
return
testWrapWithAbbreviation
(
[
new
Selection
(
2
,
4
,
3
,
9
)
,
new
Selection
(
5
,
4
,
6
,
9
)
]
,
'div'
,
,
)
;
}
)
;
test
(
'Wrap multiline with abbreviation uses className for jsx files'
,
(
)
=>
{
const
=
`
<ul class="nav main">
<div className="hello">
<li class="item1">img</li>
<li class="item2">$hithere</li>
<li class="item3">\${hithere}</li>
</div>
</ul>
`
;
return
testWrapWithAbbreviation
(
[
new
Selection
(
2
,
2
,
4
,
36
)
]
,
'.hello'
,
,
,
'jsx'
)
;
}
)
;
test
(
'Wrap individual line with abbreviation uses className for jsx files'
,
(
)
=>
{
const
=
`
<ul class="nav main">
<div className="hello1">
<li class="item1">img</li>
</div>
<div className="hello2">
<li class="item2">$hithere</li>
</div>
<div className="hello3">
<li class="item3">\${hithere}</li>
</div>
</ul>
`
;
return
testWrapIndividualLinesWithAbbreviation
(
[
new
Selection
(
2
,
2
,
4
,
36
)
]
,
'.hello$*'
,
,
,
'jsx'
)
;
}
)
;
test
(
'Wrap with abbreviation merge overlapping computed ranges'
,
(
)
=>
{
const
=
`
<div class="nav main">
hello
</div>
`
;
const
=
`
<div>
<div class="nav main">
hello
</div>
</div>
`
;
return
testWrapWithAbbreviation
(
[
new
Selection
(
1
,
2
,
1
,
2
)
,
new
Selection
(
1
,
10
,
1
,
10
)
]
,
'div'
,
,
)
;
}
)
;
test
(
'Wrap with abbreviation ignore invalid abbreviation'
,
(
)
=>
{
const
=
`
<div class="nav main">
hello
</div>
`
;
return
testWrapWithAbbreviation
(
[
new
Selection
(
1
,
2
,
1
,
2
)
]
,
'div]'
,
,
)
;
}
)
;
}
)
;
function
testWrapWithAbbreviation
(
:
[
]
,
:
string
,
:
string
,
:
string
,
:
string
=
'html'
)
:
<
any
>
{
return
withRandomFileEditor
(
,
,
(
,
)
=>
{
.
=
;
const
=
wrapWithAbbreviation
(
{
}
)
;
if
(
!
)
{
.
strictEqual
(
1
,
2
,
'Wrap with Abbreviation returned undefined.'
)
;
return
Promise
.
resolve
(
)
;
}
return
.
then
(
(
)
=>
{
.
strictEqual
(
.
.
getText
(
)
,
)
;
return
Promise
.
resolve
(
)
;
}
)
;
}
)
;
}
function
testWrapIndividualLinesWithAbbreviation
(
:
[
]
,
:
string
,
:
string
,
:
string
,
:
string
=
'html'
)
:
<
any
>
{
return
withRandomFileEditor
(
,
,
(
,
)
=>
{
.
=
;
const
=
wrapWithAbbreviation
(
{
}
)
;
if
(
!
)
{
.
strictEqual
(
1
,
2
,
'Wrap individual lines with Abbreviation returned undefined.'
)
;
return
Promise
.
resolve
(
)
;
}
return
.
then
(
(
)
=>
{
.
strictEqual
(
.
.
getText
(
)
,
)
;
return
Promise
.
resolve
(
)
;
}
)
;
}
)
;
}