ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / workbench / api / test / browser / mainThreadDataChannels.test.ts 563 строк · изменён 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
import * as assert from 'assert' ;
import type * as vscode from 'vscode' ;
import { Emitter } from '../../../../base/common/event.js' ;
import { autorun, observableValue } from '../../../../base/common/observable.js' ;
import { URI } from '../../../../base/common/uri.js' ;
import { mock } from '../../../../base/test/common/mock.js' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js' ;
import { IConfigurationChangeEvent
TestConfigurationService
ILinkPresentation ILinkPresentationProviderRegistration
ExtensionIdentifier
NullLogService
DataChannelService LinkPresentationService
NullExtensionService nullExtensionDescription
TestStorageService
MainThreadDataChannels
ExtHostDataChannels
ExtHostDataChannelsShape MainThreadDataChannelsShape
SingleProxyRPCProtocol
store
presentations
extHostProxy
override _handle data
presentations data
override
mainThread store
extHostProxy
store
store
store
mainThread
assert presentations
kind
status kind label
tooltip
ariaLabel
presentation
kind
status kind label
configurationService
linkPresentationService store
configurationService
store
providerWatcherCreateCount
providerWatcherDisposeCount
store linkPresentationService
id
uriPattern
kind
enablement
providerWatcherCreateCount
presentation
providerWatcherDisposeCount
acceptedRules id source flags kind vscode LinkPresentationKind
extHostHolder value ExtHostDataChannels
extHostProxy ExtHostDataChannelsShape
channelId value extHostHolder value channelId value
rules
acceptedRules rules
extHostHolder value rules
handle value extHostHolder value handle value
handle providerHandle resource extHostHolder value
extHostHolder value handle providerHandle resource
handle extHostHolder value handle
mainThread store
extHostProxy
store
linkPresentationService
extHost mainThread
extHostHolder value extHost
extHost acceptedRules
ruleChangeCount
store extHost ruleChangeCount
extension
nullExtensionDescription
enabledApiProposals
assert
extHost extension
watcher store extHost extension
values vscode LinkPresentationData watcher presentation
store watcher values watcher presentation
presentation kind title status kind label
configurationService
configurationService
presentation kind title status kind label
configurationService
configurationService
watcher
linkPresentationService
assert
values
acceptedRules
linkPresentationRules extHost linkPresentationRules rule id rule id source rule uriPattern source flags rule uriPattern flags kind rule kind
ruleChangeCount
providerWatcherCreateCount
providerWatcherDisposeCount
values
kind status kind label
kind title status kind label
kind title status kind label isLoading
kind title status kind label
acceptedRules id source flags kind
linkPresentationRules id source flags kind
ruleChangeCount
providerWatcherCreateCount
providerWatcherDisposeCount
configurationService
linkPresentationService store
configurationService
store
store linkPresentationService
id
uriPattern
kind
enablement
acceptedRules id source flags kind vscode LinkPresentationKind
extHostProxy ExtHostDataChannelsShape
channelId value extHost channelId value
rules acceptedRules rules
handle value extHost handle value
handle providerHandle resource extHost handle providerHandle resource
handle extHost handle
mainThread store
extHostProxy
store
linkPresentationService
extHost mainThread
extension
nullExtensionDescription
identifier
enabledApiProposals
onDidChangePresentation store
presentation vscode LinkPresentationData
kind
title
status kind label
isLoading
providerWatcherCreateCount
providerWatcherDisposeCount
store extHost extension
providerWatcherCreateCount
presentation
onDidChangePresentation onDidChangePresentation event
providerWatcherDisposeCount
resource
assert linkPresentationService resource id
assert linkPresentationService
watcher store linkPresentationService resource
values ILinkPresentation
store reader values watcher presentation reader
presentation
kind
title
status kind label
onDidChangePresentation
secondWatcher store linkPresentationService resource
secondInitialPresentation secondWatcher presentation
configurationService
configurationService
configurationService
configurationService
watcher
secondWatcher
linkPresentationService
assert
values
acceptedRules
secondInitialPresentation
providerWatcherCreateCount
providerWatcherDisposeCount
values
kind
title
status kind label
isLoading
kind
title
status kind label
kind
title
status kind label
isLoading
kind
title
status kind label
acceptedRules
id
source
flags
kind
secondInitialPresentation
kind
title
status kind label
providerWatcherCreateCount
providerWatcherDisposeCount
watcherHandle
mainThreadProxy MainThreadDataChannelsShape
handle watcherHandle handle
extHost mainThreadProxy
extHost
id
source
flags
kind
extension
nullExtensionDescription
enabledApiProposals
resource
firstWatcher store extHost extension resource
ruleInitialPresentation firstWatcher presentation
watcherHandle
extHost watcherHandle
kind
title
status kind label
firstWatcher
secondWatcher store extHost extension resource
extHost
id
source
flags
kind
changedKindWatcher store extHost extension resource
assert
ruleInitialPresentation
cachedInitialPresentation secondWatcher presentation
changedKindInitialPresentation changedKindWatcher presentation
ruleInitialPresentation
kind
isLoading
cachedInitialPresentation
kind
title
status kind label
isLoading
changedKindInitialPresentation
kind
isLoading
linkPresentationService store
store
watcherCreateCount
store linkPresentationService
id
uriPattern
kind
watcherCreateCount
presentation kind
store linkPresentationService
id
uriPattern
kind
fileResource
remoteFileResource
assert
rules linkPresentationService linkPresentationRules
fileRule linkPresentationService fileResource
remoteFileRule linkPresentationService remoteFileResource
fileWatcher linkPresentationService fileResource
remoteFileWatcher linkPresentationService remoteFileResource
watcherCreateCount
rules
fileRule
remoteFileRule
fileWatcher
remoteFileWatcher
watcherCreateCount
linkPresentationService store
store
presentation
kind
title
store linkPresentationService
id
uriPattern
kind
presentation
watcher store linkPresentationService
values ILinkPresentation
store reader values watcher presentation reader
presentation
kind
title
assert values
kind
status kind label
tooltip
ariaLabel
kind
title
configurationService
storageService store
resource
registration ILinkPresentationProviderRegistration
id
uriPattern
kind
firstService store
configurationService
storageService
store firstService registration
presentation
kind
title
firstWatcher store firstService registration id resource
firstWatcher
firstService
restoredService store
configurationService
storageService
store restoredService registration
presentation
kind
title
restoredWatcher store restoredService registration id resource
assert restoredWatcher presentation
kind
status kind label
tooltip
ariaLabel
configurationService
storageService store
resource
registration ILinkPresentationProviderRegistration
id
uriPattern
kind
enablement
firstService store
configurationService
storageService
firstPresentation
kind
title
status kind label
store firstService registration
presentation firstPresentation
firstWatcher store firstService registration id resource
firstWatcher
firstService
restoredService store
configurationService
storageService
unresolvedPresentation
store restoredService registration
presentation unresolvedPresentation
restoredWatcher store restoredService registration id resource
assert restoredWatcher presentation
kind
title
status kind label
isLoading
restoredWatcher
restoredService
configurationService TestConfigurationService setting
configurationService onDidChangeConfigurationEmitter
override section
section setting
}
from
'../../../../platform/configuration/common/configuration.js'
;
import
{
}
from
'../../../../platform/configuration/test/common/testConfigurationService.js'
;
import
{
,
}
from
'../../../../platform/dataChannel/common/dataChannel.js'
;
import
{
}
from
'../../../../platform/extensions/common/extensions.js'
;
import
{
}
from
'../../../../platform/log/common/log.js'
;
import
{
,
}
from
'../../../services/dataChannel/browser/dataChannelService.js'
;
import
{
,
}
from
'../../../services/extensions/common/extensions.js'
;
import
{
}
from
'../../../test/common/workbenchTestServices.js'
;
import
{
}
from
'../../browser/mainThreadDataChannels.js'
;
import
{
}
from
'../../common/extHostDataChannels.js'
;
import
{
,
}
from
'../../common/extHost.protocol.js'
;
import
{
}
from
'../common/testRPCProtocol.js'
;
suite
(
'MainThreadDataChannels'
,
(
)
=>
{
const
=
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
test
(
'preserves the selected kind when the provider is no longer available'
,
(
)
=>
{
const
:
unknown
[
]
=
[
]
;
const
=
new
class
extends
mock< ExtHostDataChannelsShape>
(
)
{
$acceptLinkPresentation
(
:
number
,
:
unknown
)
:
void
{
.
push
(
)
;
}
$acceptLinkPresentationRules
(
)
:
void
{
}
}
;
const
=
.
add
(
new
MainThreadDataChannels
(
SingleProxyRPCProtocol
(
)
,
.
add
(
new
DataChannelService
(
)
)
,
.
add
(
new
LinkPresentationService
(
new
NullExtensionService
(
)
,
new
NullLogService
(
)
,
new
TestConfigurationService
(
)
,
.
add
(
new
TestStorageService
(
)
)
,
)
)
,
)
)
;
.
$createLinkPresentationWatcher
(
1
,
'missing'
,
'pullRequest'
,
URI
.
parse
(
'https://example.com/pull/1'
)
)
;
.
deepStrictEqual
(
,
[
{
:
'pullRequest'
,
:
{
:
'error'
,
:
'Not available'
}
,
:
'The selected link presentation provider does not accept this resource.'
,
:
'Link presentation is not available'
,
}
]
)
;
}
)
;
test
(
'bridges core link presentation watchers and runtime enablement'
,
async
(
)
=>
{
const
=
observableValue < ILinkPresentation | undefined >
(
'presentation'
,
{
:
'session'
,
:
{
:
'pending'
,
:
'Loading'
}
,
}
)
;
const
=
new
TestConfigurationService
(
{
'test.richLinks.enabled'
:
true
}
)
;
const
=
.
add
(
new
LinkPresentationService
(
new
NullExtensionService
(
)
,
new
NullLogService
(
)
,
,
.
add
(
new
TestStorageService
(
)
)
,
)
)
;
let
=
0
;
let
=
0
;
.
add
(
.
registerLinkPresentationProvider
(
{
:
'test.sessions'
,
:
/ ^ agent-host-session:/ i
,
:
'session'
,
:
'test.richLinks.enabled'
,
}
,
{
createLinkPresentationWatcher
:
(
)
=>
{
++
;
return
{
,
dispose
:
(
)
=>
++
,
}
;
}
,
}
)
)
;
let
:
readonly
{
:
string
;
:
string
;
:
string
;
:
.
}
[
]
=
[
]
;
const
:
{
?
:
}
=
{
}
;
const
:
=
{
$onDidReceiveData
:
(
,
)
=>
.
?.
$onDidReceiveData
(
,
)
,
$acceptLinkPresentationRules
:
=>
{
=
;
.
?.
$acceptLinkPresentationRules
(
)
;
}
,
$acceptLinkPresentation
:
(
,
)
=>
.
?.
$acceptLinkPresentation
(
,
)
,
$createLinkPresentationWatcher
:
(
,
,
)
=>
.
?
.
.
$createLinkPresentationWatcher
(
,
,
)
:
Promise
.
reject
(
new
Error
(
'Extension host is not initialized.'
)
)
,
$disposeLinkPresentationWatcher
:
=>
.
?.
$disposeLinkPresentationWatcher
(
)
,
}
;
const
=
.
add
(
new
MainThreadDataChannels
(
SingleProxyRPCProtocol
(
)
,
.
add
(
new
DataChannelService
(
)
)
,
,
)
)
;
const
=
new
ExtHostDataChannels
(
SingleProxyRPCProtocol
(
)
)
;
.
=
;
.
$acceptLinkPresentationRules
(
)
;
let
=
0
;
.
add
(
.
onDidChangeLinkPresentationRules
(
(
)
=>
++
)
)
;
const
=
{
...
,
:
[
'linkPresentation'
]
,
}
;
.
throws
(
(
)
=>
.
createLinkPresentationWatcher
(
,
'test.sessions'
,
URI
.
parse
(
'https://example.com/not-supported'
)
)
,
/ does not accept /
,
)
;
const
=
.
add
(
.
createLinkPresentationWatcher
(
,
'test.sessions'
,
URI
.
parse
(
'agent-host-session://copilotcli/session'
)
)
)
;
const
:
.
[
]
=
[
.
]
;
.
add
(
.
onDidChangePresentation
(
(
)
=>
.
push
(
.
)
)
)
;
.
set
(
{
:
'session'
,
:
'Running session'
,
:
{
:
'pending'
,
:
'Working'
}
}
,
undefined
)
;
await
.
setUserConfiguration
(
'test.richLinks.enabled'
,
false
)
;
fireConfigurationChange
(
,
'test.richLinks.enabled'
)
;
.
set
(
{
:
'session'
,
:
'Completed session'
,
:
{
:
'success'
,
:
'Completed'
}
}
,
undefined
)
;
await
.
setUserConfiguration
(
'test.richLinks.enabled'
,
true
)
;
fireConfigurationChange
(
,
'test.richLinks.enabled'
)
;
await
Promise
.
resolve
(
)
;
await
Promise
.
resolve
(
)
;
.
dispose
(
)
;
.
dispose
(
)
;
.
deepStrictEqual
(
{
,
,
:
.
.
map
(
=>
(
{
:
.
,
:
.
.
,
:
.
.
,
:
.
}
)
)
,
,
,
,
}
,
{
:
[
{
:
'session'
,
:
{
:
'pending'
,
:
'Loading'
}
}
,
{
:
'session'
,
:
'Running session'
,
:
{
:
'pending'
,
:
'Working'
}
}
,
{
:
'session'
,
:
'Running session'
,
:
{
:
'pending'
,
:
'Working'
}
,
:
true
}
,
{
:
'session'
,
:
'Completed session'
,
:
{
:
'success'
,
:
'Completed'
}
}
,
]
,
:
[
{
:
'test.sessions'
,
:
'^agent-host-session:'
,
:
'i'
,
:
'session'
}
]
,
:
[
{
:
'test.sessions'
,
:
'^agent-host-session:'
,
:
'i'
,
:
'session'
}
]
,
:
2
,
:
2
,
:
2
,
}
)
;
}
)
;
test
(
'selects extension providers by URI regexp and shares live watchers'
,
async
(
)
=>
{
const
=
new
TestConfigurationService
(
{
'test.richLinks.enabled'
:
true
}
)
;
const
=
.
add
(
new
LinkPresentationService
(
new
NullExtensionService
(
)
,
new
NullLogService
(
)
,
,
.
add
(
new
TestStorageService
(
)
)
,
)
)
;
.
add
(
.
declareExtensionLinkPresentationProvider
(
'test.extension'
,
{
:
'test.linkPresentations'
,
:
'^https://github\\.com/[^/]+/[^/]+/pull/[0-9]+$'
,
:
'pullRequest'
,
:
'test.richLinks.enabled'
,
}
)
)
;
let
:
readonly
{
:
string
;
:
string
;
:
string
;
:
.
}
[
]
=
[
]
;
const
:
=
{
$onDidReceiveData
:
(
,
)
=>
.
$onDidReceiveData
(
,
)
,
$acceptLinkPresentationRules
:
=>
=
,
$acceptLinkPresentation
:
(
,
)
=>
.
$acceptLinkPresentation
(
,
)
,
$createLinkPresentationWatcher
:
(
,
,
)
=>
.
$createLinkPresentationWatcher
(
,
,
)
,
$disposeLinkPresentationWatcher
:
=>
.
$disposeLinkPresentationWatcher
(
)
,
}
;
const
=
.
add
(
new
MainThreadDataChannels
(
SingleProxyRPCProtocol
(
)
,
.
add
(
new
DataChannelService
(
)
)
,
,
)
)
;
const
=
new
ExtHostDataChannels
(
SingleProxyRPCProtocol
(
)
)
;
const
=
{
...
,
:
new
ExtensionIdentifier
(
'test.extension'
)
,
:
[
'linkPresentation'
]
,
}
;
const
=
.
add
(
new
Emitter< void >
(
)
)
;
let
:
.
=
{
:
'pullRequest'
,
:
'Initial pull request'
,
:
{
:
'open'
,
:
'Open'
}
,
:
true
,
}
;
let
=
0
;
let
=
0
;
.
add
(
.
registerLinkPresentationProvider
(
,
'test.linkPresentations'
,
{
provideLinkPresentationWatcher
:
(
)
=>
{
++
;
return
{
get
presentation
(
)
{
return
;
}
,
:
.
,
dispose
:
(
)
=>
++
,
}
;
}
,
}
)
)
;
const
=
URI
.
parse
(
'https://github.com/microsoft/vscode/pull/1'
)
;
.
strictEqual
(
.
getLinkPresentationRule
(
)
?.
,
'test.linkPresentations'
)
;
.
strictEqual
(
.
getLinkPresentationRule
(
URI
.
parse
(
'https://example.com/microsoft/vscode/pull/1'
)
)
,
undefined
)
;
const
=
.
add
(
.
createLinkPresentationWatcher
(
'test.linkPresentations'
,
)
!
)
;
const
:
(
|
undefined
)
[
]
=
[
]
;
.
add
(
autorun
(
=>
.
push
(
.
.
read
(
)
)
)
)
;
await
Promise
.
resolve
(
)
;
await
Promise
.
resolve
(
)
;
=
{
:
'pullRequest'
,
:
'Updated pull request'
,
:
{
:
'merged'
,
:
'Merged'
}
,
}
;
.
fire
(
)
;
const
=
.
add
(
.
createLinkPresentationWatcher
(
'test.linkPresentations'
,
)
!
)
;
const
=
.
.
get
(
)
;
await
.
setUserConfiguration
(
'test.richLinks.enabled'
,
false
)
;
fireConfigurationChange
(
,
'test.richLinks.enabled'
)
;
await
.
setUserConfiguration
(
'test.richLinks.enabled'
,
true
)
;
fireConfigurationChange
(
,
'test.richLinks.enabled'
)
;
await
Promise
.
resolve
(
)
;
await
Promise
.
resolve
(
)
;
.
dispose
(
)
;
.
dispose
(
)
;
.
dispose
(
)
;
.
deepStrictEqual
(
{
,
,
,
,
,
}
,
{
:
[
undefined
,
{
:
'pullRequest'
,
:
'Initial pull request'
,
:
{
:
'open'
,
:
'Open'
}
,
:
true
,
}
,
{
:
'pullRequest'
,
:
'Updated pull request'
,
:
{
:
'merged'
,
:
'Merged'
}
,
}
,
undefined
,
{
:
'pullRequest'
,
:
'Updated pull request'
,
:
{
:
'merged'
,
:
'Merged'
}
,
:
true
,
}
,
{
:
'pullRequest'
,
:
'Updated pull request'
,
:
{
:
'merged'
,
:
'Merged'
}
,
}
,
]
,
:
[
{
:
'test.linkPresentations'
,
:
'^https:\\/\\/github\\.com\\/[^/]+\\/[^/]+\\/pull\\/[0-9]+$'
,
:
'i'
,
:
'pullRequest'
,
}
]
,
:
{
:
'pullRequest'
,
:
'Updated pull request'
,
:
{
:
'merged'
,
:
'Merged'
}
,
}
,
:
2
,
:
2
,
}
)
;
}
)
;
test
(
'initializes watchers synchronously from rules and the last-data cache'
,
(
)
=>
{
let
:
number
|
undefined
;
const
:
=
{
$createLinkPresentationWatcher
:
=>
=
,
$disposeLinkPresentationWatcher
:
(
)
=>
{
}
,
$registerLinkPresentationProvider
:
(
)
=>
{
}
,
$unregisterLinkPresentationProvider
:
(
)
=>
{
}
,
$acceptLinkPresentationProviderData
:
(
)
=>
{
}
,
dispose
:
(
)
=>
{
}
,
}
;
const
=
new
ExtHostDataChannels
(
SingleProxyRPCProtocol
(
)
)
;
.
$acceptLinkPresentationRules
(
[
{
:
'test.pullRequests'
,
:
'^https://github\\.com/[^/]+/[^/]+/pull/[0-9]+$'
,
:
'i'
,
:
'pullRequest'
,
}
]
)
;
const
=
{
...
,
:
[
'linkPresentation'
]
,
}
;
const
=
URI
.
parse
(
'https://github.com/microsoft/vscode/pull/1'
)
;
const
=
.
add
(
.
createLinkPresentationWatcher
(
,
'test.pullRequests'
,
)
)
;
const
=
.
;
if
(
===
undefined
)
{
throw
new
Error
(
'Expected a watcher handle.'
)
;
}
.
$acceptLinkPresentation
(
,
{
:
'pullRequest'
,
:
'Cached pull request'
,
:
{
:
'open'
,
:
'Open'
}
,
}
)
;
.
dispose
(
)
;
const
=
.
add
(
.
createLinkPresentationWatcher
(
,
'test.pullRequests'
,
)
)
;
.
$acceptLinkPresentationRules
(
[
{
:
'test.pullRequests'
,
:
'^https://github\\.com/[^/]+/[^/]+/pull/[0-9]+$'
,
:
'i'
,
:
'issue'
,
}
]
)
;
const
=
.
add
(
.
createLinkPresentationWatcher
(
,
'test.pullRequests'
,
)
)
;
.
deepStrictEqual
(
{
,
:
.
,
:
.
,
}
,
{
:
{
:
'pullRequest'
,
:
true
,
}
,
:
{
:
'pullRequest'
,
:
'Cached pull request'
,
:
{
:
'open'
,
:
'Open'
}
,
:
true
,
}
,
:
{
:
'issue'
,
:
true
,
}
,
}
)
;
}
)
;
test
(
'skips file link presentation providers'
,
(
)
=>
{
const
=
.
add
(
new
LinkPresentationService
(
new
NullExtensionService
(
)
,
new
NullLogService
(
)
,
new
TestConfigurationService
(
)
,
.
add
(
new
TestStorageService
(
)
)
,
)
)
;
let
=
0
;
.
add
(
.
registerLinkPresentationProvider
(
{
:
'test.coreFiles'
,
:
/ ^ file:/
,
:
'file'
,
}
,
{
createLinkPresentationWatcher
:
(
)
=>
{
++
;
return
{
:
observableValue < ILinkPresentation | undefined >
(
'filePresentation'
,
{
:
'file'
}
)
,
dispose
:
(
)
=>
{
}
,
}
;
}
,
}
)
)
;
.
add
(
.
declareExtensionLinkPresentationProvider
(
'test.extension'
,
{
:
'test.extensionFiles'
,
:
'^https://example\\.com/file$'
,
:
'file'
,
}
)
)
;
const
=
URI
.
parse
(
'file:///workspace/file.ts'
)
;
const
=
URI
.
parse
(
'https://example.com/file'
)
;
.
deepStrictEqual
(
{
:
.
,
:
.
getLinkPresentationRule
(
)
,
:
.
getLinkPresentationRule
(
)
,
:
.
createLinkPresentationWatcher
(
'test.coreFiles'
,
)
,
:
.
createLinkPresentationWatcher
(
'test.extensionFiles'
,
)
,
,
}
,
{
:
[
]
,
:
undefined
,
:
undefined
,
:
undefined
,
:
undefined
,
:
0
,
}
)
;
}
)
;
test
(
'rejects presentations that disagree with the registered kind'
,
(
)
=>
{
const
=
.
add
(
new
LinkPresentationService
(
new
NullExtensionService
(
)
,
new
NullLogService
(
)
,
new
TestConfigurationService
(
)
,
.
add
(
new
TestStorageService
(
)
)
,
)
)
;
const
=
observableValue < ILinkPresentation | undefined >
(
'presentation'
,
{
:
'issue'
,
:
'Wrong kind'
,
}
)
;
.
add
(
.
registerLinkPresentationProvider
(
{
:
'test.pullRequests'
,
:
/ ^ https:\/ \/ example\. com\/ pull\/ [ 0- 9 ] + $ /
,
:
'pullRequest'
,
}
,
{
createLinkPresentationWatcher
:
(
)
=>
(
{
,
dispose
:
(
)
=>
{
}
,
}
)
,
}
)
)
;
const
=
.
add
(
.
createLinkPresentationWatcher
(
'test.pullRequests'
,
URI
.
parse
(
'https://example.com/pull/1'
)
,
)
!
)
;
const
:
(
|
undefined
)
[
]
=
[
]
;
.
add
(
autorun
(
=>
.
push
(
.
.
read
(
)
)
)
)
;
.
set
(
{
:
'pullRequest'
,
:
'Correct kind'
,
}
,
undefined
)
;
.
deepStrictEqual
(
,
[
{
:
'pullRequest'
,
:
{
:
'error'
,
:
'Not available'
}
,
:
'The link presentation provider failed to load.'
,
:
'Link presentation is not available'
,
}
,
{
:
'pullRequest'
,
:
'Correct kind'
,
}
,
]
)
;
}
)
;
test
(
'replaces a restored presentation when the provider returns the wrong kind'
,
(
)
=>
{
const
=
new
TestConfigurationService
(
)
;
const
=
.
add
(
new
TestStorageService
(
)
)
;
const
=
URI
.
parse
(
'https://example.com/pull/1'
)
;
const
:
=
{
:
'test.pullRequests'
,
:
/ ^ https:\/ \/ example\. com\/ pull\/ [ 0- 9 ] + $ /
,
:
'pullRequest'
,
}
;
const
=
.
add
(
new
LinkPresentationService
(
new
NullExtensionService
(
)
,
new
NullLogService
(
)
,
,
,
)
)
;
.
add
(
.
registerLinkPresentationProvider
(
,
{
createLinkPresentationWatcher
:
(
)
=>
(
{
:
observableValue < ILinkPresentation | undefined >
(
'firstPresentation'
,
{
:
'pullRequest'
,
:
'Cached pull request'
,
}
)
,
dispose
:
(
)
=>
{
}
,
}
)
,
}
)
)
;
const
=
.
add
(
.
createLinkPresentationWatcher
(
.
,
)
!
)
;
.
dispose
(
)
;
.
dispose
(
)
;
const
=
.
add
(
new
LinkPresentationService
(
new
NullExtensionService
(
)
,
new
NullLogService
(
)
,
,
,
)
)
;
.
add
(
.
registerLinkPresentationProvider
(
,
{
createLinkPresentationWatcher
:
(
)
=>
(
{
:
observableValue < ILinkPresentation | undefined >
(
'wrongPresentation'
,
{
:
'issue'
,
:
'Wrong kind'
,
}
)
,
dispose
:
(
)
=>
{
}
,
}
)
,
}
)
)
;
const
=
.
add
(
.
createLinkPresentationWatcher
(
.
,
)
!
)
;
.
deepStrictEqual
(
.
.
get
(
)
,
{
:
'pullRequest'
,
:
{
:
'error'
,
:
'Not available'
}
,
:
'The link presentation provider failed to load.'
,
:
'Link presentation is not available'
,
}
)
;
}
)
;
test
(
'restores the shared cache after a service restart'
,
(
)
=>
{
const
=
new
TestConfigurationService
(
{
'test.richLinks.enabled'
:
true
}
)
;
const
=
.
add
(
new
TestStorageService
(
)
)
;
const
=
URI
.
parse
(
'https://github.com/microsoft/vscode/pull/1'
)
;
const
:
=
{
:
'test.pullRequests'
,
:
/ ^ https:\/ \/ github\. com\/ [ ^ /] + \/ [ ^ /] + \/ pull\/ [ 0- 9 ] + $ / i
,
:
'pullRequest'
,
:
'test.richLinks.enabled'
,
}
;
const
=
.
add
(
new
LinkPresentationService
(
new
NullExtensionService
(
)
,
new
NullLogService
(
)
,
,
,
)
)
;
const
=
observableValue < ILinkPresentation | undefined >
(
'firstPresentation'
,
{
:
'pullRequest'
,
:
'Persisted pull request'
,
:
{
:
'open'
,
:
'Open'
}
,
}
)
;
.
add
(
.
registerLinkPresentationProvider
(
,
{
createLinkPresentationWatcher
:
(
)
=>
(
{
:
,
dispose
:
(
)
=>
{
}
,
}
)
,
}
)
)
;
const
=
.
add
(
.
createLinkPresentationWatcher
(
.
,
)
!
)
;
.
dispose
(
)
;
.
dispose
(
)
;
const
=
.
add
(
new
LinkPresentationService
(
new
NullExtensionService
(
)
,
new
NullLogService
(
)
,
,
,
)
)
;
const
=
observableValue < ILinkPresentation | undefined >
(
'unresolvedPresentation'
,
undefined
)
;
.
add
(
.
registerLinkPresentationProvider
(
,
{
createLinkPresentationWatcher
:
(
)
=>
(
{
:
,
dispose
:
(
)
=>
{
}
,
}
)
,
}
)
)
;
const
=
.
add
(
.
createLinkPresentationWatcher
(
.
,
)
!
)
;
.
deepStrictEqual
(
.
.
get
(
)
,
{
:
'pullRequest'
,
:
'Persisted pull request'
,
:
{
:
'open'
,
:
'Open'
}
,
:
true
,
}
)
;
.
dispose
(
)
;
.
dispose
(
)
;
}
)
;
function
fireConfigurationChange
(
:
,
:
string
)
:
void
{
.
.
fire
(
new
class
extends
mock< IConfigurationChangeEvent>
(
)
{
affectsConfiguration
(
:
string
)
:
boolean
{
return
===
;
}
}
)
;
}
}
)
;