ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / copilot / src / extension / linkify / test / node / filePathLinkifier.spec.ts 351 строк · изменён 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
import { suite, test } from 'vitest' ;
import { isWindows } from '../../../../util/vs/base/common/platform' ;
import { URI } from '../../../../util/vs/base/common/uri' ;
import { PromptReference } from '../../../prompt/common/conversation' ;
import { LinkifyLocationAnchor } from '../../common/linkifiedText' ;
import { assertPartsEqual, createMultiRootLinkifierService, createTestLinkifierService, linkify, workspaceFile } from './util' ;
suite ( 'File Path Linkifier' ,
linkifier
linkifier
parts
linkifier
parts
linkifier
linkifier
parts
linkifier
linkifier
parts
linkifier
linkifier
parts
linkifier
linkifier
parts
linkifier
linkifier
parts
linkifier
linkifier
parts
linkifier
linkifier
parts
linkifier
result linkifier
result parts
isFile isWindows
noFile isWindows
linkifier
isFile
linkifier
parts
isFile
linkifier
linkifier
parts
linkifier
linkifier
parts
linkifier
parts
linkifier
references
result linkifier
references
result parts
linkifier
refUri
references refUri
result linkifier
references
result parts
refUri
linkifier
refUri
references refUri
result linkifier
references
result parts
linkifier
linkifier parts
linkifier
linkifier parts
rootA
rootB
linkifier
rootA rootB
rootA rootB
linkifier parts
rootA
rootB
linkifier
rootA rootB
rootB
linkifier parts
rootB
(
)
=>
{
test
(
` Should create file links from Markdown links `
,
async
(
)
=>
{
const
=
createTestLinkifierService
(
'file.ts'
,
'src/file.ts'
)
;
assertPartsEqual
(
(
await
linkify
(
,
'[file.ts](file.ts) [src/file.ts](src/file.ts)'
,
)
)
.
,
[
new
LinkifyLocationAnchor
(
workspaceFile
(
'file.ts'
)
)
,
` `
,
new
LinkifyLocationAnchor
(
workspaceFile
(
'src/file.ts'
)
)
]
,
)
;
assertPartsEqual
(
(
await
linkify
(
,
'[`file.ts`](file.ts) [`src/file.ts`](src/file.ts)'
,
)
)
.
,
[
new
LinkifyLocationAnchor
(
workspaceFile
(
'file.ts'
)
)
,
` `
,
new
LinkifyLocationAnchor
(
workspaceFile
(
'src/file.ts'
)
)
]
)
;
}
)
;
test
(
` Should create links for directories `
,
async
(
)
=>
{
{
const
=
createTestLinkifierService
(
'dir/'
)
;
assertPartsEqual
(
(
await
linkify
(
,
'[dir](dir) [dir/](dir/)'
,
)
)
.
,
[
new
LinkifyLocationAnchor
(
workspaceFile
(
'dir'
)
)
,
` `
,
new
LinkifyLocationAnchor
(
workspaceFile
(
'dir/'
)
)
]
)
;
}
{
const
=
createTestLinkifierService
(
'dir1/dir2/'
)
;
assertPartsEqual
(
(
await
linkify
(
,
'[dir1/dir2](dir1/dir2) [dir1/dir2/](dir1/dir2/)'
,
)
)
.
,
[
new
LinkifyLocationAnchor
(
workspaceFile
(
'dir1/dir2'
)
)
,
` `
,
new
LinkifyLocationAnchor
(
workspaceFile
(
'dir1/dir2/'
)
)
]
)
;
}
}
)
;
test
(
` Should create file links for file paths as inline code `
,
async
(
)
=>
{
const
=
createTestLinkifierService
(
'file.ts'
,
'src/file.ts'
,
)
;
assertPartsEqual
(
(
await
linkify
(
,
'`file.ts` `src/file.ts`'
,
)
)
.
,
[
new
LinkifyLocationAnchor
(
workspaceFile
(
'file.ts'
)
)
,
` `
,
new
LinkifyLocationAnchor
(
workspaceFile
(
'src/file.ts'
)
)
]
)
;
}
)
;
test
(
` Should create file paths printed as plain text `
,
async
(
)
=>
{
const
=
createTestLinkifierService
(
'file.ts'
,
'src/file.ts'
,
)
;
assertPartsEqual
(
(
await
linkify
(
,
'file.ts src/file.ts'
)
)
.
,
[
new
LinkifyLocationAnchor
(
workspaceFile
(
'file.ts'
)
)
,
` `
,
new
LinkifyLocationAnchor
(
workspaceFile
(
'src/file.ts'
)
)
]
)
;
}
)
;
test
(
` Should de-linkify files that don't exist `
,
async
(
)
=>
{
const
=
createTestLinkifierService
(
)
;
assertPartsEqual
(
(
await
linkify
(
,
'[noSuchFile.ts](noSuchFile.ts) [src/noSuchFile.ts](src/noSuchFile.ts)'
,
)
)
.
,
[
'noSuchFile.ts src/noSuchFile.ts'
]
,
)
;
}
)
;
test
(
` Should de-linkify bare file links that haven't been transformed `
,
async
(
)
=>
{
const
=
createTestLinkifierService
(
'file.ts'
,
'src/file.ts'
,
)
;
assertPartsEqual
(
(
await
linkify
(
,
'[text](file.ts) [`symbol` foo](src/file.ts)'
)
)
.
,
[
'text `symbol` foo'
,
]
)
;
}
)
;
test
(
` Should not create links for https links `
,
async
(
)
=>
{
const
=
createTestLinkifierService
(
)
;
assertPartsEqual
(
(
await
linkify
(
,
'[http://example.com](http://example.com)'
,
)
)
.
,
[
'[http://example.com](http://example.com)'
,
]
,
)
;
}
)
;
test
(
` Should handle file paths with spaces in the name `
,
async
(
)
=>
{
const
=
createTestLinkifierService
(
` space file.ts `
,
'sub space/space file.ts'
,
)
;
const
=
await
linkify
(
,
[
'[space file.ts](space%20file.ts)'
,
'[sub space/space file.ts](sub%20space/space%20file.ts)'
,
'[no such file.ts](no%20such%20file.ts)'
,
'[also not.ts](no%20such%20file.ts)'
,
]
.
join
(
'\n'
)
)
;
assertPartsEqual
(
.
,
[
new
LinkifyLocationAnchor
(
workspaceFile
(
'space file.ts'
)
)
,
` \n `
,
new
LinkifyLocationAnchor
(
workspaceFile
(
'sub space/space file.ts'
)
)
,
'\nno such file.ts\nalso not.ts'
,
]
)
;
}
)
;
test
(
` Should handle posix style absolute paths `
,
async
(
)
=>
{
const
=
URI
.
file
(
?
'c:\\foo\\isfile.ts'
:
'/foo/isfile.ts'
)
;
const
=
URI
.
file
(
?
'c:\\foo\\nofile.ts'
:
'/foo/nofile.ts'
)
;
const
=
createTestLinkifierService
(
)
;
assertPartsEqual
(
(
await
linkify
(
,
[
` \` ${ isFile. fsPath} \` `
,
` \` ${ noFile. fsPath} \` `
,
]
.
join
(
'\n'
)
)
)
.
,
[
new
LinkifyLocationAnchor
(
)
,
` \n\` ${ noFile. fsPath} \` `
,
]
)
;
}
)
;
test
(
` Should not linkify some common ambagious short paths `
,
async
(
)
=>
{
const
=
createTestLinkifierService
(
)
;
assertPartsEqual
(
(
await
linkify
(
,
[
'- `.`'
,
'- `..`'
,
'- `/.`'
,
'- `\\.`'
,
'- `/..`'
,
'- `\\..`'
,
'- `/`'
,
'- `\\`'
,
'- `/`'
,
'- `//`'
,
'- `///`'
,
]
.
join
(
'\n'
)
)
)
.
,
[
[
'- `.`'
,
'- `..`'
,
'- `/.`'
,
'- `\\.`'
,
'- `/..`'
,
'- `\\..`'
,
'- `/`'
,
'- `\\`'
,
'- `/`'
,
'- `//`'
,
'- `///`'
,
]
.
join
(
'\n'
)
]
)
;
}
)
;
test
(
` Should find file links in bold elements `
,
async
(
)
=>
{
const
=
createTestLinkifierService
(
'file.ts'
,
'src/file.ts'
)
;
assertPartsEqual
(
(
await
linkify
(
,
'**file.ts**'
,
)
)
.
,
[
` ** `
,
new
LinkifyLocationAnchor
(
workspaceFile
(
'file.ts'
)
)
,
` ** `
,
]
,
)
;
assertPartsEqual
(
(
await
linkify
(
,
'**`file.ts`**'
,
)
)
.
,
[
` ** `
,
new
LinkifyLocationAnchor
(
workspaceFile
(
'file.ts'
)
)
,
` ** `
,
]
,
)
;
}
)
;
test
(
` Should NOT use reference fallback for paths with directory components `
,
async
(
)
=>
{
const
=
createTestLinkifierService
(
)
;
const
=
[
new
PromptReference
(
URI
.
file
(
'/workspace/src/cli.js'
)
)
]
;
const
=
await
linkify
(
,
'./node_modules/playwright/cli.js'
,
)
;
assertPartsEqual
(
.
,
[
'./node_modules/playwright/cli.js'
]
)
;
}
)
;
test
(
` Should use reference fallback for simple filenames `
,
async
(
)
=>
{
const
=
createTestLinkifierService
(
)
;
const
=
URI
.
file
(
'/workspace/src/cli.js'
)
;
const
=
[
new
PromptReference
(
)
]
;
const
=
await
linkify
(
,
'cli.js'
,
)
;
assertPartsEqual
(
.
,
[
new
LinkifyLocationAnchor
(
)
]
)
;
}
)
;
test
(
` Should NOT use reference fallback for text with code-like characters `
,
async
(
)
=>
{
const
=
createTestLinkifierService
(
)
;
const
=
URI
.
file
(
'/workspace/src/config.js'
)
;
const
=
[
new
PromptReference
(
)
]
;
const
=
await
linkify
(
,
'config.${TerminalSettingId'
,
)
;
assertPartsEqual
(
.
,
[
'config.${TerminalSettingId'
]
)
;
}
)
;
test
(
` Should not linkify bare words that merely share a name with a folder `
,
async
(
)
=>
{
const
=
createTestLinkifierService
(
'web/'
,
'FooBar/'
)
;
assertPartsEqual
(
(
await
linkify
(
,
'Discussed `web` and `FooBar` today.'
)
)
.
,
[
'Discussed `web` and `FooBar` today.'
]
)
;
}
)
;
test
(
` Should still linkify bare words that name a file `
,
async
(
)
=>
{
const
=
createTestLinkifierService
(
'Makefile'
)
;
assertPartsEqual
(
(
await
linkify
(
,
'`Makefile`'
)
)
.
,
[
new
LinkifyLocationAnchor
(
workspaceFile
(
'Makefile'
)
)
]
)
;
}
)
;
test
(
` Should not linkify a path that exists in more than one workspace root `
,
async
(
)
=>
{
const
=
URI
.
file
(
'/repos/a'
)
;
const
=
URI
.
file
(
'/repos/b'
)
;
const
=
createMultiRootLinkifierService
(
[
,
]
,
[
URI
.
joinPath
(
,
'src/file.ts'
)
,
URI
.
joinPath
(
,
'src/file.ts'
)
]
)
;
assertPartsEqual
(
(
await
linkify
(
,
'`src/file.ts`'
)
)
.
,
[
'`src/file.ts`'
]
)
;
}
)
;
test
(
` Should linkify a path that exists in exactly one workspace root `
,
async
(
)
=>
{
const
=
URI
.
file
(
'/repos/a'
)
;
const
=
URI
.
file
(
'/repos/b'
)
;
const
=
createMultiRootLinkifierService
(
[
,
]
,
[
URI
.
joinPath
(
,
'src/only.ts'
)
]
)
;
assertPartsEqual
(
(
await
linkify
(
,
'`src/only.ts`'
)
)
.
,
[
new
LinkifyLocationAnchor
(
URI
.
joinPath
(
,
'src/only.ts'
)
)
]
)
;
}
)
;
}
)
;