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 / configuration / test / browser / configuration.test.ts 166 строк · изменён 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
import assert from 'assert' ;
import { Event } from '../../../../../base/common/event.js' ;
import { joinPath } from '../../../../../base/common/resources.js' ;
import { URI } from '../../../../../base/common/uri.js' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../base/test/common/utils.js' ;
import { Extensions, IConfigurationRegistry } from '../../../../../platform/configuration/common/configurationRegistry.js' ;
import { NullLogService } from '../../../../../platform/log/common/log.js' ;
import { Registry
DefaultConfiguration
ConfigurationKey IConfigurationCache
BrowserWorkbenchEnvironmentService
TestEnvironmentService
TestProductService
cache
resource
type key ConfigurationKey cache
type key ConfigurationKey content cache content
type key ConfigurationKey cache
disposables
configurationRegistry Registry Extensions Configuration
cacheKey ConfigurationKey type key
configurationCache ConfigurationCache
configurationCache
configurationRegistry
configurationRegistry configurationRegistry
configurationRegistry configurationRegistry
environmentService scheme configurationDefaults TestProductService
testObject disposables configurationCache environmentService
testObject
assert testObject configurationModel
localStorage DefaultConfiguration
configurationCache cacheKey
testObject disposables configurationCache TestEnvironmentService
actual testObject
assert actual
assert testObject configurationModel
localStorage DefaultConfiguration
configurationCache cacheKey
testObject disposables configurationCache TestEnvironmentService
assert testObject configurationModel
environmentService scheme configurationDefaults TestProductService
localStorage DefaultConfiguration
configurationCache cacheKey
testObject disposables configurationCache environmentService
actual testObject
assert actual
localStorage DefaultConfiguration
configurationCache cacheKey
testObject disposables configurationCache TestEnvironmentService
testObject
promise Event testObject onDidChangeConfiguration
configurationRegistry
defaults actual promise
assert actual
localStorage DefaultConfiguration
configurationCache cacheKey
testObject disposables configurationCache TestEnvironmentService
testObject
actual testObject
assert actual
localStorage DefaultConfiguration
configurationCache cacheKey
testObject disposables configurationCache TestEnvironmentService
testObject
testObject
assert configurationCache cacheKey
testObject disposables configurationCache TestEnvironmentService
testObject
testObject
promise Event testObject onDidChangeConfiguration
configurationRegistry overrides
promise
actual configurationCache cacheKey
assert actual
testObject disposables configurationCache TestEnvironmentService
testObject
promise Event testObject onDidChangeConfiguration
configurationRegistry
promise
assert configurationCache cacheKey
}
from
'../../../../../platform/registry/common/platform.js'
;
import
{
}
from
'../../browser/configuration.js'
;
import
{
,
}
from
'../../common/configuration.js'
;
import
{
}
from
'../../../environment/browser/environmentService.js'
;
import
{
}
from
'../../../../test/browser/workbenchTestServices.js'
;
import
{
}
from
'../../../../test/common/workbenchTestServices.js'
;
class
ConfigurationCache
implements
IConfigurationCache
{
private
readonly
=
new
Map< string , string >
(
)
;
needsCaching
(
:
URI
)
:
boolean
{
return
false
;
}
async
read
(
{
,
}
:
)
:
Promise
<
string
>
{
return
this
.
.
get
(
` ${ type } : ${ key} `
)
||
''
;
}
async
write
(
{
,
}
:
,
:
string
)
:
Promise
<
void
>
{
this
.
.
set
(
` ${ type } : ${ key} `
,
)
;
}
async
remove
(
{
,
}
:
)
:
Promise
<
void
>
{
this
.
.
delete
(
` ${ type } : ${ key} `
)
;
}
}
suite
(
'DefaultConfiguration'
,
(
)
=>
{
const
=
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
const
=
.
as < IConfigurationRegistry>
(
.
)
;
const
:
=
{
:
'defaults'
,
:
'default-configurationDefaultsOverrides'
}
;
let
:
;
setup
(
(
)
=>
{
=
new
ConfigurationCache
(
)
;
.
registerConfiguration
(
{
'id'
:
'test.configurationDefaultsOverride'
,
'type'
:
'object'
,
'properties'
:
{
'test.configurationDefaultsOverride'
:
{
'type'
:
'string'
,
'default'
:
'defaultValue'
,
}
}
}
)
;
}
)
;
teardown
(
(
)
=>
{
.
deregisterConfigurations
(
.
getConfigurations
(
)
)
;
.
deregisterDefaultConfigurations
(
.
getRegisteredDefaultConfigurations
(
)
)
;
}
)
;
test
(
'configuration default overrides are read from environment'
,
async
(
)
=>
{
const
=
new
BrowserWorkbenchEnvironmentService
(
''
,
joinPath
(
URI
.
file
(
'tests'
)
.
with
(
{
:
'vscode-tests'
}
)
,
'logs'
)
,
{
:
{
'test.configurationDefaultsOverride'
:
'envOverrideValue'
}
}
,
)
;
const
=
.
add
(
new
DefaultConfiguration
(
'default'
,
,
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
.
deepStrictEqual
(
.
.
getValue
(
'test.configurationDefaultsOverride'
)
,
'envOverrideValue'
)
;
}
)
;
test
(
'configuration default overrides are read from cache'
,
async
(
)
=>
{
.
setItem
(
.
DEFAULT_OVERRIDES_CACHE_EXISTS_KEY
,
'yes'
)
;
await
.
write
(
,
JSON
.
stringify
(
{
'test.configurationDefaultsOverride'
:
'overrideValue'
}
)
)
;
const
=
.
add
(
new
DefaultConfiguration
(
'default'
,
,
,
new
NullLogService
(
)
)
)
;
const
=
await
.
initialize
(
)
;
.
deepStrictEqual
(
.
getValue
(
'test.configurationDefaultsOverride'
)
,
'overrideValue'
)
;
.
deepStrictEqual
(
.
.
getValue
(
'test.configurationDefaultsOverride'
)
,
'overrideValue'
)
;
}
)
;
test
(
'configuration default overrides are not read from cache when model is read before initialize'
,
async
(
)
=>
{
.
setItem
(
.
DEFAULT_OVERRIDES_CACHE_EXISTS_KEY
,
'yes'
)
;
await
.
write
(
,
JSON
.
stringify
(
{
'test.configurationDefaultsOverride'
:
'overrideValue'
}
)
)
;
const
=
.
add
(
new
DefaultConfiguration
(
'default'
,
,
,
new
NullLogService
(
)
)
)
;
.
deepStrictEqual
(
.
.
getValue
(
'test.configurationDefaultsOverride'
)
,
undefined
)
;
}
)
;
test
(
'configuration default overrides read from cache override environment'
,
async
(
)
=>
{
const
=
new
BrowserWorkbenchEnvironmentService
(
''
,
joinPath
(
URI
.
file
(
'tests'
)
.
with
(
{
:
'vscode-tests'
}
)
,
'logs'
)
,
{
:
{
'test.configurationDefaultsOverride'
:
'envOverrideValue'
}
}
,
)
;
.
setItem
(
.
DEFAULT_OVERRIDES_CACHE_EXISTS_KEY
,
'yes'
)
;
await
.
write
(
,
JSON
.
stringify
(
{
'test.configurationDefaultsOverride'
:
'overrideValue'
}
)
)
;
const
=
.
add
(
new
DefaultConfiguration
(
'default'
,
,
,
new
NullLogService
(
)
)
)
;
const
=
await
.
initialize
(
)
;
.
deepStrictEqual
(
.
getValue
(
'test.configurationDefaultsOverride'
)
,
'overrideValue'
)
;
}
)
;
test
(
'configuration default overrides are read from cache when default configuration changed'
,
async
(
)
=>
{
.
setItem
(
.
DEFAULT_OVERRIDES_CACHE_EXISTS_KEY
,
'yes'
)
;
await
.
write
(
,
JSON
.
stringify
(
{
'test.configurationDefaultsOverride'
:
'overrideValue'
}
)
)
;
const
=
.
add
(
new
DefaultConfiguration
(
'default'
,
,
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
const
=
.
toPromise
(
.
)
;
.
registerConfiguration
(
{
'id'
:
'test.configurationDefaultsOverride'
,
'type'
:
'object'
,
'properties'
:
{
'test.configurationDefaultsOverride1'
:
{
'type'
:
'string'
,
'default'
:
'defaultValue'
,
}
}
}
)
;
const
{
:
}
=
await
;
.
deepStrictEqual
(
.
getValue
(
'test.configurationDefaultsOverride'
)
,
'overrideValue'
)
;
}
)
;
test
(
'configuration default overrides are not read from cache after reload'
,
async
(
)
=>
{
.
setItem
(
.
DEFAULT_OVERRIDES_CACHE_EXISTS_KEY
,
'yes'
)
;
await
.
write
(
,
JSON
.
stringify
(
{
'test.configurationDefaultsOverride'
:
'overrideValue'
}
)
)
;
const
=
.
add
(
new
DefaultConfiguration
(
'default'
,
,
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
const
=
.
reload
(
)
;
.
deepStrictEqual
(
.
getValue
(
'test.configurationDefaultsOverride'
)
,
'defaultValue'
)
;
}
)
;
test
(
'cache is reset after reload'
,
async
(
)
=>
{
.
setItem
(
.
DEFAULT_OVERRIDES_CACHE_EXISTS_KEY
,
'yes'
)
;
await
.
write
(
,
JSON
.
stringify
(
{
'test.configurationDefaultsOverride'
:
'overrideValue'
}
)
)
;
const
=
.
add
(
new
DefaultConfiguration
(
'default'
,
,
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
.
reload
(
)
;
.
deepStrictEqual
(
await
.
read
(
)
,
''
)
;
}
)
;
test
(
'configuration default overrides are written in cache'
,
async
(
)
=>
{
const
=
.
add
(
new
DefaultConfiguration
(
'default'
,
,
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
.
reload
(
)
;
const
=
.
toPromise
(
.
)
;
.
registerDefaultConfigurations
(
[
{
:
{
'test.configurationDefaultsOverride'
:
'newoverrideValue'
}
}
]
)
;
await
;
const
=
JSON
.
parse
(
await
.
read
(
)
)
;
.
deepStrictEqual
(
,
{
'test.configurationDefaultsOverride'
:
'newoverrideValue'
}
)
;
}
)
;
test
(
'configuration default overrides are removed from cache if there are no overrides'
,
async
(
)
=>
{
const
=
.
add
(
new
DefaultConfiguration
(
'default'
,
,
,
new
NullLogService
(
)
)
)
;
await
.
initialize
(
)
;
const
=
.
toPromise
(
.
)
;
.
registerConfiguration
(
{
'id'
:
'test.configurationDefaultsOverride'
,
'type'
:
'object'
,
'properties'
:
{
'test.configurationDefaultsOverride1'
:
{
'type'
:
'string'
,
'default'
:
'defaultValue'
,
}
}
}
)
;
await
;
.
deepStrictEqual
(
await
.
read
(
)
,
''
)
;
}
)
;
}
)
;