ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / workbench / services / configurationResolver / test / electron-browser / configurationResolverService.test.ts 1097 строк · изменён 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
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
import assert from 'assert' ;
import { stub } from 'sinon' ;
import { Emitter, Event } from '../../../../../base/common/event.js' ;
import { Disposable, IDisposable } from '../../../../../base/common/lifecycle.js' ;
import { Schemas } from '../../../../../base/common/network.js' ;
import { IPath, normalize } from '../../../../../base/common/path.js' ;
import * as platform from '../../../../../base/common/platform.js' ;
import { isLinux, isMacintosh isWindows
isObject
ensureNoDisposablesAreLeakedInTestSuite
Selection
EditorType
ICommandService
IConfigurationOverrides IConfigurationService IConfigurationValue
TestConfigurationService
IExtensionDescription
IFormatterChangeEvent ILabelService ResourceLabelFormatter Verbosity
IWorkspace IWorkspaceFolder IWorkspaceIdentifier Workspace
testWorkspace
TestEditorService TestQuickInputService
TestContextService TestExtensionService TestStorageService
IExtensionService
IPathService
BaseConfigurationResolverService
IConfigurationResolverService
ConfigurationResolverExpression
mockLineNumber
override
EditorType ICodeEditor
mockLineNumber mockLineNumber
override
nullContext
configurationResolverService IConfigurationResolverService
envVariables key key1 key2
mockCommandService MockCommandService
editorService TestEditorServiceWithActiveEditor
containingWorkspace Workspace
workspace IWorkspaceFolder
quickInputService TestQuickInputService
labelService MockLabelService
pathService MockPathService
extensionService IExtensionService
disposables
mockCommandService
editorService disposables
quickInputService
labelService
pathService
extensionService
containingWorkspace
workspace containingWorkspace folders
configurationResolverService nullContext envVariables editorService mockCommandService containingWorkspace quickInputService labelService pathService extensionService disposables
configurationResolverService
platform isWindows
assert configurationResolverService workspace
assert configurationResolverService workspace
obj
program
windows
program
linux
program
config configurationResolverService workspace obj
expected isWindows isMacintosh isLinux
assert config windows
assert config osx
assert config linux
assert config program expected
expected isWindows isMacintosh isLinux
obj
windows
program
osx
program
linux
program
originalObj obj
config configurationResolverService workspace obj
assert config program expected
assert config windows
assert config osx
assert config linux
assert obj originalObj
platform isWindows
assert configurationResolverService workspace
assert configurationResolverService workspace
assert configurationResolverService workspace
assert configurationResolverService
platform isWindows
assert configurationResolverService
assert configurationResolverService
assert configurationResolverService
assert configurationResolverService workspace
assert configurationResolverService workspace
assert configurationResolverService workspace
assert configurationResolverService workspace
assert configurationResolverService workspace
platform isWindows
assert configurationResolverService
assert configurationResolverService
assert configurationResolverService
assert configurationResolverService
platform isWindows
assert configurationResolverService workspace
assert configurationResolverService workspace
platform isWindows
assert configurationResolverService workspace
assert configurationResolverService workspace
platform isWindows
assert configurationResolverService workspace
assert configurationResolverService workspace
assert configurationResolverService workspace
getExtension extensionService
getExtension extensionLocation IExtensionDescription
assert configurationResolverService workspace fsPath
platform isWindows
assert configurationResolverService workspace
assert configurationResolverService workspace
configurationService IConfigurationService
editor
fontFamily
terminal
integrated
fontFamily
service nullContext envVariables disposables configurationService mockCommandService quickInputService labelService pathService extensionService disposables
assert service workspace
configurationService IConfigurationService
editor
fontFamily
service nullContext envVariables disposables configurationService mockCommandService quickInputService labelService pathService extensionService disposables
assert service workspace
configurationService IConfigurationService
editor
fontFamily
service nullContext envVariables disposables configurationService mockCommandService quickInputService labelService pathService extensionService disposables
assert service
configurationService
editor
fontFamily
terminal
integrated
fontFamily
service nullContext envVariables disposables configurationService mockCommandService quickInputService labelService pathService extensionService disposables
assert service workspace
configurationService
editor
fontFamily
terminal
integrated
fontFamily
service nullContext envVariables disposables configurationService mockCommandService quickInputService labelService pathService extensionService disposables
platform isWindows
assert service workspace
assert service workspace
configurationService
key1
key2
key3
service nullContext envVariables disposables configurationService mockCommandService quickInputService labelService pathService extensionService disposables
assert service workspace
configurationService
editor
fontFamily
terminal
integrated
fontFamily
service nullContext envVariables disposables configurationService mockCommandService quickInputService labelService pathService extensionService disposables
platform isWindows
assert service workspace
assert service workspace
configurationService
editor
fontFamily
lineNumbers
insertSpaces
terminal
integrated
fontFamily
json
schemas
fileMatch
url
service nullContext envVariables disposables configurationService mockCommandService quickInputService labelService pathService extensionService disposables
assert service workspace
configurationService
editor
service nullContext envVariables disposables configurationService mockCommandService quickInputService labelService pathService extensionService disposables
assert service workspace
assert service workspace
configurationService
editor
fontFamily
service nullContext envVariables disposables configurationService mockCommandService quickInputService labelService pathService extensionService disposables
assert service workspace
assert service workspace
assert service workspace
assert service workspace
assert service workspace
assert service workspace
assert service workspace
configuration
configurationResolverService configuration result
assert result
assert mockCommandService callCount
configuration
commandVariables Object
commandVariables
configurationResolverService configuration commandVariables result
assert result
assert mockCommandService callCount
configuration
commandVariables Object
commandVariables
configurationResolverService configuration commandVariables result
expected
assert Object result Object expected
Object result property
expectedProperty expected Record property
result property
assert result property expectedProperty
assert result property expectedProperty
assert mockCommandService callCount
configuration
commandVariables Object
commandVariables
configurationResolverService configuration commandVariables result
assert result
assert mockCommandService callCount
configuration
configurationResolverService workspace configuration result
assert result
assert mockCommandService callCount
configuration
configurationResolverService workspace configuration result
assert result
assert mockCommandService callCount
configuration
configurationResolverService workspace configuration result
assert result
assert mockCommandService callCount
configuration
configurationResolverService workspace configuration result
assert result
assert mockCommandService callCount
configuration
configurationResolverService configuration result
assert result
assert mockCommandService callCount
buildTask
variable
configuration
variable
configurationResolverService variable buildTask
configurationResolverService workspace configuration result
assert result
url
variable
configuration
configurationResolverService variable url
configurationResolverService workspace configuration result
assert result
env
configuration
resolvedResult configurationResolverService env configuration
assert resolvedResult
configuration
configurationResolverService workspace configuration result
platform isWindows
assert result
assert result
assert mockCommandService callCount
quickInputService
configuration
result configurationResolverService workspace configuration
assert result
_serviceBrand
callCount
Disposable None
Disposable None
commandId args
callCount
result
args length
args args value
result args value
result
_serviceBrand
resource options relative noPrefix
resource fsPath
resource
workspace IWorkspaceIdentifier IWorkspace options verbose Verbosity
scheme authority
scheme authority
formatter ResourceLabelFormatter IDisposable
formatter ResourceLabelFormatter IDisposable
onDidChangeFormatters Event IFormatterChangeEvent event
_serviceBrand
IPath
defaultUriScheme Schemas file
path
options preferLocal
options preferLocal
options preferLocal
uri
options preferLocal uri uri
resource basename
resource os platform OperatingSystem basename
resource arg2 platform OperatingSystem name
resolvedUserHome
override arg1 arg2
configuration
arg1
configuration
inputs
id
type
description
id
type
description
options
id
type
description
provide
password
id
type
command
args
value
configuration
override key overrides IConfigurationOverrides IConfigurationValue
value
defaultValue
userValue
overrideIdentifiers
expr ConfigurationResolverExpression
assert expr length
assert expr
expr ConfigurationResolverExpression value
unresolved expr
assert unresolved length
assert unresolved name
assert unresolved arg
expr ConfigurationResolverExpression value
unresolved expr
assert unresolved length
assert unresolved name
assert unresolved arg
expr ConfigurationResolverExpression
name
path
settings
value
array key
unresolved expr
assert unresolved length
assert unresolved r r name
expr ConfigurationResolverExpression
name
path
expr inner id name arg
expr inner id name arg
assert expr
name
path
expr ConfigurationResolverExpression
name
assert expr
name
expr ConfigurationResolverExpression
first
second
unresolved expr
assert unresolved length
assert unresolved name
assert unresolved arg
expr unresolved
assert expr
first
second
expr ConfigurationResolverExpression
unresolved expr
assert unresolved length
assert unresolved name
assert unresolved arg
expr unresolved
assert expr
expr ConfigurationResolverExpression
unresolved expr
assert unresolved length
expr id inner name arg
expr id inner name arg
assert expr
expr ConfigurationResolverExpression
unresolved expr
assert unresolved length
assert unresolved name
assert unresolved arg
expr ConfigurationResolverExpression
name
r expr
r arg
expr r
r arg
expr r
assert expr
name
expr ConfigurationResolverExpression
env
r expr
r arg
expr r
r arg
expr r
r arg
expr r
assert expr
env
expr ConfigurationResolverExpression
r expr
r arg
expr r
r expr
r arg
expr r
assert expr
,
}
from
'../../../../../base/common/platform.js'
;
import
{
}
from
'../../../../../base/common/types.js'
;
import
{
URI
}
from
'../../../../../base/common/uri.js'
;
import
{
}
from
'../../../../../base/test/common/utils.js'
;
import
{
}
from
'../../../../../editor/common/core/selection.js'
;
import
{
}
from
'../../../../../editor/common/editorCommon.js'
;
import
{
}
from
'../../../../../platform/commands/common/commands.js'
;
import
{
,
,
}
from
'../../../../../platform/configuration/common/configuration.js'
;
import
{
}
from
'../../../../../platform/configuration/test/common/testConfigurationService.js'
;
import
{
}
from
'../../../../../platform/extensions/common/extensions.js'
;
import
{
,
,
,
}
from
'../../../../../platform/label/common/label.js'
;
import
{
,
,
,
}
from
'../../../../../platform/workspace/common/workspace.js'
;
import
{
}
from
'../../../../../platform/workspace/test/common/testWorkspace.js'
;
import
{
,
}
from
'../../../../test/browser/workbenchTestServices.js'
;
import
{
,
,
}
from
'../../../../test/common/workbenchTestServices.js'
;
import
{
}
from
'../../../extensions/common/extensions.js'
;
import
{
}
from
'../../../path/common/pathService.js'
;
import
{
}
from
'../../browser/baseConfigurationResolverService.js'
;
import
{
}
from
'../../common/configurationResolver.js'
;
import
{
}
from
'../../common/configurationResolverExpression.js'
;
const
=
10
;
class
TestEditorServiceWithActiveEditor
extends
TestEditorService
{
get
activeTextEditorControl
(
)
:
any
{
return
{
getEditorType
(
)
{
return
.
;
}
,
getSelection
(
)
{
return
new
Selection
(
,
1
,
,
10
)
;
}
}
;
}
get
activeEditor
(
)
:
any
{
return
{
get
resource
(
)
:
any
{
return
URI
.
parse
(
'file:///VSCode/workspaceLocation/file'
)
;
}
}
;
}
}
class
TestConfigurationResolverService
extends
BaseConfigurationResolverService
{
}
const
=
{
getAppRoot
:
(
)
=>
undefined
,
getExecPath
:
(
)
=>
undefined
}
;
suite
(
'Configuration Resolver Service'
,
(
)
=>
{
let
:
|
null
;
const
:
{
[
:
string
]
:
string
}
=
{
:
'Value for key1'
,
:
'Value for key2'
}
;
let
:
;
let
:
;
let
:
;
let
:
;
let
:
;
let
:
;
let
:
;
let
:
;
const
=
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
setup
(
(
)
=>
{
=
new
MockCommandService
(
)
;
=
.
add
(
new
TestEditorServiceWithActiveEditor
(
)
)
;
=
new
TestQuickInputService
(
)
;
=
new
MockLabelService
(
)
;
=
new
MockPathService
(
)
;
=
new
TestExtensionService
(
)
;
=
testWorkspace
(
URI
.
parse
(
'file:///VSCode/workspaceLocation'
)
)
;
=
.
[
0
]
;
=
new
TestConfigurationResolverService
(
,
Promise
.
resolve
(
)
,
,
new
MockInputsConfigurationService
(
)
,
,
new
TestContextService
(
)
,
,
,
,
,
.
add
(
new
TestStorageService
(
)
)
)
;
}
)
;
teardown
(
(
)
=>
{
=
null
;
}
)
;
test
(
'substitute one'
,
async
(
)
=>
{
if
(
.
)
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'abc ${workspaceFolder} xyz'
)
,
'abc \\VSCode\\workspaceLocation xyz'
)
;
}
else
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'abc ${workspaceFolder} xyz'
)
,
'abc /VSCode/workspaceLocation xyz'
)
;
}
}
)
;
test
(
'does not preserve platform config even when not matched'
,
async
(
)
=>
{
const
=
{
:
'osx.sh'
,
:
{
:
'windows.exe'
}
,
:
{
:
'linux.sh'
}
}
;
const
:
any
=
await
!
.
resolveAsync
(
,
)
;
const
=
?
'windows.exe'
:
?
'osx.sh'
:
?
'linux.sh'
:
undefined
;
.
strictEqual
(
.
,
undefined
)
;
.
strictEqual
(
.
,
undefined
)
;
.
strictEqual
(
.
,
undefined
)
;
.
strictEqual
(
.
,
)
;
}
)
;
test
(
'apples platform specific config'
,
async
(
)
=>
{
const
=
?
'windows.exe'
:
?
'osx.sh'
:
?
'linux.sh'
:
undefined
;
const
=
{
:
{
:
'windows.exe'
}
,
:
{
:
'osx.sh'
}
,
:
{
:
'linux.sh'
}
}
;
const
=
JSON
.
stringify
(
)
;
const
:
any
=
await
!
.
resolveAsync
(
,
)
;
.
strictEqual
(
.
,
)
;
.
strictEqual
(
.
,
undefined
)
;
.
strictEqual
(
.
,
undefined
)
;
.
strictEqual
(
.
,
undefined
)
;
.
strictEqual
(
JSON
.
stringify
(
)
,
)
;
}
)
;
test
(
'workspace folder with argument'
,
async
(
)
=>
{
if
(
.
)
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'abc ${workspaceFolder:workspaceLocation} xyz'
)
,
'abc \\VSCode\\workspaceLocation xyz'
)
;
}
else
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'abc ${workspaceFolder:workspaceLocation} xyz'
)
,
'abc /VSCode/workspaceLocation xyz'
)
;
}
}
)
;
test
(
'workspace folder with invalid argument'
,
async
(
)
=>
{
await
.
rejects
(
async
(
)
=>
await
!
.
resolveAsync
(
,
'abc ${workspaceFolder:invalidLocation} xyz'
)
)
;
}
)
;
test
(
'workspace folder with undefined workspace folder'
,
async
(
)
=>
{
await
.
rejects
(
async
(
)
=>
await
!
.
resolveAsync
(
undefined
,
'abc ${workspaceFolder} xyz'
)
)
;
}
)
;
test
(
'workspace folder with argument and undefined workspace folder'
,
async
(
)
=>
{
if
(
.
)
{
.
strictEqual
(
await
!
.
resolveAsync
(
undefined
,
'abc ${workspaceFolder:workspaceLocation} xyz'
)
,
'abc \\VSCode\\workspaceLocation xyz'
)
;
}
else
{
.
strictEqual
(
await
!
.
resolveAsync
(
undefined
,
'abc ${workspaceFolder:workspaceLocation} xyz'
)
,
'abc /VSCode/workspaceLocation xyz'
)
;
}
}
)
;
test
(
'workspace folder with invalid argument and undefined workspace folder'
,
(
)
=>
{
.
rejects
(
async
(
)
=>
await
!
.
resolveAsync
(
undefined
,
'abc ${workspaceFolder:invalidLocation} xyz'
)
)
;
}
)
;
test
(
'workspace root folder name'
,
async
(
)
=>
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'abc ${workspaceRootFolderName} xyz'
)
,
'abc workspaceLocation xyz'
)
;
}
)
;
test
(
'current selected line number'
,
async
(
)
=>
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'abc ${lineNumber} xyz'
)
,
` abc ${ mockLineNumber} xyz `
)
;
}
)
;
test
(
'relative file'
,
async
(
)
=>
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'abc ${relativeFile} xyz'
)
,
'abc file xyz'
)
;
}
)
;
test
(
'relative file with argument'
,
async
(
)
=>
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'abc ${relativeFile:workspaceLocation} xyz'
)
,
'abc file xyz'
)
;
}
)
;
test
(
'relative file with invalid argument'
,
(
)
=>
{
.
rejects
(
async
(
)
=>
await
!
.
resolveAsync
(
,
'abc ${relativeFile:invalidLocation} xyz'
)
)
;
}
)
;
test
(
'relative file with undefined workspace folder'
,
async
(
)
=>
{
if
(
.
)
{
.
strictEqual
(
await
!
.
resolveAsync
(
undefined
,
'abc ${relativeFile} xyz'
)
,
'abc \\VSCode\\workspaceLocation\\file xyz'
)
;
}
else
{
.
strictEqual
(
await
!
.
resolveAsync
(
undefined
,
'abc ${relativeFile} xyz'
)
,
'abc /VSCode/workspaceLocation/file xyz'
)
;
}
}
)
;
test
(
'relative file with argument and undefined workspace folder'
,
async
(
)
=>
{
.
strictEqual
(
await
!
.
resolveAsync
(
undefined
,
'abc ${relativeFile:workspaceLocation} xyz'
)
,
'abc file xyz'
)
;
}
)
;
test
(
'relative file with invalid argument and undefined workspace folder'
,
(
)
=>
{
.
rejects
(
async
(
)
=>
await
!
.
resolveAsync
(
undefined
,
'abc ${relativeFile:invalidLocation} xyz'
)
)
;
}
)
;
test
(
'substitute many'
,
async
(
)
=>
{
if
(
.
)
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'${workspaceFolder} - ${workspaceFolder}'
)
,
'\\VSCode\\workspaceLocation - \\VSCode\\workspaceLocation'
)
;
}
else
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'${workspaceFolder} - ${workspaceFolder}'
)
,
'/VSCode/workspaceLocation - /VSCode/workspaceLocation'
)
;
}
}
)
;
test
(
'substitute one env variable'
,
async
(
)
=>
{
if
(
.
)
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'abc ${workspaceFolder} ${env:key1} xyz'
)
,
'abc \\VSCode\\workspaceLocation Value for key1 xyz'
)
;
}
else
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'abc ${workspaceFolder} ${env:key1} xyz'
)
,
'abc /VSCode/workspaceLocation Value for key1 xyz'
)
;
}
}
)
;
test
(
'substitute many env variable'
,
async
(
)
=>
{
if
(
.
)
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'${workspaceFolder} - ${workspaceFolder} ${env:key1} - ${env:key2}'
)
,
'\\VSCode\\workspaceLocation - \\VSCode\\workspaceLocation Value for key1 - Value for key2'
)
;
}
else
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'${workspaceFolder} - ${workspaceFolder} ${env:key1} - ${env:key2}'
)
,
'/VSCode/workspaceLocation - /VSCode/workspaceLocation Value for key1 - Value for key2'
)
;
}
}
)
;
test
(
'disallows nested keys (#77289)'
,
async
(
)
=>
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'${env:key1} ${env:key1${env:key2}}'
)
,
'Value for key1 '
)
;
}
)
;
test
(
'supports extensionDir'
,
async
(
)
=>
{
const
=
stub
(
,
'getExtension'
)
;
.
withArgs
(
'publisher.extId'
)
.
returns
(
Promise
.
resolve
(
{
:
URI
.
file
(
'/some/path'
)
}
as
)
)
;
.
strictEqual
(
await
!
.
resolveAsync
(
,
'${extensionInstallFolder:publisher.extId}'
)
,
URI
.
file
(
'/some/path'
)
.
)
;
}
)
;
test
(
'substitute one env variable using platform case sensitivity'
,
async
(
)
=>
{
if
(
.
)
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'${env:key1} - ${env:Key1}'
)
,
'Value for key1 - Value for key1'
)
;
}
else
{
.
strictEqual
(
await
!
.
resolveAsync
(
,
'${env:key1} - ${env:Key1}'
)
,
'Value for key1 - '
)
;
}
}
)
;
test
(
'substitute one configuration variable'
,
async
(
)
=>
{
const
:
=
new
TestConfigurationService
(
{
:
{
:
'foo'
}
,
:
{
:
{
:
'bar'
}
}
}
)
;
const
=
new
TestConfigurationResolverService
(
,
Promise
.
resolve
(
)
,
.
add
(
new
TestEditorServiceWithActiveEditor
(
)
)
,
,
,
new
TestContextService
(
)
,
,
,
,
,
.
add
(
new
TestStorageService
(
)
)
)
;
.
strictEqual
(
await
.
resolveAsync
(
,
'abc ${config:editor.fontFamily} xyz'
)
,
'abc foo xyz'
)
;
}
)
;
test
(
'inlines an array (#245718)'
,
async
(
)
=>
{
const
:
=
new
TestConfigurationService
(
{
:
{
:
[
'foo'
,
'bar'
]
}
,
}
)
;
const
=
new
TestConfigurationResolverService
(
,
Promise
.
resolve
(
)
,
.
add
(
new
TestEditorServiceWithActiveEditor
(
)
)
,
,
,
new
TestContextService
(
)
,
,
,
,
,
.
add
(
new
TestStorageService
(
)
)
)
;
.
strictEqual
(
await
.
resolveAsync
(
,
'abc ${config:editor.fontFamily} xyz'
)
,
'abc foo,bar xyz'
)
;
}
)
;
test
(
'substitute configuration variable with undefined workspace folder'
,
async
(
)
=>
{
const
:
=
new
TestConfigurationService
(
{
:
{
:
'foo'
}
}
)
;
const
=
new
TestConfigurationResolverService
(
,
Promise
.
resolve
(
)
,
.
add
(
new
TestEditorServiceWithActiveEditor
(
)
)
,
,
,
new
TestContextService
(
)
,
,
,
,
,
.
add
(
new
TestStorageService
(
)
)
)
;
.
strictEqual
(
await
.
resolveAsync
(
undefined
,
'abc ${config:editor.fontFamily} xyz'
)
,
'abc foo xyz'
)
;
}
)
;
test
(
'substitute many configuration variables'
,
async
(
)
=>
{
const
=
new
TestConfigurationService
(
{
:
{
:
'foo'
}
,
:
{
:
{
:
'bar'
}
}
}
)
;
const
=
new
TestConfigurationResolverService
(
,
Promise
.
resolve
(
)
,
.
add
(
new
TestEditorServiceWithActiveEditor
(
)
)
,
,
,
new
TestContextService
(
)
,
,
,
,
,
.
add
(
new
TestStorageService
(
)
)
)
;
.
strictEqual
(
await
.
resolveAsync
(
,
'abc ${config:editor.fontFamily} ${config:terminal.integrated.fontFamily} xyz'
)
,
'abc foo bar xyz'
)
;
}
)
;
test
(
'substitute one env variable and a configuration variable'
,
async
(
)
=>
{
const
=
new
TestConfigurationService
(
{
:
{
:
'foo'
}
,
:
{
:
{
:
'bar'
}
}
}
)
;
const
=
new
TestConfigurationResolverService
(
,
Promise
.
resolve
(
)
,
.
add
(
new
TestEditorServiceWithActiveEditor
(
)
)
,
,
,
new
TestContextService
(
)
,
,
,
,
,
.
add
(
new
TestStorageService
(
)
)
)
;
if
(
.
)
{
.
strictEqual
(
await
.
resolveAsync
(
,
'abc ${config:editor.fontFamily} ${workspaceFolder} ${env:key1} xyz'
)
,
'abc foo \\VSCode\\workspaceLocation Value for key1 xyz'
)
;
}
else
{
.
strictEqual
(
await
.
resolveAsync
(
,
'abc ${config:editor.fontFamily} ${workspaceFolder} ${env:key1} xyz'
)
,
'abc foo /VSCode/workspaceLocation Value for key1 xyz'
)
;
}
}
)
;
test
(
'recursively resolve variables'
,
async
(
)
=>
{
const
=
new
TestConfigurationService
(
{
:
'key1=${config:key2}'
,
:
'key2=${config:key3}'
,
:
'we did it!'
,
}
)
;
const
=
new
TestConfigurationResolverService
(
,
Promise
.
resolve
(
)
,
.
add
(
new
TestEditorServiceWithActiveEditor
(
)
)
,
,
,
new
TestContextService
(
)
,
,
,
,
,
.
add
(
new
TestStorageService
(
)
)
)
;
.
strictEqual
(
await
.
resolveAsync
(
,
'${config:key1}'
)
,
'key1=key2=we did it!'
)
;
}
)
;
test
(
'substitute many env variable and a configuration variable'
,
async
(
)
=>
{
const
=
new
TestConfigurationService
(
{
:
{
:
'foo'
}
,
:
{
:
{
:
'bar'
}
}
}
)
;
const
=
new
TestConfigurationResolverService
(
,
Promise
.
resolve
(
)
,
.
add
(
new
TestEditorServiceWithActiveEditor
(
)
)
,
,
,
new
TestContextService
(
)
,
,
,
,
,
.
add
(
new
TestStorageService
(
)
)
)
;
if
(
.
)
{
.
strictEqual
(
await
.
resolveAsync
(
,
'${config:editor.fontFamily} ${config:terminal.integrated.fontFamily} ${workspaceFolder} - ${workspaceFolder} ${env:key1} - ${env:key2}'
)
,
'foo bar \\VSCode\\workspaceLocation - \\VSCode\\workspaceLocation Value for key1 - Value for key2'
)
;
}
else
{
.
strictEqual
(
await
.
resolveAsync
(
,
'${config:editor.fontFamily} ${config:terminal.integrated.fontFamily} ${workspaceFolder} - ${workspaceFolder} ${env:key1} - ${env:key2}'
)
,
'foo bar /VSCode/workspaceLocation - /VSCode/workspaceLocation Value for key1 - Value for key2'
)
;
}
}
)
;
test
(
'mixed types of configuration variables'
,
async
(
)
=>
{
const
=
new
TestConfigurationService
(
{
:
{
:
'foo'
,
:
123
,
:
false
}
,
:
{
:
{
:
'bar'
}
}
,
:
{
:
[
{
:
[
'/myfile'
,
'/myOtherfile'
]
,
:
'schemaURL'
}
]
}
}
)
;
const
=
new
TestConfigurationResolverService
(
,
Promise
.
resolve
(
)
,
.
add
(
new
TestEditorServiceWithActiveEditor
(
)
)
,
,
,
new
TestContextService
(
)
,
,
,
,
,
.
add
(
new
TestStorageService
(
)
)
)
;
.
strictEqual
(
await
.
resolveAsync
(
,
'abc ${config:editor.fontFamily} ${config:editor.lineNumbers} ${config:editor.insertSpaces} xyz'
)
,
'abc foo 123 false xyz'
)
;
}
)
;
test
(
'uses original variable as fallback'
,
async
(
)
=>
{
const
=
new
TestConfigurationService
(
{
:
{
}
}
)
;
const
=
new
TestConfigurationResolverService
(
,
Promise
.
resolve
(
)
,
.
add
(
new
TestEditorServiceWithActiveEditor
(
)
)
,
,
,
new
TestContextService
(
)
,
,
,
,
,
.
add
(
new
TestStorageService
(
)
)
)
;
.
strictEqual
(
await
.
resolveAsync
(
,
'abc ${unknownVariable} xyz'
)
,
'abc ${unknownVariable} xyz'
)
;
.
strictEqual
(
await
.
resolveAsync
(
,
'abc ${env:unknownVariable} xyz'
)
,
'abc xyz'
)
;
}
)
;
test
(
'configuration variables with invalid accessor'
,
(
)
=>
{
const
=
new
TestConfigurationService
(
{
:
{
:
'foo'
}
}
)
;
const
=
new
TestConfigurationResolverService
(
,
Promise
.
resolve
(
)
,
.
add
(
new
TestEditorServiceWithActiveEditor
(
)
)
,
,
,
new
TestContextService
(
)
,
,
,
,
,
.
add
(
new
TestStorageService
(
)
)
)
;
.
rejects
(
async
(
)
=>
await
.
resolveAsync
(
,
'abc ${env} xyz'
)
)
;
.
rejects
(
async
(
)
=>
await
.
resolveAsync
(
,
'abc ${env:} xyz'
)
)
;
.
rejects
(
async
(
)
=>
await
.
resolveAsync
(
,
'abc ${config} xyz'
)
)
;
.
rejects
(
async
(
)
=>
await
.
resolveAsync
(
,
'abc ${config:} xyz'
)
)
;
.
rejects
(
async
(
)
=>
await
.
resolveAsync
(
,
'abc ${config:editor} xyz'
)
)
;
.
rejects
(
async
(
)
=>
await
.
resolveAsync
(
,
'abc ${config:editor..fontFamily} xyz'
)
)
;
.
rejects
(
async
(
)
=>
await
.
resolveAsync
(
,
'abc ${config:editor.none.none2} xyz'
)
)
;
}
)
;
test
(
'a single command variable'
,
(
)
=>
{
const
=
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'${command:command1}'
,
'port'
:
5858
,
'sourceMaps'
:
false
,
'outDir'
:
null
}
;
return
!
.
resolveWithInteractionReplace
(
undefined
,
)
.
then
(
=>
{
.
deepStrictEqual
(
{
...
}
,
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'command1-result'
,
'port'
:
5858
,
'sourceMaps'
:
false
,
'outDir'
:
null
}
)
;
.
strictEqual
(
1
,
.
)
;
}
)
;
}
)
;
test
(
'an old style command variable'
,
(
)
=>
{
const
=
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'${command:commandVariable1}'
,
'port'
:
5858
,
'sourceMaps'
:
false
,
'outDir'
:
null
}
;
const
=
.
create
(
null
)
;
[
'commandVariable1'
]
=
'command1'
;
return
!
.
resolveWithInteractionReplace
(
undefined
,
,
undefined
,
)
.
then
(
=>
{
.
deepStrictEqual
(
{
...
}
,
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'command1-result'
,
'port'
:
5858
,
'sourceMaps'
:
false
,
'outDir'
:
null
}
)
;
.
strictEqual
(
1
,
.
)
;
}
)
;
}
)
;
test
(
'multiple new and old-style command variables'
,
(
)
=>
{
const
=
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'${command:commandVariable1}'
,
'pid'
:
'${command:command2}'
,
'sourceMaps'
:
false
,
'outDir'
:
'src/${command:command2}'
,
'env'
:
{
'processId'
:
'__${command:command2}__'
,
}
}
;
const
=
.
create
(
null
)
;
[
'commandVariable1'
]
=
'command1'
;
return
!
.
resolveWithInteractionReplace
(
undefined
,
,
undefined
,
)
.
then
(
=>
{
const
=
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'command1-result'
,
'pid'
:
'command2-result'
,
'sourceMaps'
:
false
,
'outDir'
:
'src/command2-result'
,
'env'
:
{
'processId'
:
'__command2-result__'
,
}
}
;
.
deepStrictEqual
(
.
keys
(
)
,
.
keys
(
)
)
;
.
keys
(
)
.
forEach
(
=>
{
const
=
(
as
<
string
,
unknown
>
)
[
]
;
if
(
isObject
(
[
]
)
)
{
.
deepStrictEqual
(
{
...
[
]
}
,
)
;
}
else
{
.
deepStrictEqual
(
[
]
,
)
;
}
}
)
;
.
strictEqual
(
2
,
.
)
;
}
)
;
}
)
;
test
(
'a command variable that relies on resolved env vars'
,
(
)
=>
{
const
=
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'${command:commandVariable1}'
,
'value'
:
'${env:key1}'
}
;
const
=
.
create
(
null
)
;
[
'commandVariable1'
]
=
'command1'
;
return
!
.
resolveWithInteractionReplace
(
undefined
,
,
undefined
,
)
.
then
(
=>
{
.
deepStrictEqual
(
{
...
}
,
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'Value for key1'
,
'value'
:
'Value for key1'
}
)
;
.
strictEqual
(
1
,
.
)
;
}
)
;
}
)
;
test
(
'a single prompt input variable'
,
(
)
=>
{
const
=
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'${input:input1}'
,
'port'
:
5858
,
'sourceMaps'
:
false
,
'outDir'
:
null
}
;
return
!
.
resolveWithInteractionReplace
(
,
,
'tasks'
)
.
then
(
=>
{
.
deepStrictEqual
(
{
...
}
,
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'resolvedEnterinput1'
,
'port'
:
5858
,
'sourceMaps'
:
false
,
'outDir'
:
null
}
)
;
.
strictEqual
(
0
,
.
)
;
}
)
;
}
)
;
test
(
'a single pick input variable'
,
(
)
=>
{
const
=
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'${input:input2}'
,
'port'
:
5858
,
'sourceMaps'
:
false
,
'outDir'
:
null
}
;
return
!
.
resolveWithInteractionReplace
(
,
,
'tasks'
)
.
then
(
=>
{
.
deepStrictEqual
(
{
...
}
,
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'selectedPick'
,
'port'
:
5858
,
'sourceMaps'
:
false
,
'outDir'
:
null
}
)
;
.
strictEqual
(
0
,
.
)
;
}
)
;
}
)
;
test
(
'a single command input variable'
,
(
)
=>
{
const
=
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'${input:input4}'
,
'port'
:
5858
,
'sourceMaps'
:
false
,
'outDir'
:
null
}
;
return
!
.
resolveWithInteractionReplace
(
,
,
'tasks'
)
.
then
(
=>
{
.
deepStrictEqual
(
{
...
}
,
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'arg for command'
,
'port'
:
5858
,
'sourceMaps'
:
false
,
'outDir'
:
null
}
)
;
.
strictEqual
(
1
,
.
)
;
}
)
;
}
)
;
test
(
'several input variables and command'
,
(
)
=>
{
const
=
{
'name'
:
'${input:input3}'
,
'type'
:
'${command:command1}'
,
'request'
:
'${input:input1}'
,
'processId'
:
'${input:input2}'
,
'command'
:
'${input:input4}'
,
'port'
:
5858
,
'sourceMaps'
:
false
,
'outDir'
:
null
}
;
return
!
.
resolveWithInteractionReplace
(
,
,
'tasks'
)
.
then
(
=>
{
.
deepStrictEqual
(
{
...
}
,
{
'name'
:
'resolvedEnterinput3'
,
'type'
:
'command1-result'
,
'request'
:
'resolvedEnterinput1'
,
'processId'
:
'selectedPick'
,
'command'
:
'arg for command'
,
'port'
:
5858
,
'sourceMaps'
:
false
,
'outDir'
:
null
}
)
;
.
strictEqual
(
2
,
.
)
;
}
)
;
}
)
;
test
(
'input variable with undefined workspace folder'
,
(
)
=>
{
const
=
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'${input:input1}'
,
'port'
:
5858
,
'sourceMaps'
:
false
,
'outDir'
:
null
}
;
return
!
.
resolveWithInteractionReplace
(
undefined
,
,
'tasks'
)
.
then
(
=>
{
.
deepStrictEqual
(
{
...
}
,
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'resolvedEnterinput1'
,
'port'
:
5858
,
'sourceMaps'
:
false
,
'outDir'
:
null
}
)
;
.
strictEqual
(
0
,
.
)
;
}
)
;
}
)
;
test
(
'contributed variable'
,
(
)
=>
{
const
=
'npm: compile'
;
const
=
'defaultBuildTask'
;
const
=
{
'name'
:
'${'
+
+
'}'
,
}
;
!
.
contributeVariable
(
,
async
(
)
=>
{
return
;
}
)
;
return
!
.
resolveWithInteractionReplace
(
,
)
.
then
(
=>
{
.
deepStrictEqual
(
{
...
}
,
{
'name'
:
` ${ buildTask} `
}
)
;
}
)
;
}
)
;
test
(
'contributed taskVar variable'
,
(
)
=>
{
const
=
'http://localhost:5678'
;
const
=
'taskVar:componentExplorerUrl'
;
const
=
{
'url'
:
'${taskVar:componentExplorerUrl}/___explorer'
,
}
;
!
.
contributeVariable
(
,
async
(
)
=>
{
return
;
}
)
;
return
!
.
resolveWithInteractionReplace
(
,
)
.
then
(
=>
{
.
deepStrictEqual
(
{
...
}
,
{
'url'
:
` ${ url} /___explorer `
}
)
;
}
)
;
}
)
;
test
(
'resolveWithEnvironment'
,
async
(
)
=>
{
const
=
{
'VAR_1'
:
'VAL_1'
,
'VAR_2'
:
'VAL_2'
}
;
const
=
'echo ${env:VAR_1}${env:VAR_2}'
;
const
=
await
!
.
resolveWithEnvironment
(
{
...
}
,
undefined
,
)
;
.
deepStrictEqual
(
,
'echo VAL_1VAL_2'
)
;
}
)
;
test
(
'substitution in object key'
,
async
(
)
=>
{
const
=
{
'name'
:
'Test'
,
'mappings'
:
{
'pos1'
:
'value1'
,
'${workspaceFolder}/test1'
:
'${workspaceFolder}/test2'
,
'pos3'
:
'value3'
}
}
;
return
!
.
resolveWithInteractionReplace
(
,
,
'tasks'
)
.
then
(
=>
{
if
(
.
)
{
.
deepStrictEqual
(
{
...
}
,
{
'name'
:
'Test'
,
'mappings'
:
{
'pos1'
:
'value1'
,
'\\VSCode\\workspaceLocation/test1'
:
'\\VSCode\\workspaceLocation/test2'
,
'pos3'
:
'value3'
}
}
)
;
}
else
{
.
deepStrictEqual
(
{
...
}
,
{
'name'
:
'Test'
,
'mappings'
:
{
'pos1'
:
'value1'
,
'/VSCode/workspaceLocation/test1'
:
'/VSCode/workspaceLocation/test2'
,
'pos3'
:
'value3'
}
}
)
;
}
.
strictEqual
(
0
,
.
)
;
}
)
;
}
)
;
test
(
'canceled input'
,
async
(
)
=>
{
stub
(
,
'input'
)
.
resolves
(
undefined
)
;
const
=
{
'name'
:
'Attach to Process'
,
'type'
:
'node'
,
'request'
:
'attach'
,
'processId'
:
'${input:input1}'
,
'port'
:
5858
,
'sourceMaps'
:
false
,
'outDir'
:
null
}
;
const
=
await
!
.
resolveWithInteractionReplace
(
,
,
'tasks'
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
}
)
;
class
MockCommandService
implements
ICommandService
{
public
:
undefined
;
public
=
0
;
onWillExecuteCommand
=
(
)
=>
.
;
onDidExecuteCommand
=
(
)
=>
.
;
public
executeCommand
(
:
string
,
...
:
any
[
]
)
:
Promise
<
any
>
{
this
.
++
;
let
=
` ${ commandId} -result `
;
if
(
.
>=
1
)
{
if
(
[
0
]
&&
[
0
]
.
)
{
=
[
0
]
.
;
}
}
return
Promise
.
resolve
(
)
;
}
}
class
MockLabelService
implements
ILabelService
{
:
undefined
;
getUriHome
(
)
:
undefined
{
return
undefined
;
}
getUriLabel
(
:
URI
,
?
:
{
?
:
boolean
|
undefined
;
?
:
boolean
|
undefined
}
)
:
string
{
return
normalize
(
.
)
;
}
getUriBasenameLabel
(
:
URI
)
:
string
{
throw
new
Error
(
'Method not implemented.'
)
;
}
getWorkspaceLabel
(
:
URI
|
|
,
?
:
{
:
}
)
:
string
{
throw
new
Error
(
'Method not implemented.'
)
;
}
getHostLabel
(
:
string
,
?
:
string
)
:
string
{
throw
new
Error
(
'Method not implemented.'
)
;
}
public
getHostTooltip
(
)
:
string
|
undefined
{
throw
new
Error
(
'Method not implemented.'
)
;
}
getSeparator
(
:
string
,
?
:
string
)
:
'/'
|
'\\'
{
throw
new
Error
(
'Method not implemented.'
)
;
}
registerFormatter
(
:
)
:
{
throw
new
Error
(
'Method not implemented.'
)
;
}
registerCachedFormatter
(
:
)
:
{
throw
new
Error
(
'Method not implemented.'
)
;
}
readonly
:
<
>
=
new
Emitter< IFormatterChangeEvent>
(
)
.
;
}
class
MockPathService
implements
IPathService
{
:
undefined
;
get
path
(
)
:
Promise
<
>
{
throw
new
Error
(
'Property not implemented'
)
;
}
:
string
=
.
;
fileURI
(
:
string
)
:
Promise
<
URI
>
{
throw
new
Error
(
'Method not implemented.'
)
;
}
userHome
(
?
:
{
:
boolean
}
)
:
Promise
<
URI
>
;
userHome
(
:
{
:
true
}
)
:
URI
;
userHome
(
?
:
{
:
boolean
}
)
:
Promise
<
URI
>
|
URI
{
const
=
URI
.
file
(
'c:\\users\\username'
)
;
return
?.
?
:
Promise
.
resolve
(
)
;
}
hasValidBasename
(
:
URI
,
?
:
string
)
:
Promise
<
boolean
>
;
hasValidBasename
(
:
URI
,
:
.
,
?
:
string
)
:
boolean
;
hasValidBasename
(
:
URI
,
?
:
string
|
.
,
?
:
string
)
:
boolean
|
Promise
<
boolean
>
{
throw
new
Error
(
'Method not implemented.'
)
;
}
:
URI
|
undefined
;
}
class
MockInputsConfigurationService
extends
TestConfigurationService
{
public
getValue
(
?
:
any
,
?
:
any
)
:
any
{
let
;
if
(
===
'tasks'
)
{
=
{
:
[
{
:
'input1'
,
:
'promptString'
,
:
'Enterinput1'
,
default
:
'default input1'
}
,
{
:
'input2'
,
:
'pickString'
,
:
'Enterinput1'
,
default
:
'option2'
,
:
[
'option1'
,
'option2'
,
'option3'
]
}
,
{
:
'input3'
,
:
'promptString'
,
:
'Enterinput3'
,
default
:
'default input3'
,
:
true
,
:
true
}
,
{
:
'input4'
,
:
'command'
,
:
'command1'
,
:
{
:
'arg for command'
}
}
]
}
;
}
return
;
}
public
inspect < T >
(
:
string
,
?
:
)
:
<
T
>
{
return
{
:
undefined
,
:
undefined
,
:
undefined
,
:
[
]
}
;
}
}
suite
(
'ConfigurationResolverExpression'
,
(
)
=>
{
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
test
(
'parse empty object'
,
(
)
=>
{
const
=
.
parse
(
{
}
)
;
.
strictEqual
(
Array
.
from
(
.
unresolved
(
)
)
.
,
0
)
;
.
deepStrictEqual
(
.
toObject
(
)
,
{
}
)
;
}
)
;
test
(
'parse simple string'
,
(
)
=>
{
const
=
.
parse
(
{
:
'${env:HOME}'
}
)
;
const
=
Array
.
from
(
.
unresolved
(
)
)
;
.
strictEqual
(
.
,
1
)
;
.
strictEqual
(
[
0
]
.
,
'env'
)
;
.
strictEqual
(
[
0
]
.
,
'HOME'
)
;
}
)
;
test
(
'parse string with argument and colon'
,
(
)
=>
{
const
=
.
parse
(
{
:
'${config:path:to:value}'
}
)
;
const
=
Array
.
from
(
.
unresolved
(
)
)
;
.
strictEqual
(
.
,
1
)
;
.
strictEqual
(
[
0
]
.
,
'config'
)
;
.
strictEqual
(
[
0
]
.
,
'path:to:value'
)
;
}
)
;
test
(
'parse object with nested variables'
,
(
)
=>
{
const
=
.
parse
(
{
:
'${env:USERNAME}'
,
:
'${env:HOME}/folder'
,
:
{
:
'${config:path}'
}
,
:
[
'${env:TERM}'
,
{
:
'${env:KEY}'
}
]
}
)
;
const
=
Array
.
from
(
.
unresolved
(
)
)
;
.
strictEqual
(
.
,
5
)
;
.
deepStrictEqual
(
.
map
(
=>
.
)
.
sort
(
)
,
[
'config'
,
'env'
,
'env'
,
'env'
,
'env'
]
)
;
}
)
;
test
(
'resolve and get result'
,
(
)
=>
{
const
=
.
parse
(
{
:
'${env:USERNAME}'
,
:
'${env:HOME}/folder'
}
)
;
.
resolve
(
{
:
'env:USERNAME'
,
:
'${env:USERNAME}'
,
:
'env'
,
:
'USERNAME'
}
,
'testuser'
)
;
.
resolve
(
{
:
'env:HOME'
,
:
'${env:HOME}'
,
:
'env'
,
:
'HOME'
}
,
'/home/testuser'
)
;
.
deepStrictEqual
(
.
toObject
(
)
,
{
:
'testuser'
,
:
'/home/testuser/folder'
}
)
;
}
)
;
test
(
'keeps unresolved variables'
,
(
)
=>
{
const
=
.
parse
(
{
:
'${env:USERNAME}'
}
)
;
.
deepStrictEqual
(
.
toObject
(
)
,
{
:
'${env:USERNAME}'
}
)
;
}
)
;
test
(
'deduplicates identical variables'
,
(
)
=>
{
const
=
.
parse
(
{
:
'${env:HOME}'
,
:
'${env:HOME}'
}
)
;
const
=
Array
.
from
(
.
unresolved
(
)
)
;
.
strictEqual
(
.
,
1
)
;
.
strictEqual
(
[
0
]
.
,
'env'
)
;
.
strictEqual
(
[
0
]
.
,
'HOME'
)
;
.
resolve
(
[
0
]
,
'/home/user'
)
;
.
deepStrictEqual
(
.
toObject
(
)
,
{
:
'/home/user'
,
:
'/home/user'
}
)
;
}
)
;
test
(
'handles root string value'
,
(
)
=>
{
const
=
.
parse
(
'abc ${env:HOME} xyz'
)
;
const
=
Array
.
from
(
.
unresolved
(
)
)
;
.
strictEqual
(
.
,
1
)
;
.
strictEqual
(
[
0
]
.
,
'env'
)
;
.
strictEqual
(
[
0
]
.
,
'HOME'
)
;
.
resolve
(
[
0
]
,
'/home/user'
)
;
.
strictEqual
(
.
toObject
(
)
,
'abc /home/user xyz'
)
;
}
)
;
test
(
'handles root string value with multiple variables'
,
(
)
=>
{
const
=
.
parse
(
'${env:HOME}/folder${env:SHELL}'
)
;
const
=
Array
.
from
(
.
unresolved
(
)
)
;
.
strictEqual
(
.
,
2
)
;
.
resolve
(
{
:
'${env:HOME}'
,
:
'env:HOME'
,
:
'env'
,
:
'HOME'
}
,
'/home/user'
)
;
.
resolve
(
{
:
'${env:SHELL}'
,
:
'env:SHELL'
,
:
'env'
,
:
'SHELL'
}
,
'/bin/bash'
)
;
.
strictEqual
(
.
toObject
(
)
,
'/home/user/folder/bin/bash'
)
;
}
)
;
test
(
'handles root string with escaped variables'
,
(
)
=>
{
const
=
.
parse
(
'abc ${env:HOME${env:USER}} xyz'
)
;
const
=
Array
.
from
(
.
unresolved
(
)
)
;
.
strictEqual
(
.
,
1
)
;
.
strictEqual
(
[
0
]
.
,
'env'
)
;
.
strictEqual
(
[
0
]
.
,
'HOME${env:USER}'
)
;
}
)
;
test
(
'resolves nested values'
,
(
)
=>
{
const
=
.
parse
(
{
:
'${env:REDIRECTED}'
,
'key that is ${env:REDIRECTED}'
:
'cool!'
,
}
)
;
for
(
const
of
.
unresolved
(
)
)
{
if
(
.
===
'REDIRECTED'
)
{
.
resolve
(
,
'username: ${env:USERNAME}'
)
;
}
else
if
(
.
===
'USERNAME'
)
{
.
resolve
(
,
'testuser'
)
;
}
}
.
deepStrictEqual
(
.
toObject
(
)
,
{
:
'username: testuser'
,
'key that is username: testuser'
:
'cool!'
}
)
;
}
)
;
test
(
'resolves nested values 2 (#245798)'
,
(
)
=>
{
const
=
.
parse
(
{
:
{
SITE
:
'${input:site}'
,
TLD
:
'${input:tld}'
,
HOST
:
'${input:host}'
,
}
,
}
)
;
for
(
const
of
.
unresolved
(
)
)
{
if
(
.
===
'site'
)
{
.
resolve
(
,
'example'
)
;
}
else
if
(
.
===
'tld'
)
{
.
resolve
(
,
'com'
)
;
}
else
if
(
.
===
'host'
)
{
.
resolve
(
,
'local.${input:site}.${input:tld}'
)
;
}
}
.
deepStrictEqual
(
.
toObject
(
)
,
{
:
{
SITE
:
'example'
,
TLD
:
'com'
,
HOST
:
'local.example.com'
}
}
)
;
}
)
;
test
(
'out-of-order key resolution (#248550)'
,
(
)
=>
{
const
=
.
parse
(
{
'${input:key}'
:
'${input:value}'
,
}
)
;
for
(
const
of
.
unresolved
(
)
)
{
if
(
.
===
'key'
)
{
.
resolve
(
,
'the-key'
)
;
}
}
for
(
const
of
.
unresolved
(
)
)
{
if
(
.
===
'value'
)
{
.
resolve
(
,
'the-value'
)
;
}
}
.
deepStrictEqual
(
.
toObject
(
)
,
{
'the-key'
:
'the-value'
}
)
;
}
)
;
}
)
;