ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / workbench / contrib / webview / test / browser / resourceLoading.test.ts 244 строк · изменён 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
import assert from 'assert' ;
import { isWindows } from '../../../../../base/common/platform.js' ;
import { URI } from '../../../../../base/common/uri.js' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../base/test/common/utils.js' ;
import { FileService } from '../../../../../platform/files/common/fileService.js' ;
import { TestInstantiationService } from '../../../../../platform/instantiation/test/common/instantiationServiceMock.js' ;
import { ILogService, NullLogService } from '../../../../../platform/log/common/log.js' ;
import { IUriIdentityService
UriIdentityService
getResourceToLoad
disposableStore
uriIdentityService IUriIdentityService
instantiationService disposableStore
instantiationService ILogService NullLogService
fileService disposableStore instantiationService ILogService
uriIdentityService instantiationService IUriIdentityService disposableStore fileService
root
resource
result resource root uriIdentityService
assert result resource
root
resource
result resource root uriIdentityService
assert result resource
root
resource
result resource root uriIdentityService
assert result
root
result root root uriIdentityService
assert result
root
resource
result resource root uriIdentityService
assert result
resource
result resource root uriIdentityService
assert result
root
resource
result resource root uriIdentityService
assert result resource
root
resource
result resource root uriIdentityService
assert result
isWindows suite skip suite
root
resource
result resource root uriIdentityService
assert result resource
root
resource
result resource root uriIdentityService
assert result resource
root
resource
result resource root uriIdentityService
assert result
root
resource
result resource root uriIdentityService
assert result
root scheme authority path
resource scheme authority path
result resource root uriIdentityService
assert result
root scheme authority path
resource scheme authority path
result resource root uriIdentityService
assert result
root scheme authority path
resource scheme authority path
result resource root uriIdentityService
assert result resource
root scheme path
resource scheme path
result resource root uriIdentityService
assert result
root scheme path
resource scheme path
result resource root uriIdentityService
assert result resource
root scheme authority path
resource scheme authority path
result resource root uriIdentityService
assert result
assert result scheme
assert result authority
assert result path
query result query
assert query requestResourcePath
root
resource fragment
result resource root uriIdentityService
assert result fragment
root
resource query
result resource root uriIdentityService
assert result query
root
resource fragment query
result resource root uriIdentityService
assert result fragment
assert result query
root
resource query
result resource root uriIdentityService
assert result
root
resource fragment
result resource root uriIdentityService
assert result
roots
resource
result resource roots uriIdentityService
assert result resource
roots
resource
result resource roots uriIdentityService
assert result
roots
resource
result resource roots uriIdentityService
assert result resource
resource
result resource uriIdentityService
assert result
}
from
'../../../../../platform/uriIdentity/common/uriIdentity.js'
;
import
{
}
from
'../../../../../platform/uriIdentity/common/uriIdentityService.js'
;
import
{
}
from
'../../browser/resourceLoading.js'
;
suite
(
'Webview Resource Loading - getResourceToLoad'
,
(
)
=>
{
const
=
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
let
:
;
setup
(
(
)
=>
{
const
=
.
add
(
new
TestInstantiationService
(
)
)
;
.
stub
(
,
)
;
const
=
.
add
(
new
FileService
(
.
get
(
)
)
)
;
=
.
stub
(
,
.
add
(
new
UriIdentityService
(
)
)
)
;
}
)
;
test
(
'Returns resource when file is under root'
,
(
)
=>
{
const
=
URI
.
file
(
'/home/user/project'
)
;
const
=
URI
.
file
(
'/home/user/project/file.txt'
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
?.
toString
(
)
,
.
toString
(
)
)
;
}
)
;
test
(
'Returns resource when file is in nested directory'
,
(
)
=>
{
const
=
URI
.
file
(
'/home/user/project'
)
;
const
=
URI
.
file
(
'/home/user/project/subdir/nested/file.txt'
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
?.
toString
(
)
,
.
toString
(
)
)
;
}
)
;
test
(
'Fails when file is outside root'
,
(
)
=>
{
const
=
URI
.
file
(
'/home/user/project'
)
;
const
=
URI
.
file
(
'/home/user/other/file.txt'
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'Fails when file is root'
,
(
)
=>
{
const
=
URI
.
file
(
'/home/user/project'
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'Fails when file is sibling of root directory'
,
(
)
=>
{
const
=
URI
.
file
(
'/home/user/project'
)
;
{
const
=
URI
.
file
(
'/home/user/projectOther/file.txt'
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
,
undefined
)
;
}
{
const
=
URI
.
file
(
'/home/user/project.txt'
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
,
undefined
)
;
}
}
)
;
test
(
'Returns resource when root ends with /'
,
(
)
=>
{
const
=
URI
.
file
(
'/home/user/project/'
)
;
const
=
URI
.
file
(
'/home/user/project/file.txt'
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
?.
toString
(
)
,
.
toString
(
)
)
;
}
)
;
test
(
'Fails for sibling when root ends with / '
,
(
)
=>
{
const
=
URI
.
file
(
'/home/user/project/'
)
;
const
=
URI
.
file
(
'/home/user/projectOther/file.txt'
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
(
!
?
.
:
)
(
'UNC paths'
,
(
)
=>
{
test
(
'Returns resource when file is under UNC root'
,
(
)
=>
{
const
=
URI
.
file
(
'\\\\server\\share\\folder'
)
;
const
=
URI
.
file
(
'\\\\server\\share\\folder\\file.txt'
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
?.
toString
(
)
,
.
toString
(
)
)
;
}
)
;
test
(
'Returns resource with case-insensitive comparison for UNC paths'
,
(
)
=>
{
const
=
URI
.
file
(
'\\\\SERVER\\SHARE\\folder'
)
;
const
=
URI
.
file
(
'\\\\server\\share\\folder\\file.txt'
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
?.
toString
(
)
,
.
toString
(
)
)
;
}
)
;
test
(
'Fails when file is outside UNC root'
,
(
)
=>
{
const
=
URI
.
file
(
'\\\\server\\share\\folder'
)
;
const
=
URI
.
file
(
'\\\\server\\share\\other\\file.txt'
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'Fails when UNC server differs'
,
(
)
=>
{
const
=
URI
.
file
(
'\\\\server1\\share\\folder'
)
;
const
=
URI
.
file
(
'\\\\server2\\share\\folder\\file.txt'
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
}
)
;
suite
(
'Different authorities'
,
(
)
=>
{
test
(
'Returns resource when authorities match'
,
(
)
=>
{
const
=
URI
.
from
(
{
:
'test-scheme'
,
:
'ssh-remote+myserver'
,
:
'/home/user/project'
}
)
;
const
=
URI
.
from
(
{
:
'test-scheme'
,
:
'ssh-remote+myserver'
,
:
'/home/user/project/file.txt'
}
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
ok
(
)
;
}
)
;
test
(
'Fails when authorities differ'
,
(
)
=>
{
const
=
URI
.
from
(
{
:
'test-scheme'
,
:
'ssh-remote+server1'
,
:
'/home/user/project'
}
)
;
const
=
URI
.
from
(
{
:
'test-scheme'
,
:
'ssh-remote+server2'
,
:
'/home/user/project/file.txt'
}
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'handles empty authority'
,
(
)
=>
{
const
=
URI
.
from
(
{
:
'test-scheme'
,
:
''
,
:
'/home/user/project'
}
)
;
const
=
URI
.
from
(
{
:
'test-scheme'
,
:
''
,
:
'/home/user/project/file.txt'
}
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
?.
toString
(
)
,
.
toString
(
)
)
;
}
)
;
}
)
;
suite
(
'Different schemes'
,
(
)
=>
{
test
(
'Fails when schemes differ'
,
(
)
=>
{
const
=
URI
.
from
(
{
:
'file'
,
:
'/home/user/project'
}
)
;
const
=
URI
.
from
(
{
:
'http'
,
:
'/home/user/project/file.txt'
}
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'Returns resource when schemes match'
,
(
)
=>
{
const
=
URI
.
from
(
{
:
'custom-scheme'
,
:
'/home/user/project'
}
)
;
const
=
URI
.
from
(
{
:
'custom-scheme'
,
:
'/home/user/project/file.txt'
}
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
?.
toString
(
)
,
.
toString
(
)
)
;
}
)
;
test
(
'normalizes vscode-remote scheme'
,
(
)
=>
{
const
=
URI
.
from
(
{
:
'vscode-remote'
,
:
'test'
,
:
'/home/user/project'
}
)
;
const
=
URI
.
from
(
{
:
'vscode-remote'
,
:
'test'
,
:
'/home/user/project/file.txt'
}
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
ok
(
)
;
.
strictEqual
(
.
,
'vscode-remote'
)
;
.
strictEqual
(
.
,
'test'
)
;
.
strictEqual
(
.
,
'/vscode-resource'
)
;
const
=
JSON
.
parse
(
.
)
;
.
strictEqual
(
.
,
'/home/user/project/file.txt'
)
;
}
)
;
}
)
;
suite
(
'Fragment and query strings'
,
(
)
=>
{
test
(
'preserves fragment in returned URI'
,
(
)
=>
{
const
=
URI
.
file
(
'/home/user/project'
)
;
const
=
URI
.
file
(
'/home/user/project/file.txt'
)
.
with
(
{
:
'section1'
}
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
?.
,
'section1'
)
;
}
)
;
test
(
'preserves query in returned URI'
,
(
)
=>
{
const
=
URI
.
file
(
'/home/user/project'
)
;
const
=
URI
.
file
(
'/home/user/project/file.txt'
)
.
with
(
{
:
'version=2'
}
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
?.
,
'version=2'
)
;
}
)
;
test
(
'preserves both fragment and query'
,
(
)
=>
{
const
=
URI
.
file
(
'/home/user/project'
)
;
const
=
URI
.
file
(
'/home/user/project/file.txt'
)
.
with
(
{
:
'section1'
,
:
'version=2'
}
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
?.
,
'section1'
)
;
.
strictEqual
(
?.
,
'version=2'
)
;
}
)
;
test
(
'still validates path containment with query params'
,
(
)
=>
{
const
=
URI
.
file
(
'/home/user/project'
)
;
const
=
URI
.
file
(
'/home/user/other/file.txt'
)
.
with
(
{
:
'version=2'
}
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'still validates path containment with fragment'
,
(
)
=>
{
const
=
URI
.
file
(
'/home/user/project'
)
;
const
=
URI
.
file
(
'/home/user/other/file.txt'
)
.
with
(
{
:
'section1'
}
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
}
)
;
suite
(
'Multiple roots'
,
(
)
=>
{
test
(
'Returns resource when file is under one of multiple roots'
,
(
)
=>
{
const
=
[
URI
.
file
(
'/home/user/project1'
)
,
URI
.
file
(
'/home/user/project2'
)
,
URI
.
file
(
'/home/user/project3'
)
]
;
const
=
URI
.
file
(
'/home/user/project2/file.txt'
)
;
const
=
getResourceToLoad
(
,
,
)
;
.
strictEqual
(
?.
toString
(
)
,
.
toString
(
)
)
;
}
)
;
test
(
'Fails when file is not under any root'
,
(
)
=>
{
const
=
[
URI
.
file
(
'/home/user/project1'
)
,
URI
.
file
(
'/home/user/project2'
)
]
;
const
=
URI
.
file
(
'/home/user/other/file.txt'
)
;
const
=
getResourceToLoad
(
,
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'Returns resource matching first valid root'
,
(
)
=>
{
const
=
[
URI
.
file
(
'/home/user/project'
)
,
URI
.
file
(
'/home/user/project/subdir'
)
]
;
const
=
URI
.
file
(
'/home/user/project/subdir/file.txt'
)
;
const
=
getResourceToLoad
(
,
,
)
;
.
strictEqual
(
?.
toString
(
)
,
.
toString
(
)
)
;
}
)
;
test
(
'handles empty roots array'
,
(
)
=>
{
const
=
URI
.
file
(
'/home/user/project/file.txt'
)
;
const
=
getResourceToLoad
(
,
[
]
,
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
}
)
;
}
)
;