ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / editor / contrib / inlineCompletions / test / browser / inlineEdits.test.ts 147 строк · изменён 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
import assert from 'assert' ;
import { timeout } from '../../../../../base/common/async.js' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../base/test/common/utils.js' ;
import { AnnotatedText, InlineEditContext, IWithAsyncTestCodeEditorAndInlineCompletionsModel, MockSearchReplaceCompletionsProvider, withAsyncTestCodeEditorAndInlineCompletionsModel } from './utils.js' ;
suite ( 'Inline Edits' , ( ) => {
ensureNoDisposablesAreLeakedInTestSuite ( ) ;
const val = new AnnotatedText ( `
ctx IWithAsyncTestCodeEditorAndInlineCompletionsModel provider MockSearchReplaceCompletionsProvider view InlineEditContext
provider
val value
fakeClock provider inlineSuggest enabled
ctx
view ctx model ctx editor
ctx store view
ctx provider view
context model editor editorViewModel provider view
provider
model
assert view
model
assert editor
context model editor editorViewModel provider view
provider
model
assert view
editor val
editorViewModel
assert view
editorViewModel
assert view
context model editor editorViewModel provider view
provider
model
assert view
editor val
editorViewModel
assert view
context model editor editorViewModel provider view
provider
model
assert view
editor val
editorViewModel
assert view
assert view
class Point {
constructor(public x: number, public y: number) {}
getLength2D(): number {
return↓ Math.sqrt(this.x * this.x + this.y * this.y↓);
}
getJson(): string {
return ↓Ü;
}
}
`
)
;
async
function
runTest
(
cb
:
(
:
,
:
,
:
)
=>
Promise
<
void
>
)
:
Promise
<
void
>
{
const
=
new
MockSearchReplaceCompletionsProvider
(
)
;
await
withAsyncTestCodeEditorAndInlineCompletionsModel
(
.
,
{
:
true
,
,
:
{
:
true
}
}
,
async
(
)
=>
{
const
=
new
InlineEditContext
(
.
,
.
)
;
.
.
add
(
)
;
await
cb
(
,
,
)
;
}
)
;
}
test
(
'Can Accept Inline Edit'
,
async
function
(
)
{
await
runTest
(
async
(
{
,
,
,
}
,
,
)
=>
{
.
add
(
` getLength2D(): number {
return Math.sqrt(this.x * this.x + this.y * this.y);
} `
,
` getLength3D(): number {
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
} `
)
;
await
.
trigger
(
)
;
await
timeout
(
10000
)
;
.
deepStrictEqual
(
.
getAndClearViewStates
(
)
,
(
[
undefined
,
'\n\tget❰Length2↦Length3❱D(): numbe...\n...y * this.y❰ + th...his.z❱);\n'
]
)
)
;
.
accept
(
)
;
.
deepStrictEqual
(
.
getValue
(
)
,
`
class Point {
constructor(public x: number, public y: number) {}
getLength3D(): number {
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
}
getJson(): string {
return Ü;
}
}
`
)
;
}
)
;
}
)
;
test
(
'Can Type Inline Edit'
,
async
function
(
)
{
await
runTest
(
async
(
{
,
,
,
}
,
,
)
=>
{
.
add
(
` getLength2D(): number {
return Math.sqrt(this.x * this.x + this.y * this.y);
} `
,
` getLength3D(): number {
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
} `
)
;
await
.
trigger
(
)
;
await
timeout
(
10000
)
;
.
deepStrictEqual
(
.
getAndClearViewStates
(
)
,
(
[
undefined
,
'\n\tget❰Length2↦Length3❱D(): numbe...\n...y * this.y❰ + th...his.z❱);\n'
]
)
)
;
.
setPosition
(
.
getMarkerPosition
(
1
)
)
;
.
type
(
' + t'
)
;
.
deepStrictEqual
(
.
getAndClearViewStates
(
)
,
(
[
'\n\tget❰Length2↦Length3❱D(): numbe...\n...this.y + t❰his.z...his.z❱);\n'
]
)
)
;
.
type
(
'his.z * this.z'
)
;
.
deepStrictEqual
(
.
getAndClearViewStates
(
)
,
(
[
'\n\tget❰Length2↦Length3❱D(): numbe...'
]
)
)
;
}
)
;
}
)
;
test
(
'Inline Edit Is Correctly Shifted When Typing'
,
async
function
(
)
{
await
runTest
(
async
(
{
,
,
,
}
,
,
)
=>
{
.
add
(
'Ü'
,
'{x: this.x, y: this.y}'
)
;
await
.
trigger
(
)
;
await
timeout
(
10000
)
;
.
deepStrictEqual
(
.
getAndClearViewStates
(
)
,
(
[
undefined
,
'...\n\t\treturn ❰Ü↦{x: t...is.y}❱;\n'
]
)
)
;
.
setPosition
(
.
getMarkerPosition
(
2
)
)
;
.
type
(
'{'
)
;
.
deepStrictEqual
(
.
getAndClearViewStates
(
)
,
(
[
'...\t\treturn {❰Ü↦x: th...is.y}❱;\n'
]
)
)
;
}
)
;
}
)
;
test
(
'Inline Edit Stays On Unrelated Edit'
,
async
function
(
)
{
await
runTest
(
async
(
{
,
,
,
}
,
,
)
=>
{
.
add
(
` getLength2D(): number {
return Math.sqrt(this.x * this.x + this.y * this.y);
} `
,
` getLength3D(): number {
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
} `
)
;
await
.
trigger
(
)
;
await
timeout
(
10000
)
;
.
deepStrictEqual
(
.
getAndClearViewStates
(
)
,
(
[
undefined
,
'\n\tget❰Length2↦Length3❱D(): numbe...\n...y * this.y❰ + th...his.z❱);\n'
]
)
)
;
.
setPosition
(
.
getMarkerPosition
(
0
)
)
;
.
type
(
'/* */'
)
;
.
deepStrictEqual
(
.
getAndClearViewStates
(
)
,
(
[
'\n\tget❰Length2↦Length3❱D(): numbe...\n...y * this.y❰ + th...his.z❱);\n'
]
)
)
;
await
timeout
(
10000
)
;
.
deepStrictEqual
(
.
getAndClearViewStates
(
)
,
(
[
undefined
]
)
)
;
}
)
;
}
)
;
}
)
;