ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / copilot / src / extension / tools / node / test / editNotebookTool.spec.tsx 755 строк · изменён 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
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
import { afterAll, describe, expect, test } from 'vitest' ;
import type { ChatResponseStream , LanguageModelToolInvocationOptions , NotebookDocument } from 'vscode' ;
import { IEndpointProvider } from '../../../../platform/endpoint/common/endpointProvider' ;
import { IFileSystemService } from '../../../../platform/filesystem/common/fileSystemService' ;
import { ILogService } from '../../../../platform/log/common/logService' ;
disposables
disposables
notebook
accessor disposables
workspaceService disposables notebook
editTool
accessor
workspaceService
accessor
accessor
accessor
accessor
accessor
editTool workspaceService
count notebookEdits
resolve
notebookEdits count
check
notebook editTool editsToPerform notebookEdits
options input editsToPerform toolInvocationToken
stream
target edits
edits
edits edits edits edits
edits
notebookEdits edits
notebook edits
target edits
edits
edits edits edits edits
edits
edit edits
notebookEdits target edit
editTool options stream
editTool options
notebook editTool editsToPerform notebookEdits
edit editsToPerform
notebook editTool edit notebookEdits
cells
notebook cells
notebook
notebookEdits
notebook
editTool workspaceService notebook
promise notebook editTool
filePath notebook editType newCode language cellId
notebookEdits
notebookEdits
workspaceService
cellChanges
contentChanges
addedCells
index
removedCells
range
metadata
notebook notebook
promise
notebookEdits
notebookEdits
edit notebookEdits
edit
edit
edit
edit
edit
notebookEdits
notebook
editTool workspaceService notebook
cellCount notebook
cellEdits
editType newCode language filePath notebook explanation cellId
editType newCode language filePath notebook explanation cellId
editType newCode language filePath notebook explanation cellId
i i cellEdits i
promise notebook editTool cellEdits i notebookEdits
i notebookEdits
workspaceService
cellChanges
contentChanges
addedCells
index cellCount i
removedCells
range
metadata
notebook notebook
promise
notebookEdits
notebookEdits
edit notebookEdits
edit cellCount
edit cellCount
edit
edit
edit
notebookEdits
edit notebookEdits
edit cellCount
edit cellCount
edit
edit
edit
notebookEdits
edit notebookEdits
edit cellCount
edit cellCount
edit
edit
edit
notebookEdits
notebook
editTool workspaceService notebook
cellCount notebook
cellEdits
editType newCode language filePath notebook explanation cellId
editType newCode language filePath notebook explanation cellId
editType newCode language filePath notebook explanation cellId
i i cellEdits i
promise notebook editTool cellEdits i notebookEdits
i notebookEdits
workspaceService
cellChanges
contentChanges
addedCells
index cellCount i
removedCells
range
metadata
notebook notebook
promise
notebookEdits
notebookEdits
edit notebookEdits
edit cellCount
edit cellCount
edit
edit
edit
notebookEdits
edit notebookEdits
edit cellCount
edit cellCount
edit
edit
edit
notebookEdits
edit notebookEdits
edit cellCount
edit cellCount
edit
edit
edit
notebookEdits
notebook
editTool workspaceService notebook
cellCount notebook
cellEdits
editType newCode language filePath notebook explanation cellId notebook cellCount
i i cellEdits i
promise notebook editTool cellEdits i notebookEdits
i notebookEdits
workspaceService
cellChanges
contentChanges
addedCells
index cellCount i
removedCells
range
metadata
notebook notebook
promise
notebookEdits
notebookEdits
edit notebookEdits
edit cellCount
edit cellCount
edit
edit
edit
notebookEdits
notebook
editTool workspaceService notebook
cellCount notebook
cellEdits
editType newCode language filePath notebook explanation cellId
editType newCode language filePath notebook explanation cellId
editType newCode language filePath notebook explanation cellId
i i cellEdits i
cellEdits i notebook cellCount i
promise notebook editTool cellEdits i notebookEdits
i notebookEdits
workspaceService
cellChanges
contentChanges
addedCells
index cellCount i
removedCells
range
metadata
notebook notebook
promise
notebookEdits
notebookEdits
edit notebookEdits
edit cellCount
edit cellCount
edit
edit
edit
notebookEdits
edit notebookEdits
edit cellCount
edit cellCount
edit
edit
edit
notebookEdits
edit notebookEdits
edit cellCount
edit cellCount
edit
edit
edit
notebookEdits
notebook
editTool workspaceService notebook
promise notebook editTool
filePath notebook editType newCode language cellId notebook
notebookEdits
notebookEdits
workspaceService
cellChanges
contentChanges
addedCells
index
removedCells
range
metadata
notebook notebook
promise
notebookEdits
notebookEdits
edit notebookEdits
edit
edit
edit
notebookEdits
notebook
editTool workspaceService notebook
cellEdits
editType newCode language filePath notebook explanation cellId
editType newCode language filePath notebook explanation cellId
editType newCode language filePath notebook explanation cellId
i i cellEdits i
cellEdits i notebook i
promise notebook editTool cellEdits i notebookEdits
i notebookEdits
workspaceService
cellChanges
contentChanges
addedCells
index i
removedCells
range
metadata
notebook notebook
promise
notebookEdits
notebookEdits
edit notebookEdits
edit
edit
edit
edit
edit
notebookEdits
edit notebookEdits
edit
edit
edit
edit
edit
notebookEdits
edit notebookEdits
edit
edit
edit
edit
edit
notebookEdits
notebook
editTool workspaceService notebook
cellEdits
editType newCode language filePath notebook explanation cellId
editType newCode language filePath notebook explanation cellId
editType newCode language filePath notebook explanation cellId
i i cellEdits i
cellEdits i notebook i
promise notebook editTool cellEdits i notebookEdits
i notebookEdits
workspaceService
cellChanges
contentChanges
addedCells
index i
removedCells
range
metadata
notebook notebook
promise
notebookEdits
notebookEdits
edit notebookEdits
edit
edit
edit
edit
edit
notebookEdits
edit notebookEdits
edit
edit
edit
edit
edit
notebookEdits
edit notebookEdits
edit
edit
edit
edit
edit
notebookEdits
notebook
editTool workspaceService notebook
count notebook
cellEdits
editType newCode language filePath notebook explanation cellId
editType newCode language filePath notebook explanation cellId
editType newCode language filePath notebook explanation cellId
i i cellEdits i
cellEdits i notebook notebook
promise notebook editTool cellEdits i notebookEdits
i notebookEdits
workspaceService
cellChanges
contentChanges
addedCells
index count i
removedCells
range
metadata
notebook notebook
promise
notebookEdits
notebookEdits
edit notebookEdits
edit count
edit count
edit
edit
notebookEdits
edit notebookEdits
edit count
edit count
edit
edit
notebookEdits
edit notebookEdits
edit count
edit count
edit
edit
notebookEdits
notebook
editTool workspaceService notebook
promise notebook editTool
filePath notebook editType newCode language cellId notebook
notebookEdits
notebookEdits
workspaceService
cellChanges
contentChanges
addedCells
index
removedCells
range
metadata
notebook notebook
promise
notebookEdits
notebookEdits
edit notebookEdits
edit
edit
edit
notebookEdits
notebook
editTool workspaceService notebook
cellEdits
editType newCode language filePath notebook explanation cellId
editType newCode language filePath notebook explanation cellId
editType newCode language filePath notebook explanation cellId
i i cellEdits i
cellEdits i notebook i
cellEdits i notebook i
promise notebook editTool cellEdits i notebookEdits
i notebookEdits
workspaceService
cellChanges
contentChanges
addedCells
index i
removedCells
range
metadata
notebook notebook
promise
notebookEdits
notebookEdits
edit notebookEdits
edit
edit
edit
edit
notebookEdits
edit notebookEdits
edit
edit
edit
edit
notebookEdits
edit notebookEdits
edit
edit
edit
edit
notebookEdits
notebook
editTool workspaceService notebook
removedCells
notebook
notebook
notebook
notebook
cellEdits
editType filePath notebook explanation cellId notebook
editType filePath notebook explanation cellId notebook
editType filePath notebook explanation cellId notebook
editType filePath notebook explanation cellId notebook
i i cellEdits i
promise notebook editTool cellEdits i notebookEdits
i notebookEdits
workspaceService
cellChanges
contentChanges
addedCells
removedCells
removedCells i
range
metadata
notebook notebook
promise
notebookEdits
notebookEdits
edit notebookEdits
edit
edit
edit
notebookEdits
edit notebookEdits
edit
edit
edit
notebookEdits
edit notebookEdits
edit
edit
edit
notebookEdits
edit notebookEdits
edit
edit
edit
notebookEdits
notebook
editTool workspaceService notebook
cell2 notebook
promise notebook editTool
filePath notebook editType cellId cell2 newCode
notebookEdits
notebookEdits
workspaceService
cell2
contentChanges
range
rangeLength
rangeOffset
text
reason
detailedReason
workspaceService
cellChanges
cell cell2
cell2
metadata
outputs
executionSummary
contentChanges
addedCells
removedCells
range
metadata
notebook notebook
promise
notebookEdits
edit notebookEdits
edit cell2
edit
import
{ IAlternativeNotebookContentService }
from
'../../../../platform/notebook/common/alternativeContent'
;
import
{ getCellId }
from
'../../../../platform/notebook/common/helpers'
;
import
{ PromptPathRepresentationService }
from
'../../../../platform/prompts/common/promptPathRepresentationService'
;
import
{ ITelemetryService }
from
'../../../../platform/telemetry/common/telemetry'
;
import
{ TestWorkspaceService }
from
'../../../../platform/test/node/testWorkspaceService'
;
import
{ ExtHostNotebookDocumentData }
from
'../../../../util/common/test/shims/notebookDocument'
;
import
{ CancellationToken }
from
'../../../../util/vs/base/common/cancellation'
;
import
{ DisposableStore }
from
'../../../../util/vs/base/common/lifecycle'
;
import
{
URI
}
from
'../../../../util/vs/base/common/uri'
;
import
{ IInstantiationService }
from
'../../../../util/vs/platform/instantiation/common/instantiation'
;
import
{ NotebookCellData , NotebookCellKind , NotebookData , NotebookEdit , NotebookRange , Range , TextEdit , Uri }
from
'../../../../vscodeTypes'
;
import
{ createExtensionUnitTestingServices }
from
'../../../test/node/services'
;
import
{ EditNotebookTool , IEditNotebookToolParams }
from
'../editNotebookTool'
;
describe
(
'Edit Notebook Tool'
,
(
)
=>
{
const
=
new
DisposableStore
(
)
;
afterAll
(
(
)
=>
{
.
clear
(
)
;
}
)
;
function
initialize
(
:
NotebookDocument
)
{
const
=
.
add
(
createExtensionUnitTestingServices
(
)
)
.
createTestingAccessor
(
)
;
const
=
.
add
(
new
TestWorkspaceService
(
[
]
,
[
]
,
[
]
)
)
;
const
=
new
EditNotebookTool
(
new
PromptPathRepresentationService
(
new
TestWorkspaceService
(
)
)
,
.
get
(
IInstantiationService
)
,
,
.
get
(
IAlternativeNotebookContentService
)
,
.
get
(
ILogService
)
,
.
get
(
ITelemetryService
)
,
.
get
(
IEndpointProvider
)
,
.
get
(
IFileSystemService
)
,
)
;
return
[
,
]
as
const
;
}
async
function
waitForEditCount
(
:
number
,
:
(
NotebookEdit
|
[
Uri
,
TextEdit
]
)
[
]
)
{
await
new
Promise < void >
(
(
)
=>
{
const
check
=
(
)
=>
{
if
(
.
length
>=
)
{
resolve
(
)
;
}
else
{
setTimeout
(
,
100
)
;
}
}
;
check
(
)
;
}
)
;
}
async
function
invokeOneTool
(
:
ExtHostNotebookDocumentData
,
:
EditNotebookTool
,
:
IEditNotebookToolParams
,
:
(
NotebookEdit
|
[
Uri
,
TextEdit
]
)
[
]
)
{
const
:
LanguageModelToolInvocationOptions
<
IEditNotebookToolParams
>
=
{
:
,
:
undefined
}
;
const
:
Partial
<
ChatResponseStream
>
=
{
notebookEdit
(
:
Uri
,
:
NotebookEdit
|
NotebookEdit
[
]
|
true
)
{
if
(
===
true
)
{
return
;
}
=
Array
.
isArray
(
)
?
:
[
]
;
if
(
.
length
===
0
)
{
return
;
}
.
push
(
...
)
;
ExtHostNotebookDocumentData
.
applyEdits
(
,
)
;
}
,
textEdit
(
:
Uri
,
:
TextEdit
|
TextEdit
[
]
|
true
)
{
if
(
===
true
)
{
return
;
}
=
Array
.
isArray
(
)
?
:
[
]
;
if
(
.
length
===
0
)
{
return
;
}
for
(
const
of
)
{
.
push
(
[
,
]
)
;
}
}
}
;
await
.
resolveInput
(
.
input
,
{
}
as
any
)
;
return
.
invoke
(
,
CancellationToken
.
None
)
;
}
async
function
invokeTool
(
:
ExtHostNotebookDocumentData
,
:
EditNotebookTool
,
:
IEditNotebookToolParams
[
]
,
:
(
NotebookEdit
|
[
Uri
,
TextEdit
]
)
[
]
)
{
for
(
const
of
)
{
await
invokeOneTool
(
,
,
,
)
;
}
}
function
createNotebook
(
)
{
const
=
[
new
NotebookCellData
(
NotebookCellKind
.
Markup
,
'# This is a sample notebook'
,
'markdown'
)
,
new
NotebookCellData
(
NotebookCellKind
.
Code
,
'# Imports\nimport sys\nimport os\nimport pandas as pd'
,
'python'
)
,
new
NotebookCellData
(
NotebookCellKind
.
Code
,
''
,
'python'
)
,
new
NotebookCellData
(
NotebookCellKind
.
Code
,
''
,
'python'
)
,
new
NotebookCellData
(
NotebookCellKind
.
Code
,
''
,
'python'
)
,
new
NotebookCellData
(
NotebookCellKind
.
Code
,
'print("Hello World")'
,
'python'
)
,
new
NotebookCellData
(
NotebookCellKind
.
Code
,
''
,
'python'
)
,
new
NotebookCellData
(
NotebookCellKind
.
Code
,
` data = {'Name': ['Tom', 'nick', 'krish', 'jack'],'Age': [20, 21, 19, 18]}\ndf = pd.DataFrame(data)\nprint(df) `
,
'python'
)
,
]
;
const
=
ExtHostNotebookDocumentData
.
fromNotebookData
(
URI
.
file
(
'notebook.ipynb'
)
,
new
NotebookData
(
)
,
'jupyter-notebook'
)
;
return
;
}
test
(
` Insert a cell at the top `
,
async
(
)
=>
{
const
:
(
NotebookEdit
|
[
Uri
,
TextEdit
]
)
[
]
=
[
]
;
const
=
createNotebook
(
)
;
const
[
,
]
=
initialize
(
.
document
)
;
const
=
invokeTool
(
,
,
[
{
:
.
uri
.
toString
(
)
,
:
'insert'
,
:
'print(1)'
,
:
'python'
,
:
'top'
}
]
,
)
;
await
waitForEditCount
(
1
,
)
;
.
didChangeNotebookDocumentEmitter
.
fire
(
{
:
[
]
,
:
[
{
:
[
{
:
0
}
as
any
,
]
,
:
[
]
,
:
new
NotebookRange
(
0
,
0
)
,
}
]
,
:
undefined
,
:
.
document
,
}
)
;
await
;
expect
(
.
length
)
.
to
.
equal
(
1
)
;
expect
(
[
0
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
const
=
[
0
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
0
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
0
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
` print(1) `
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Code
)
;
}
)
;
test
(
` Insert 3 cells at the bottom `
,
async
(
)
=>
{
const
:
(
NotebookEdit
|
[
Uri
,
TextEdit
]
)
[
]
=
[
]
;
const
=
createNotebook
(
)
;
const
[
,
]
=
initialize
(
.
document
)
;
const
=
.
document
.
cellCount
;
const
=
[
{
:
'insert'
as
const
,
:
'# header'
,
:
'markdown'
,
:
.
uri
.
toString
(
)
,
:
'Insert markdown header cell at the bottom'
,
:
'bottom'
}
,
{
:
'insert'
as
const
,
:
'print(1)'
,
:
'python'
,
:
.
uri
.
toString
(
)
,
:
'Insert first Python code cell at the bottom'
,
:
'bottom'
}
,
{
:
'insert'
as
const
,
:
'print(2)'
,
:
'python'
,
:
.
uri
.
toString
(
)
,
:
'Insert second Python code cell at the bottom'
,
:
'bottom'
}
]
;
for
(
let
=
0
;
<
.
length
;
++
)
{
const
=
invokeTool
(
,
,
[
[
]
]
,
)
;
await
waitForEditCount
(
+
1
,
)
;
.
didChangeNotebookDocumentEmitter
.
fire
(
{
:
[
]
,
:
[
{
:
[
{
:
+
}
as
any
,
]
,
:
[
]
,
:
new
NotebookRange
(
0
,
0
)
,
}
]
,
:
undefined
,
:
.
document
,
}
)
;
await
;
}
expect
(
.
length
)
.
to
.
equal
(
3
)
;
expect
(
[
0
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
let
=
[
0
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'# header'
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Markup
)
;
expect
(
[
1
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
1
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
+
1
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
+
1
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'print(1)'
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Code
)
;
expect
(
[
2
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
2
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
+
2
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
+
2
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'print(2)'
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Code
)
;
}
)
;
test
(
` Insert 3 cells at the bottom (BOTTOM id) `
,
async
(
)
=>
{
const
:
(
NotebookEdit
|
[
Uri
,
TextEdit
]
)
[
]
=
[
]
;
const
=
createNotebook
(
)
;
const
[
,
]
=
initialize
(
.
document
)
;
const
=
.
document
.
cellCount
;
const
=
[
{
:
'insert'
as
const
,
:
'# header'
,
:
'markdown'
,
:
.
uri
.
toString
(
)
,
:
''
,
:
'BOTTOM'
}
,
{
:
'insert'
as
const
,
:
'print(1)'
,
:
'python'
,
:
.
uri
.
toString
(
)
,
:
''
,
:
'BOTTOM'
}
,
{
:
'insert'
as
const
,
:
'print(2)'
,
:
'python'
,
:
.
uri
.
toString
(
)
,
:
''
,
:
'BOTTOM'
}
,
]
;
for
(
let
=
0
;
<
.
length
;
++
)
{
const
=
invokeTool
(
,
,
[
[
]
]
,
)
;
await
waitForEditCount
(
+
1
,
)
;
.
didChangeNotebookDocumentEmitter
.
fire
(
{
:
[
]
,
:
[
{
:
[
{
:
+
}
as
any
,
]
,
:
[
]
,
:
new
NotebookRange
(
0
,
0
)
,
}
]
,
:
undefined
,
:
.
document
,
}
)
;
await
;
}
expect
(
.
length
)
.
to
.
equal
(
3
)
;
expect
(
[
0
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
let
=
[
0
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'# header'
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Markup
)
;
expect
(
[
1
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
1
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
+
1
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
+
1
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'print(1)'
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Code
)
;
expect
(
[
2
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
2
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
+
2
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
+
2
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'print(2)'
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Code
)
;
}
)
;
test
(
` Insert 1 cells at the bottom (with cell id for first insertion) `
,
async
(
)
=>
{
const
:
(
NotebookEdit
|
[
Uri
,
TextEdit
]
)
[
]
=
[
]
;
const
=
createNotebook
(
)
;
const
[
,
]
=
initialize
(
.
document
)
;
const
=
.
document
.
cellCount
;
const
=
[
{
:
'insert'
as
const
,
:
'# header'
,
:
'markdown'
,
:
.
uri
.
toString
(
)
,
:
''
,
:
getCellId
(
.
document
.
cellAt
(
-
1
)
)
}
,
]
;
for
(
let
=
0
;
<
.
length
;
++
)
{
const
=
invokeTool
(
,
,
[
[
]
]
,
)
;
await
waitForEditCount
(
+
1
,
)
;
.
didChangeNotebookDocumentEmitter
.
fire
(
{
:
[
]
,
:
[
{
:
[
{
:
+
}
as
any
,
]
,
:
[
]
,
:
new
NotebookRange
(
0
,
0
)
,
}
]
,
:
undefined
,
:
.
document
,
}
)
;
await
;
}
expect
(
.
length
)
.
to
.
equal
(
1
)
;
expect
(
[
0
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
const
=
[
0
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'# header'
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Markup
)
;
}
)
;
test
(
` Insert 3 cells at the bottom (with cell id for all insertions) `
,
async
(
)
=>
{
const
:
(
NotebookEdit
|
[
Uri
,
TextEdit
]
)
[
]
=
[
]
;
const
=
createNotebook
(
)
;
const
[
,
]
=
initialize
(
.
document
)
;
const
=
.
document
.
cellCount
;
const
=
[
{
:
'insert'
as
const
,
:
'# header'
,
:
'markdown'
,
:
.
uri
.
toString
(
)
,
:
''
,
:
''
}
,
{
:
'insert'
as
const
,
:
'print(1)'
,
:
'python'
,
:
.
uri
.
toString
(
)
,
:
''
,
:
''
}
,
{
:
'insert'
as
const
,
:
'print(2)'
,
:
'python'
,
:
.
uri
.
toString
(
)
,
:
''
,
:
''
}
]
;
for
(
let
=
0
;
<
.
length
;
++
)
{
[
]
.
cellId
=
getCellId
(
.
document
.
cellAt
(
-
1
+
)
)
;
const
=
invokeTool
(
,
,
[
[
]
]
,
)
;
await
waitForEditCount
(
+
1
,
)
;
.
didChangeNotebookDocumentEmitter
.
fire
(
{
:
[
]
,
:
[
{
:
[
{
:
+
}
as
any
,
]
,
:
[
]
,
:
new
NotebookRange
(
0
,
0
)
,
}
]
,
:
undefined
,
:
.
document
,
}
)
;
await
;
}
expect
(
.
length
)
.
to
.
equal
(
3
)
;
expect
(
[
0
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
let
=
[
0
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'# header'
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Markup
)
;
expect
(
[
1
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
1
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
+
1
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
+
1
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'print(1)'
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Code
)
;
expect
(
[
2
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
2
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
+
2
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
+
2
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'print(2)'
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Code
)
;
}
)
;
test
(
` Insert a cell after the first cell `
,
async
(
)
=>
{
const
:
(
NotebookEdit
|
[
Uri
,
TextEdit
]
)
[
]
=
[
]
;
const
=
createNotebook
(
)
;
const
[
,
]
=
initialize
(
.
document
)
;
const
=
invokeTool
(
,
,
[
{
:
.
uri
.
toString
(
)
,
:
'insert'
,
:
'print(1234)'
,
:
'python'
,
:
getCellId
(
.
document
.
cellAt
(
0
)
)
}
]
,
)
;
await
waitForEditCount
(
1
,
)
;
.
didChangeNotebookDocumentEmitter
.
fire
(
{
:
[
]
,
:
[
{
:
[
{
:
1
}
as
any
,
]
,
:
[
]
,
:
new
NotebookRange
(
0
,
0
)
,
}
]
,
:
undefined
,
:
.
document
,
}
)
;
await
;
expect
(
.
length
)
.
to
.
equal
(
1
)
;
expect
(
[
0
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
const
=
[
0
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
1
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
}
)
;
test
(
` Insert 3 cells after the first cell `
,
async
(
)
=>
{
const
:
(
NotebookEdit
|
[
Uri
,
TextEdit
]
)
[
]
=
[
]
;
const
=
createNotebook
(
)
;
const
[
,
]
=
initialize
(
.
document
)
;
const
=
[
{
:
'insert'
as
const
,
:
'# header'
,
:
'markdown'
,
:
.
uri
.
toString
(
)
,
:
''
,
:
''
}
,
{
:
'insert'
as
const
,
:
'print(1)'
,
:
'python'
,
:
.
uri
.
toString
(
)
,
:
''
,
:
''
}
,
{
:
'insert'
as
const
,
:
'print(2)'
,
:
'python'
,
:
.
uri
.
toString
(
)
,
:
''
,
:
''
}
]
;
for
(
let
=
0
;
<
.
length
;
++
)
{
[
]
.
cellId
=
getCellId
(
.
document
.
cellAt
(
)
)
;
const
=
invokeTool
(
,
,
[
[
]
]
,
)
;
await
waitForEditCount
(
+
1
,
)
;
.
didChangeNotebookDocumentEmitter
.
fire
(
{
:
[
]
,
:
[
{
:
[
{
:
+
1
}
as
any
,
]
,
:
[
]
,
:
new
NotebookRange
(
0
,
0
)
,
}
]
,
:
undefined
,
:
.
document
,
}
)
;
await
;
}
expect
(
.
length
)
.
to
.
equal
(
3
)
;
expect
(
[
0
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
let
=
[
0
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
1
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'# header'
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Markup
)
;
expect
(
[
1
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
1
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
2
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
2
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'print(1)'
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Code
)
;
expect
(
[
2
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
2
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
3
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
3
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'print(2)'
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Code
)
;
}
)
;
test
(
` Insert 3 cells after the third cell `
,
async
(
)
=>
{
const
:
(
NotebookEdit
|
[
Uri
,
TextEdit
]
)
[
]
=
[
]
;
const
=
createNotebook
(
)
;
const
[
,
]
=
initialize
(
.
document
)
;
const
=
[
{
:
'insert'
as
const
,
:
'# header'
,
:
'markdown'
,
:
.
uri
.
toString
(
)
,
:
''
,
:
''
}
,
{
:
'insert'
as
const
,
:
'print(1)'
,
:
'python'
,
:
.
uri
.
toString
(
)
,
:
''
,
:
''
}
,
{
:
'insert'
as
const
,
:
'print(2)'
,
:
'python'
,
:
.
uri
.
toString
(
)
,
:
''
,
:
''
}
]
;
for
(
let
=
0
;
<
.
length
;
++
)
{
[
]
.
cellId
=
getCellId
(
.
document
.
cellAt
(
2
+
)
)
;
const
=
invokeTool
(
,
,
[
[
]
]
,
)
;
await
waitForEditCount
(
+
1
,
)
;
.
didChangeNotebookDocumentEmitter
.
fire
(
{
:
[
]
,
:
[
{
:
[
{
:
3
+
}
as
any
,
]
,
:
[
]
,
:
new
NotebookRange
(
0
,
0
)
,
}
]
,
:
undefined
,
:
.
document
,
}
)
;
await
;
}
expect
(
.
length
)
.
to
.
equal
(
3
)
;
expect
(
[
0
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
let
=
[
0
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
3
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
3
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'# header'
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Markup
)
;
expect
(
[
1
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
1
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
4
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
4
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'print(1)'
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Code
)
;
expect
(
[
2
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
2
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
5
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
5
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'print(2)'
)
;
expect
(
.
newCells
[
0
]
.
kind
)
.
to
.
equal
(
NotebookCellKind
.
Code
)
;
}
)
;
test
(
` Insert 3 cells after the last cell `
,
async
(
)
=>
{
const
:
(
NotebookEdit
|
[
Uri
,
TextEdit
]
)
[
]
=
[
]
;
const
=
createNotebook
(
)
;
const
[
,
]
=
initialize
(
.
document
)
;
const
=
.
document
.
cellCount
;
const
=
[
{
:
'insert'
as
const
,
:
'# header'
,
:
'markdown'
,
:
.
uri
.
toString
(
)
,
:
''
,
:
''
}
,
{
:
'insert'
as
const
,
:
'print(1)'
,
:
'python'
,
:
.
uri
.
toString
(
)
,
:
''
,
:
''
}
,
{
:
'insert'
as
const
,
:
'print(2)'
,
:
'python'
,
:
.
uri
.
toString
(
)
,
:
''
,
:
''
}
]
;
for
(
let
=
0
;
<
.
length
;
++
)
{
[
]
.
cellId
=
getCellId
(
.
document
.
cellAt
(
.
document
.
cellCount
-
1
)
)
;
const
=
invokeTool
(
,
,
[
[
]
]
,
)
;
await
waitForEditCount
(
+
1
,
)
;
.
didChangeNotebookDocumentEmitter
.
fire
(
{
:
[
]
,
:
[
{
:
[
{
:
+
}
as
any
,
]
,
:
[
]
,
:
new
NotebookRange
(
0
,
0
)
}
]
,
:
undefined
,
:
.
document
,
}
)
;
await
;
}
expect
(
.
length
)
.
to
.
equal
(
3
)
;
expect
(
[
0
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
let
=
[
0
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'# header'
)
;
expect
(
[
1
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
1
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
+
1
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
+
1
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'print(1)'
)
;
expect
(
[
2
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
2
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
+
2
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
+
2
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
'print(2)'
)
;
}
)
;
test
(
` Insert a cell after the first cell (use notebook cell Uri) `
,
async
(
)
=>
{
const
:
(
NotebookEdit
|
[
Uri
,
TextEdit
]
)
[
]
=
[
]
;
const
=
createNotebook
(
)
;
const
[
,
]
=
initialize
(
.
document
)
;
const
=
invokeTool
(
,
,
[
{
:
.
document
.
cellAt
(
0
)
.
document
.
uri
.
toString
(
)
,
:
'insert'
,
:
'print(1234)'
,
:
'python'
,
:
getCellId
(
.
document
.
cellAt
(
0
)
)
}
]
,
)
;
await
waitForEditCount
(
1
,
)
;
.
didChangeNotebookDocumentEmitter
.
fire
(
{
:
[
]
,
:
[
{
:
[
{
:
1
}
as
any
,
]
,
:
[
]
,
:
new
NotebookRange
(
0
,
0
)
,
}
]
,
:
undefined
,
:
.
document
,
}
)
;
await
;
expect
(
.
length
)
.
to
.
equal
(
1
)
;
expect
(
[
0
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
const
=
[
0
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
1
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
}
)
;
test
(
` Insert 3 cells after the first cell (use notebook cell Uri) `
,
async
(
)
=>
{
const
:
(
NotebookEdit
|
[
Uri
,
TextEdit
]
)
[
]
=
[
]
;
const
=
createNotebook
(
)
;
const
[
,
]
=
initialize
(
.
document
)
;
const
=
[
{
:
'insert'
as
const
,
:
'print(1)'
,
:
'python'
,
:
.
document
.
cellAt
(
0
)
.
document
.
uri
.
toString
(
)
,
:
''
,
:
''
}
,
{
:
'insert'
as
const
,
:
'print(2)'
,
:
'python'
,
:
.
document
.
cellAt
(
0
)
.
document
.
uri
.
toString
(
)
,
:
''
,
:
''
}
,
{
:
'insert'
as
const
,
:
'print(3)'
,
:
'python'
,
:
.
document
.
cellAt
(
0
)
.
document
.
uri
.
toString
(
)
,
:
''
,
:
''
}
,
]
;
for
(
let
=
0
;
<
.
length
;
++
)
{
[
]
.
cellId
=
getCellId
(
.
document
.
cellAt
(
)
)
;
[
]
.
filePath
=
.
document
.
cellAt
(
)
.
document
.
uri
.
toString
(
)
;
const
=
invokeTool
(
,
,
[
[
]
]
,
)
;
await
waitForEditCount
(
+
1
,
)
;
.
didChangeNotebookDocumentEmitter
.
fire
(
{
:
[
]
,
:
[
{
:
[
{
:
+
1
}
as
any
,
]
,
:
[
]
,
:
new
NotebookRange
(
0
,
0
)
,
}
]
,
:
undefined
,
:
.
document
,
}
)
;
await
;
}
expect
(
.
length
)
.
to
.
equal
(
3
)
;
expect
(
[
0
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
let
=
[
0
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
1
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
` print(1) `
)
;
expect
(
[
1
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
1
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
2
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
2
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
` print(2) `
)
;
expect
(
[
2
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
2
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
3
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
3
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
1
)
;
expect
(
.
newCells
[
0
]
.
value
)
.
to
.
equal
(
` print(3) `
)
;
}
)
;
test
(
` Delete 4 cells `
,
async
(
)
=>
{
const
:
(
NotebookEdit
|
[
Uri
,
TextEdit
]
)
[
]
=
[
]
;
const
=
createNotebook
(
)
;
const
[
,
]
=
initialize
(
.
document
)
;
const
=
[
.
document
.
cellAt
(
2
)
,
.
document
.
cellAt
(
3
)
,
.
document
.
cellAt
(
4
)
,
.
document
.
cellAt
(
6
)
,
]
;
const
=
[
{
:
'delete'
as
const
,
:
.
uri
.
toString
(
)
,
:
''
,
:
getCellId
(
.
document
.
cellAt
(
2
)
)
}
,
{
:
'delete'
as
const
,
:
.
uri
.
toString
(
)
,
:
''
,
:
getCellId
(
.
document
.
cellAt
(
3
)
)
}
,
{
:
'delete'
as
const
,
:
.
uri
.
toString
(
)
,
:
''
,
:
getCellId
(
.
document
.
cellAt
(
4
)
)
}
,
{
:
'delete'
as
const
,
:
.
uri
.
toString
(
)
,
:
''
,
:
getCellId
(
.
document
.
cellAt
(
6
)
)
}
,
]
;
for
(
let
=
0
;
<
.
length
;
++
)
{
const
=
invokeTool
(
,
,
[
[
]
]
,
)
;
await
waitForEditCount
(
+
1
,
)
;
.
didChangeNotebookDocumentEmitter
.
fire
(
{
:
[
]
,
:
[
{
:
[
]
,
:
[
[
]
,
]
,
:
new
NotebookRange
(
0
,
0
)
,
}
]
,
:
undefined
,
:
.
document
,
}
)
;
await
;
}
expect
(
.
length
)
.
to
.
equal
(
4
)
;
expect
(
[
0
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
let
=
[
0
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
2
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
3
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
0
)
;
expect
(
[
1
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
1
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
2
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
3
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
0
)
;
expect
(
[
2
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
2
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
2
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
3
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
0
)
;
expect
(
[
3
]
)
.
to
.
be
.
instanceOf
(
NotebookEdit
)
;
=
[
3
]
as
NotebookEdit
;
expect
(
.
range
.
start
)
.
to
.
equal
(
3
)
;
expect
(
.
range
.
end
)
.
to
.
equal
(
4
)
;
expect
(
.
newCells
.
length
)
.
to
.
equal
(
0
)
;
}
)
;
test
(
` Update empty cell `
,
async
(
)
=>
{
const
:
(
NotebookEdit
|
[
Uri
,
TextEdit
]
)
[
]
=
[
]
;
const
=
createNotebook
(
)
;
const
[
,
]
=
initialize
(
.
document
)
;
const
=
.
document
.
cellAt
(
2
)
;
const
=
invokeTool
(
,
,
[
{
:
.
uri
.
toString
(
)
,
:
'edit'
,
:
getCellId
(
)
,
:
'print("Foo Bar")'
}
]
,
)
;
await
waitForEditCount
(
1
,
)
;
.
didChangeTextDocumentEmitter
.
fire
(
{
document
:
.
document
,
:
[
{
:
new
Range
(
0
,
0
,
0
,
0
)
,
:
0
,
:
0
,
:
'print("Foo Bar")'
,
}
]
,
:
undefined
,
:
undefined
,
}
)
;
.
didChangeNotebookDocumentEmitter
.
fire
(
{
:
[
{
:
,
document
:
.
document
,
:
undefined
,
:
[
]
,
:
undefined
,
}
]
,
:
[
{
:
[
]
,
:
[
]
,
:
new
NotebookRange
(
0
,
0
)
,
}
]
,
:
undefined
,
:
.
document
,
}
)
;
await
;
expect
(
.
length
)
.
to
.
equal
(
1
)
;
const
=
[
0
]
as
[
Uri
,
TextEdit
]
;
expect
(
[
0
]
.
toString
(
)
)
.
to
.
equal
(
.
document
.
uri
.
toString
(
)
)
;
expect
(
[
1
]
.
newText
)
.
to
.
include
(
'print("Foo Bar")'
)
;
}
)
;
}
)
;