ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / copilot / test / simulation / workbench / components / testRun.tsx 574 строк · изменён 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
import { MessageBar , MessageBarBody , MessageBarTitle , Text } from '@fluentui/react-components' ;
import { ChevronUp20Regular } from '@fluentui/react-icons' ;
import * as mobxlite from 'mobx-react-lite' ;
import * as React from 'react' ;
import { getTextPart } from '../../../../src/platform/chat/common/globalStringUtils' ;
import { IDiagnostic ,
test
run
baseline
displayOptions
mobxlite
test run baseline displayOptions closeTestRunView
run
files
selections
state
files
selections
state
state
files state state
state
selections state state
state
file state
files file file
changedFile state
files changedFile state
selections changedFile state
files changedFile changedFile
files selections
idx
request
title
baselineRequest
expand
_nextRequestIndex
_expand
_run
_baseline
stopIndex
stopIndex stopIndex
result
stopIndex
request
baselineRequest requests
isIntentDetection request request m m
result
request
isIntentDetection
baselineRequest
isIntentDetection
result
run
baseline
expand
mobxlite
test run baseline displayOptions
run run run
files
requestRenderer displayOptions run baseline
result
run
run
run
run
run run workspacePath
files files run
result
stepNumber
state run
state
result
requests requestRenderer state
result
files files state
run run
result
run
result
baseline nextEditSuggestion
result
run
result
run
result
result
run run baseline baseline baseline
outputRenderData run baseline displayOptions
result
result
mobxlite
test files state requests expectedDiff test files state requests expectedDiff
state expectedDiff
mobxlite
requests requests
chatRequestIndex
toolCallIndex
requestViews
i i requests i
request requests i
index
request
index toolCallIndex
toolCallIndex
index chatRequestIndex
chatRequestIndex
requestViews
requestViews
files
state
test
mobxlite
files state test
result
changedFileIndex changedFileIndex state changedFileIndex
changedFile state changedFileIndex
prevFile files changedFile
prevFile prevFile state
prevFile
fileDiagnostics state changedFile test changedFileIndex
result
result
testRun index
index testRun testRun
toDiagnostics errors
errors error
message error
range start line error character error end line error character error
before testRun after testRun
changedFile
prevFile
fileDiagnostics
languageId
selections
before
after
range
mobxlite
changedFile prevFile fileDiagnostics languageId selections range
prevFile
changedFile
changedFile
fileDiagnostics
fileDiagnostics fileDiagnostics
mobxlite
state state
state
state
mobxlite
userEditsHistory userEditsHistory
edits currentDocumentIndex userEditsHistory
edits edit idx
currentDocumentIndex idx edit
mobxlite
logContext logContext
mobxlite
runKind proposedNextEdit
runKind
proposedNextEdit
runKind
text text
text
detectedIntent actualIntent detectedIntent actualIntent
detectedIntent actualIntent
mobxlite error error
errorTitle
firstNewlineIdx error
firstNewlineIdx
errorTitle error firstNewlineIdx
errorTitle error
str
str
expectedDiff
mobxlite
expectedDiff
expectedDiff details
details
diff original modified path
lines diff
result original modified path
current original modified path
line lines
line
path line
current original modified path
result current
line
line
current
current line
line
current
current line
current
current line
current line
result
IDiagnosticComparison
,
IRange
,
ISerializedFileEdit
,
ISerializedNesUserEditsHistory
,
InterceptedRequest
}
from
'../../shared/sharedTypes'
;
import
{
EvaluationError
}
from
'../stores/amlResults'
;
import
{ ISimulationTest }
from
'../stores/simulationTestsProvider'
;
import
{ IResolvedFile , InitialWorkspaceState , InteractionWorkspaceState , WorkspaceState }
from
'../stores/simulationWorkspaceState'
;
import
{ TestRun }
from
'../stores/testRun'
;
import
{ isToolCall }
from
'../utils/utils'
;
import
{ DisplayOptions }
from
'./app'
;
import
{ DiffEditor }
from
'./diffEditor'
;
import
{ Editor }
from
'./editor'
;
import
{ ErrorComparison }
from
'./errorComparison'
;
import
{ OutputView }
from
'./output'
;
import
{ RequestView }
from
'./request'
;
import
{ TestCaseSummary }
from
'./testCaseSummary'
;
type
TestRunViewProps
=
{
readonly
:
ISimulationTest
;
readonly
:
TestRun
;
readonly
:
TestRun
|
undefined
;
readonly
:
DisplayOptions
;
readonly
closeTestRunView
:
(
)
=>
void
;
}
;
export
const
TestRunView
=
.
observer
(
(
{
,
,
,
,
}
:
TestRunViewProps
)
=>
{
return
(
< div className = ' testRun' >
< div className = ' foldingBar' onClick = { closeTestRunView} >
<ChevronUp20Regular />
</ div>
< div className = ' content' >
< TestRunVisualization test = { test} run = { run} baseline = { baseline} displayOptions = { displayOptions} />
{
.
error
!==
undefined
&&
< ErrorMessageBar error = { run. error } />
}
</ div>
</ div>
)
;
}
)
;
class
WorkspaceFileState
{
constructor
(
public
readonly
=
new
Map< string , string >
(
)
,
public
readonly
=
new
Map< string , IRange>
(
)
,
)
{
}
public
update
(
:
WorkspaceState
)
:
WorkspaceFileState
{
const
=
new
Map< string , string >
(
this
.
files
)
;
const
=
new
Map< string , IRange>
(
this
.
selections
)
;
if
(
.
kind
===
'initial'
)
{
if
(
.
file
.
value
)
{
.
set
(
.
file
.
value
.
workspacePath
,
.
file
.
value
.
contents
)
;
if
(
.
selection
)
{
.
set
(
.
file
.
value
.
workspacePath
,
.
selection
)
;
}
}
if
(
.
otherFiles
.
value
)
{
for
(
const
of
.
otherFiles
.
value
)
{
.
set
(
.
workspacePath
,
.
contents
)
;
}
}
}
else
{
for
(
const
of
.
changedFiles
.
value
)
{
if
(
.
has
(
.
workspacePath
)
&&
.
selection
)
{
.
set
(
.
workspacePath
,
.
selection
)
;
}
.
set
(
.
workspacePath
,
.
contents
)
;
}
}
return
new
WorkspaceFileState
(
,
)
;
}
}
class
RequestRenderData
{
constructor
(
public
readonly
:
number
,
public
readonly
:
InterceptedRequest
,
public
readonly
:
string
|
undefined
,
public
readonly
:
InterceptedRequest
|
undefined
,
public
readonly
:
boolean
)
{
}
}
class
RequestRenderer
{
private
:
number
=
0
;
constructor
(
private
readonly
:
boolean
,
private
readonly
:
TestRun
,
private
readonly
:
TestRun
|
undefined
)
{
}
public
take
(
:
number
=
this
.
_run
.
requests
.
value
.
length
)
:
RequestRenderData
[
]
{
=
Math
.
min
(
,
this
.
_run
.
requests
.
value
.
length
)
;
const
:
RequestRenderData
[
]
=
[
]
;
while
(
this
.
_nextRequestIndex
<
)
{
const
=
this
.
_run
.
requests
.
value
[
this
.
_nextRequestIndex
]
;
const
=
this
.
_baseline
?.
.
value
[
this
.
_nextRequestIndex
]
;
const
=
Array
.
isArray
(
.
requestMessages
)
&&
.
requestMessages
.
some
(
=>
getTextPart
(
.
content
)
.
includes
(
'Function Id: doc'
)
)
;
.
push
(
new
RequestRenderData
(
this
.
_nextRequestIndex
,
,
?
'Intent Detection'
:
undefined
,
,
this
.
_expand
&&
!
)
)
;
this
.
_nextRequestIndex
++
;
}
return
;
}
}
class
OutputRenderData
{
constructor
(
public
readonly
:
TestRun
,
public
readonly
:
TestRun
|
undefined
,
public
readonly
:
boolean
)
{
}
}
const
TestRunVisualization
=
.
observer
(
(
{
,
,
,
}
:
Omit
<
TestRunViewProps
,
'closeTestRunView'
>
)
=>
{
if
(
!
.
requests
.
resolved
||
!
.
inlineChatWorkspaceStates
.
resolved
||
!
.
nextEditSuggestion
.
resolved
)
{
return
< >
PENDING
</ >
;
}
let
=
new
WorkspaceFileState
(
)
;
const
=
new
RequestRenderer
(
.
expandPrompts
.
value
,
,
)
;
const
:
React
.
ReactElement
[
]
=
[
]
;
if
(
.
inlineChatWorkspaceStates
.
value
.
length
===
2
&&
.
inlineChatWorkspaceStates
.
value
[
0
]
.
kind
===
'initial'
&&
.
inlineChatWorkspaceStates
.
value
[
1
]
.
kind
===
'interaction'
&&
.
inlineChatWorkspaceStates
.
value
[
1
]
.
changedFiles
.
value
.
length
===
1
&&
.
inlineChatWorkspaceStates
.
value
[
1
]
.
changedFiles
.
value
[
0
]
.
workspacePath
===
.
inlineChatWorkspaceStates
.
value
[
0
]
.
file
.
value
?.
)
{
=
.
update
(
.
inlineChatWorkspaceStates
.
value
[
0
]
)
;
.
push
(
< InteractionState key = { ` single-state-step ` } test = { test} files = { files} state = { run. inlineChatWorkspaceStates . value [ 1 ] } requests = { [ ] } expectedDiff = { run. expectedDiff } />
)
;
}
else
{
let
=
1
;
for
(
const
of
.
inlineChatWorkspaceStates
.
value
)
{
if
(
.
kind
===
'initial'
)
{
.
push
(
< InitialState key = ' initial-state' state = { state} />
)
;
}
else
{
const
=
.
take
(
.
requestCount
)
;
.
push
(
< InteractionState key = { ` state-step- ${ stepNumber++ } ` } test = { test} files = { files} state = { state} requests = { requests} expectedDiff = { run. expectedDiff } />
)
;
}
=
.
update
(
)
;
}
}
if
(
.
generatedTestCaseCount
!==
undefined
&&
.
generatedTestCaseCount
!==
null
)
{
.
push
(
< TestCaseSummary currentRun = { run} baselineRun = { baseline} />
)
;
}
if
(
.
nesUserEditsHistory
.
value
)
{
.
push
(
< NesUserEditHistory key = ' nes-user-edit-history' userEditsHistory = { run. nesUserEditsHistory . value } />
)
;
}
if
(
?.
.
value
)
{
.
push
(
< details>
<summary>Next edit (reference run)
</ summary>
< NextEditSuggestion key = ' reference-run-next-edit-suggestion'
runKind = { 'reference' }
proposedNextEdit = { baseline. nextEditSuggestion . value } />
</ details>
)
;
}
if
(
.
nextEditSuggestion
.
value
)
{
.
push
(
< NextEditSuggestion key = ' next-edit-suggestion'
runKind = { 'current' }
proposedNextEdit = { run. nextEditSuggestion . value } />
)
;
}
if
(
.
nesLogContext
.
value
)
{
.
push
(
< NesLogContext logContext = { run. nesLogContext . value } />
)
;
}
.
push
(
< Requests key = ' leftover-requests' requests = { requestRenderer. take ( ) } />
)
;
if
(
.
stdout
||
.
stderr
||
(
&&
(
.
stdout
||
.
stderr
)
)
)
{
const
=
new
OutputRenderData
(
,
,
.
expandPrompts
.
value
)
;
.
push
(
< OutputView
run = { outputRenderData. run }
baseline = { outputRenderData. baseline }
expand = { outputRenderData. expand }
/>
)
;
}
return
< div>
{
}
</ div>
;
}
)
;
const
InteractionState
=
.
observer
(
(
{
,
,
,
,
}
:
{
:
ISimulationTest
;
:
WorkspaceFileState
;
:
InteractionWorkspaceState
;
:
RequestRenderData
[
]
;
?
:
string
}
)
=>
{
return
(
< div>
< UserQuery key = { ` step-query ` } text = { state. interaction . query } />
{
!
.
interaction
.
query
.
startsWith
(
'/'
)
&&
< ChosenIntent key = { ` step-intent ` } detectedIntent = { state. interaction . detectedIntent } actualIntent = { state. interaction . actualIntent } />
}
< Requests key = { 'step-requests' } requests = { requests} />
< ChangedFiles key = { ` step-changed ` } files = { files} state = { state} test = { test} />
{
&&
< ExpectedDiff expectedDiff = { expectedDiff} />
}
< ErrorComparison key = { ` step-error-comparison ` } test = { test} />
</ div>
)
;
}
)
;
const
Requests
=
.
observer
(
(
{
}
:
{
:
RequestRenderData
[
]
}
)
=>
{
let
=
0
;
let
=
0
;
const
=
[
]
;
for
(
let
=
0
;
<
.
length
;
++
)
{
const
=
[
]
;
let
;
if
(
isToolCall
(
.
request
)
)
{
=
;
+=
1
;
}
else
{
=
;
+=
1
;
}
.
push
(
< RequestView
key = { ` request- ${ i} ` }
idx = { index}
request = { request. request }
title = { request. title }
baselineRequest = { request. baselineRequest }
expand = { request. expand }
/>
)
;
}
return
(
< div>
{
}
</ div>
)
;
}
)
;
type
ChangedFilesProps
=
{
readonly
:
WorkspaceFileState
;
readonly
:
InteractionWorkspaceState
;
readonly
:
ISimulationTest
;
}
;
const
ChangedFiles
=
.
observer
(
(
{
,
,
}
:
ChangedFilesProps
)
=>
{
const
:
React
.
ReactElement
[
]
=
[
]
;
for
(
let
=
0
;
<
.
changedFiles
.
value
.
length
;
++
)
{
const
=
.
changedFiles
.
value
[
]
;
let
=
.
files
.
get
(
.
workspacePath
)
;
if
(
&&
.
split
(
'\n'
)
.
length
===
1
&&
.
interaction
.
detectedIntent
===
'tests'
)
{
=
undefined
;
}
const
=
.
diagnostics
?.
[
.
workspacePath
]
??
getDiagnosticsFromTest
(
,
)
;
.
push
(
< ChangedFile
key = { ` changedFile- ${ changedFileIndex} ` }
changedFile = { changedFile}
prevFile = { prevFile}
fileDiagnostics = { fileDiagnostics}
languageId = { changedFile. languageId ?? 'plaintext' }
range = { state. range }
selections = { { before: files. selections . get ( changedFile. workspacePath ) , after: state. selection } }
/>
)
;
}
return
< div>
{
}
</ div>
;
}
)
;
function
getDiagnosticsFromTest
(
:
ISimulationTest
,
:
number
)
:
IDiagnosticComparison
|
undefined
{
if
(
===
0
&&
.
errorsOnlyInBefore
&&
.
errorsOnlyInAfter
)
{
const
=
(
:
EvaluationError
[
]
)
:
IDiagnostic
[
]
=>
{
return
.
map
(
=>
{
return
{
:
.
message
,
:
{
:
{
:
.
startLine
,
:
.
startColumn
}
,
:
{
:
.
endLine
,
:
.
endColumn
}
}
}
;
}
)
;
}
;
return
{
:
toDiagnostics
(
.
errorsOnlyInBefore
)
,
:
toDiagnostics
(
.
errorsOnlyInAfter
)
}
;
}
return
undefined
;
}
type
ChangedFileProps
=
{
readonly
:
IResolvedFile
;
readonly
:
string
|
undefined
;
readonly
:
IDiagnosticComparison
|
undefined
;
readonly
:
string
;
readonly
:
{
readonly
:
IRange
|
undefined
;
readonly
:
IRange
|
undefined
;
}
;
readonly
:
IRange
|
undefined
;
}
;
const
ChangedFile
=
.
observer
(
(
{
,
,
,
,
,
}
:
ChangedFileProps
)
=>
{
return
(
< div>
{
typeof
!==
'undefined'
?
(
< div>
< div className = ' step-title' >
Modified of Current run [
{
.
workspacePath
}
]
</ div>
< Text size = { 300 } >
Left editor - the existing code before applying the change, Right editor - the new code after applying the change
</ Text >
< DiffEditor
languageId = { languageId}
original = { prevFile}
modified = { changedFile. contents }
diagnostics = { fileDiagnostics}
selections = { selections}
/>
</ div>
)
:
(
< div>
< div className = ' step-title' >
Created of Current run [
{
.
workspacePath
}
]
</ div>
< Editor
contents = { changedFile. contents }
languageId = { languageId}
range = { range}
selection = { selections. after }
diagnostics = { fileDiagnostics?. after ?? [ ] }
/>
</ div>
)
}
{
&&
< div className = ' diagnostics-comparison' >
Diagnostics before:
{
.
before
.
length
}
,
after:
{
.
after
.
length
}
</ div>
}
</ div>
)
;
}
)
;
const
InitialState
=
.
observer
(
(
{
}
:
{
:
InitialWorkspaceState
}
)
=>
{
if
(
!
.
file
.
value
)
{
return
< >
</ >
;
}
return
(
< div>
< div className = ' step-title' >
Initial State of Current run [
{
.
file
.
value
.
workspacePath
}
]
</ div>
< Editor
contents = { state. file . value . contents }
languageId = { state. languageId ?? 'plaintext' }
selection = { state. selection }
diagnostics = { state. diagnostics }
/>
</ div>
)
;
}
)
;
const
NesUserEditHistory
=
.
observer
(
(
{
}
:
{
:
ISerializedNesUserEditsHistory
}
)
=>
{
const
{
,
}
=
;
return
(
< div>
< div>
User edits
</ div>
{
(
)
.
map
(
(
,
)
=>
{
return
< div key = { idx} >
< div className = ' step-title' >
{
===
?
'Active'
:
''
}
File
{
.
id
??
'No file name'
}
</ div>
< DiffEditor
languageId = { edit. languageId }
original = { edit. original }
modified = { edit. modified }
/>
</ div>
;
}
)
}
</ div>
)
;
}
)
;
const
NesLogContext
=
.
observer
(
(
{
}
:
{
:
string
}
)
=>
{
return
(
< details>
< summary>
Logs
</ summary>
< Editor contents = { logContext} languageId = ' markdown' />
</ details>
)
;
}
)
;
const
NextEditSuggestion
=
.
observer
(
(
{
,
}
:
{
:
'current'
|
'reference'
;
:
ISerializedFileEdit
;
}
)
=>
{
return
(
< div>
< div className = ' step-title' >
Next Edit (
{
===
'current'
?
'current run'
:
'reference run'
}
)
</ div>
< DiffEditor
languageId = { proposedNextEdit. languageId }
original = { proposedNextEdit. original }
modified = { proposedNextEdit. modified }
/>
</ div>
)
;
}
)
;
const
UserIcon
=
(
)
=>
{
return
(
< svg stroke = ' currentColor' fill = ' currentColor' strokeWidth = ' 0' viewBox = ' 0 0 256 256' height = ' 100%' width = ' 100%' xmlns = ' http://www.w3.org/2000/svg' >
<path d='M224,128a95.76,95.76,0,0,1-31.8,71.37A72,72,0,0,0,128,160a40,40,0,1,0-40-40,40,40,0,0,0,40,40,72,72,0,0,0-64.2,39.37h0A96,96,0,1,1,224,128Z' opacity='0.2'>
</ path>
<path d='M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24ZM74.08,197.5a64,64,0,0,1,107.84,0,87.83,87.83,0,0,1-107.84,0ZM96,120a32,32,0,1,1,32,32A32,32,0,0,1,96,120Zm97.76,66.41a79.66,79.66,0,0,0-36.06-28.75,48,48,0,1,0-59.4,0,79.66,79.66,0,0,0-36.06,28.75,88,88,0,1,1,131.52,0Z'>
</ path>
</ svg>
)
;
}
;
const
IntentIcon
=
(
)
=>
{
return
(
< svg fill = ' #000000' width = ' 100%' height = ' 100%' viewBox = ' 0 0 32 32' id = ' icon' xmlns = ' http://www.w3.org/2000/svg' >
< polygon points = ' 22 4 22 6 24.586 6 19.586 11 21 12.414 26 7.414 26 10 28 10 28 4 22 4' />
< polygon points = ' 10 4 10 6 7.414 6 12.414 11 11 12.414 6 7.414 6 10 4 10 4 4 10 4' />
< polygon points = ' 20 5 16 1 12 5 13.414 6.414 15 4.829 15 11 17 11 17 4.829 18.586 6.414 20 5' />
< polygon points = ' 22 28 22 26 24.586 26 19.586 21 21 19.586 26 24.586 26 22 28 22 28 28 22 28' />
< polygon points = ' 10 28 10 26 7.414 26 12.414 21 11 19.586 6 24.586 6 22 4 22 4 28 10 28' />
< polygon points = ' 20 27 16 31 12 27 13.414 25.586 15 27.171 15 21 17 21 17 27.171 18.586 25.586 20 27' />
< polygon points = ' 5 12 1 16 5 20 6.414 18.586 4.829 17 11 17 11 15 4.829 15 6.414 13.414 5 12' />
< polygon points = ' 27 12 31 16 27 20 25.586 18.586 27.171 17 21 17 21 15 27.171 15 25.586 13.414 27 12' />
< rect id = ' _Transparent_Rectangle_' data-name = ' < Transparent Rectangle> ' style = { { fill: 'none' } } width = ' 32' height = ' 32' />
</ svg>
)
;
}
;
const
UserQuery
=
(
{
}
:
{
:
string
}
)
=>
{
return
(
< div style = { { marginTop: '15px' } } >
< span style = { { width: '1.75em' , height: '1.75em' , display: 'inline-block' , float: 'left' } } >
< UserIcon />
</ span>
< span style = { {
lineHeight: '1.75em' ,
display: 'inline-block' ,
float: 'left' ,
marginLeft: '5px' ,
maxWidth: '1000px' ,
} } className = ' step-query' >
{
}
</ span>
< div style = { { clear: 'left' } } >
</ div>
</ div>
)
;
}
;
const
ChosenIntent
=
(
{
,
}
:
{
:
string
|
undefined
;
:
string
|
undefined
}
)
=>
{
return
(
< div>
< span style = { { width: '1.50em' , height: '1.50em' , paddingLeft: '0.12em' , paddingRight: '0.12em' , display: 'inline-block' , float: 'left' } } >
< IntentIcon />
</ span>
< span style = { { lineHeight: '1.50em' , display: 'inline-block' , float: 'left' , marginLeft: '5px' } } className = ' step-query' >
/
{
}
(EXPECTED: /
{
}
)
</ span>
< div style = { { clear: 'left' } } >
</ div>
</ div>
)
;
}
;
const
ErrorMessageBar
=
.
observer
(
(
{
}
:
{
:
string
}
)
=>
{
let
:
string
=
'See below'
;
{
const
=
.
indexOf
(
'\n'
)
;
if
(
!==
-
1
)
{
=
.
substring
(
0
,
)
;
}
}
return
(
< MessageBar intent = ' error' layout = ' singleline' >
< MessageBarBody >
< MessageBarTitle >
Test failed with error:
{
}
</ MessageBarTitle >
< pre>
{
stripAnsiiColors
(
)
}
</ pre>
</ MessageBarBody >
</ MessageBar >
)
;
}
)
;
function
stripAnsiiColors
(
:
string
)
{
return
.
replace
(
/ \x1b \[ [ 0- 9 ;] * m/ g
,
''
)
;
}
type
ExpectedDiffProps
=
{
readonly
:
string
;
}
;
const
ExpectedDiff
=
.
observer
(
(
{
}
:
ExpectedDiffProps
)
=>
{
return
< div className = ' expected-diffs' >
{
dumbDiffParser
(
)
.
map
(
=>
{
return
< div className = ' expected-diffs' >
< div className = ' step-title' >
Expected diff [
{
.
path
}
]
</ div>
< DiffEditor
languageId = { details. path . match ( / \. \w + / ) ?. [ 0 ] . substring ( 1 ) ?? 'plaintext' }
modified = { details. modified }
original = { details. original } />
</ div>
;
}
)
}
</ div>
;
}
)
;
function
dumbDiffParser
(
:
string
)
:
{
:
string
;
:
string
;
:
string
}
[
]
{
const
=
.
split
(
'\n'
)
;
const
:
{
:
string
;
:
string
;
:
string
}
[
]
=
[
]
;
let
:
{
:
string
;
:
string
;
:
string
}
|
undefined
;
for
(
const
of
)
{
if
(
.
startsWith
(
'---'
)
)
{
const
=
.
substring
(
6
)
;
=
{
:
''
,
:
''
,
}
;
.
push
(
)
;
}
else
if
(
.
startsWith
(
'+++'
)
)
{
}
else
if
(
.
startsWith
(
'-'
)
)
{
if
(
)
{
.
original
+=
.
slice
(
1
)
+
'\n'
;
}
}
else
if
(
.
startsWith
(
'+'
)
)
{
if
(
)
{
.
modified
+=
.
slice
(
1
)
+
'\n'
;
}
}
else
{
if
(
)
{
.
original
+=
.
slice
(
1
)
+
'\n'
;
.
modified
+=
.
slice
(
1
)
+
'\n'
;
}
}
}
return
;
}