ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / editor / test / browser / controller / textAreaState.test.ts 457 строк · изменён 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
import assert from 'assert' ;
import { Disposable } from '../../../../base/common/lifecycle.js' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js' ;
import { ITextAreaWrapper, TextAreaState } from '../../../browser/controller/editContext/textArea/textAreaEditContextState.js' ;
import { Range } from '../../../common/core/range.js' ;
import { Selection } from '../../../common/core/selection.js' ;
import { createTextModel } from '../../common/testTextModel.js' ;
import { SimplePagedScreenReaderStrategy }
_value
_selectionStart
_selectionEnd
_value
_selectionStart
_selectionEnd
_value
reason value
_value value
_selectionStart _value length
_selectionEnd _value length
_selectionStart
_selectionEnd
reason selectionStart selectionEnd
selectionStart
selectionStart
selectionStart _value length
selectionStart _value length
selectionEnd
selectionEnd
selectionEnd _value length
selectionEnd _value length
_selectionStart selectionStart
_selectionEnd selectionEnd
a TextAreaState b TextAreaState
a value b value
a selectionStart b selectionStart
a selectionEnd b selectionEnd
Range a selection b selection
a newlineCountBeforeSelection b newlineCountBeforeSelection
actual TextAreaState value selectionStart selectionEnd
desired value selectionStart selectionEnd
assert desired actual desired actual
textArea
textArea _value
textArea _selectionStart
textArea _selectionEnd
actual TextAreaState textArea
actual
assert actual value
assert actual selectionStart
actual actual
actual
textArea
textArea
textArea _value
textArea _selectionStart
textArea _selectionEnd
state
state textArea
assert textArea _value
assert textArea _selectionStart
assert textArea _selectionEnd
state
state textArea
assert textArea _value
assert textArea _selectionStart
assert textArea _selectionEnd
state
state textArea
assert textArea _value
assert textArea _selectionStart
assert textArea _selectionEnd
textArea
prevState TextAreaState value selectionStart selectionEnd couldBeEmojiInput expected expectedCharReplaceCnt
prevState prevState TextAreaState
textArea
textArea _value value
textArea _selectionStart selectionStart
textArea _selectionEnd selectionEnd
newState TextAreaState textArea
actual TextAreaState prevState newState couldBeEmojiInput
assert actual
text expected
replacePrevCharCnt expectedCharReplaceCnt
replaceNextCharCnt
positionDelta
textArea
TextAreaState
TextAreaState
TextAreaState
prevState TextAreaState
value selectionStart selectionEnd
expected expectedReplacePrevCharCnt expectedReplaceNextCharCnt expectedPositionDelta
prevState prevState TextAreaState
textArea
textArea _value value
textArea _selectionStart selectionStart
textArea _selectionEnd selectionEnd
newState TextAreaState textArea
actual TextAreaState prevState newState
assert actual
text expected
replacePrevCharCnt expectedReplacePrevCharCnt
replaceNextCharCnt expectedReplaceNextCharCnt
positionDelta expectedPositionDelta
textArea
lines selection Selection expected TextAreaState
model lines
screenReaderStrategy
screenReaderContentState screenReaderStrategy model selection
textAreaState TextAreaState screenReaderContentState
assert textAreaState expected
model
from
'../../../browser/controller/editContext/screenReaderUtils.js'
;
class
MockTextAreaWrapper
extends
Disposable
implements
ITextAreaWrapper
{
public
:
string
;
public
:
number
;
public
:
number
;
constructor
(
)
{
super
(
)
;
this
.
=
''
;
this
.
=
0
;
this
.
=
0
;
}
public
getValue
(
)
:
string
{
return
this
.
;
}
public
setValue
(
:
string
,
:
string
)
:
void
{
this
.
=
;
this
.
=
this
.
.
;
this
.
=
this
.
.
;
}
public
getSelectionStart
(
)
:
number
{
return
this
.
;
}
public
getSelectionEnd
(
)
:
number
{
return
this
.
;
}
public
setSelectionRange
(
:
string
,
:
number
,
:
number
)
:
void
{
if
(
<
0
)
{
=
0
;
}
if
(
>
this
.
.
)
{
=
this
.
.
;
}
if
(
<
0
)
{
=
0
;
}
if
(
>
this
.
.
)
{
=
this
.
.
;
}
this
.
=
;
this
.
=
;
}
}
function
equalsTextAreaState
(
:
,
:
)
:
boolean
{
return
(
.
===
.
&&
.
===
.
&&
.
===
.
&&
.
equalsRange
(
.
,
.
)
&&
.
===
.
)
;
}
suite
(
'TextAreaState'
,
(
)
=>
{
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
function
assertTextAreaState
(
:
,
:
string
,
:
number
,
:
number
)
:
void
{
const
=
new
TextAreaState
(
,
,
,
null
,
undefined
)
;
.
ok
(
equalsTextAreaState
(
,
)
,
.
toString
(
)
+
' == '
+
.
toString
(
)
)
;
}
test
(
'fromTextArea'
,
(
)
=>
{
const
=
new
MockTextAreaWrapper
(
)
;
.
=
'Hello world!'
;
.
=
1
;
.
=
12
;
let
=
.
readFromTextArea
(
,
null
)
;
assertTextAreaState
(
,
'Hello world!'
,
1
,
12
)
;
.
strictEqual
(
.
,
'Hello world!'
)
;
.
strictEqual
(
.
,
1
)
;
=
.
collapseSelection
(
)
;
assertTextAreaState
(
,
'Hello world!'
,
12
,
12
)
;
.
dispose
(
)
;
}
)
;
test
(
'applyToTextArea'
,
(
)
=>
{
const
=
new
MockTextAreaWrapper
(
)
;
.
=
'Hello world!'
;
.
=
1
;
.
=
12
;
let
=
new
TextAreaState
(
'Hi world!'
,
2
,
2
,
null
,
undefined
)
;
.
writeToTextArea
(
'test'
,
,
false
)
;
.
strictEqual
(
.
,
'Hi world!'
)
;
.
strictEqual
(
.
,
9
)
;
.
strictEqual
(
.
,
9
)
;
=
new
TextAreaState
(
'Hi world!'
,
3
,
3
,
null
,
undefined
)
;
.
writeToTextArea
(
'test'
,
,
false
)
;
.
strictEqual
(
.
,
'Hi world!'
)
;
.
strictEqual
(
.
,
9
)
;
.
strictEqual
(
.
,
9
)
;
=
new
TextAreaState
(
'Hi world!'
,
0
,
2
,
null
,
undefined
)
;
.
writeToTextArea
(
'test'
,
,
true
)
;
.
strictEqual
(
.
,
'Hi world!'
)
;
.
strictEqual
(
.
,
0
)
;
.
strictEqual
(
.
,
2
)
;
.
dispose
(
)
;
}
)
;
function
testDeduceInput
(
:
|
null
,
:
string
,
:
number
,
:
number
,
:
boolean
,
:
string
,
:
number
)
:
void
{
=
||
.
EMPTY
;
const
=
new
MockTextAreaWrapper
(
)
;
.
=
;
.
=
;
.
=
;
const
=
.
readFromTextArea
(
,
null
)
;
const
=
.
deduceInput
(
,
,
)
;
.
deepStrictEqual
(
,
{
:
,
:
,
:
0
,
:
0
,
}
)
;
.
dispose
(
)
;
}
test
(
'extractNewText - no previous state with selection'
,
(
)
=>
{
testDeduceInput
(
null
,
'a'
,
0
,
1
,
true
,
'a'
,
0
)
;
}
)
;
test
(
'issue #2586: Replacing selected end-of-line with newline locks up the document'
,
(
)
=>
{
testDeduceInput
(
new
TextAreaState
(
']\n'
,
1
,
2
,
null
,
undefined
)
,
']\n'
,
2
,
2
,
true
,
'\n'
,
0
)
;
}
)
;
test
(
'extractNewText - no previous state without selection'
,
(
)
=>
{
testDeduceInput
(
null
,
'a'
,
1
,
1
,
true
,
'a'
,
0
)
;
}
)
;
test
(
'extractNewText - typing does not cause a selection'
,
(
)
=>
{
testDeduceInput
(
.
EMPTY
,
'a'
,
0
,
1
,
true
,
'a'
,
0
)
;
}
)
;
test
(
'extractNewText - had the textarea empty'
,
(
)
=>
{
testDeduceInput
(
.
EMPTY
,
'a'
,
1
,
1
,
true
,
'a'
,
0
)
;
}
)
;
test
(
'extractNewText - had the entire line selected'
,
(
)
=>
{
testDeduceInput
(
new
TextAreaState
(
'Hello world!'
,
0
,
12
,
null
,
undefined
)
,
'H'
,
1
,
1
,
true
,
'H'
,
0
)
;
}
)
;
test
(
'extractNewText - had previous text 1'
,
(
)
=>
{
testDeduceInput
(
new
TextAreaState
(
'Hello world!'
,
12
,
12
,
null
,
undefined
)
,
'Hello world!a'
,
13
,
13
,
true
,
'a'
,
0
)
;
}
)
;
test
(
'extractNewText - had previous text 2'
,
(
)
=>
{
testDeduceInput
(
new
TextAreaState
(
'Hello world!'
,
0
,
0
,
null
,
undefined
)
,
'aHello world!'
,
1
,
1
,
true
,
'a'
,
0
)
;
}
)
;
test
(
'extractNewText - had previous text 3'
,
(
)
=>
{
testDeduceInput
(
new
TextAreaState
(
'Hello world!'
,
6
,
11
,
null
,
undefined
)
,
'Hello other!'
,
11
,
11
,
true
,
'other'
,
0
)
;
}
)
;
test
(
'extractNewText - IME'
,
(
)
=>
{
testDeduceInput
(
.
EMPTY
,
'これは'
,
3
,
3
,
true
,
'これは'
,
0
)
;
}
)
;
test
(
'extractNewText - isInOverwriteMode'
,
(
)
=>
{
testDeduceInput
(
new
TextAreaState
(
'Hello world!'
,
0
,
0
,
null
,
undefined
)
,
'Aello world!'
,
1
,
1
,
true
,
'A'
,
0
)
;
}
)
;
test
(
'extractMacReplacedText - does nothing if there is selection'
,
(
)
=>
{
testDeduceInput
(
new
TextAreaState
(
'Hello world!'
,
5
,
5
,
null
,
undefined
)
,
'Hellö world!'
,
4
,
5
,
true
,
'ö'
,
0
)
;
}
)
;
test
(
'extractMacReplacedText - does nothing if there is more than one extra char'
,
(
)
=>
{
testDeduceInput
(
new
TextAreaState
(
'Hello world!'
,
5
,
5
,
null
,
undefined
)
,
'Hellöö world!'
,
5
,
5
,
true
,
'öö'
,
1
)
;
}
)
;
test
(
'extractMacReplacedText - does nothing if there is more than one changed char'
,
(
)
=>
{
testDeduceInput
(
new
TextAreaState
(
'Hello world!'
,
5
,
5
,
null
,
undefined
)
,
'Helöö world!'
,
5
,
5
,
true
,
'öö'
,
2
)
;
}
)
;
test
(
'extractMacReplacedText'
,
(
)
=>
{
testDeduceInput
(
new
TextAreaState
(
'Hello world!'
,
5
,
5
,
null
,
undefined
)
,
'Hellö world!'
,
5
,
5
,
true
,
'ö'
,
1
)
;
}
)
;
test
(
'issue #25101 - First key press ignored'
,
(
)
=>
{
testDeduceInput
(
new
TextAreaState
(
'a'
,
0
,
1
,
null
,
undefined
)
,
'a'
,
1
,
1
,
true
,
'a'
,
0
)
;
}
)
;
test
(
'issue #16520 - Cmd-d of single character followed by typing same character as has no effect'
,
(
)
=>
{
testDeduceInput
(
new
TextAreaState
(
'x x'
,
0
,
1
,
null
,
undefined
)
,
'x x'
,
1
,
1
,
true
,
'x'
,
0
)
;
}
)
;
function
testDeduceAndroidCompositionInput
(
:
|
null
,
:
string
,
:
number
,
:
number
,
:
string
,
:
number
,
:
number
,
:
number
)
:
void
{
=
||
.
EMPTY
;
const
=
new
MockTextAreaWrapper
(
)
;
.
=
;
.
=
;
.
=
;
const
=
.
readFromTextArea
(
,
null
)
;
const
=
.
deduceAndroidCompositionInput
(
,
)
;
.
deepStrictEqual
(
,
{
:
,
:
,
:
,
:
,
}
)
;
.
dispose
(
)
;
}
test
(
'Android composition input 1'
,
(
)
=>
{
testDeduceAndroidCompositionInput
(
new
TextAreaState
(
'Microsoft'
,
4
,
4
,
null
,
undefined
)
,
'Microsoft'
,
4
,
4
,
''
,
0
,
0
,
0
,
)
;
}
)
;
test
(
'Android composition input 2'
,
(
)
=>
{
testDeduceAndroidCompositionInput
(
new
TextAreaState
(
'Microsoft'
,
4
,
4
,
null
,
undefined
)
,
'Microsoft'
,
0
,
9
,
''
,
0
,
0
,
5
,
)
;
}
)
;
test
(
'Android composition input 3'
,
(
)
=>
{
testDeduceAndroidCompositionInput
(
new
TextAreaState
(
'Microsoft'
,
0
,
9
,
null
,
undefined
)
,
'Microsoft\'s'
,
11
,
11
,
'\'s'
,
0
,
0
,
0
,
)
;
}
)
;
test
(
'Android backspace'
,
(
)
=>
{
testDeduceAndroidCompositionInput
(
new
TextAreaState
(
'undefinedVariable'
,
2
,
2
,
null
,
undefined
)
,
'udefinedVariable'
,
1
,
1
,
''
,
1
,
0
,
0
,
)
;
}
)
;
suite
(
'SimplePagedScreenReaderStrategy'
,
(
)
=>
{
function
testPagedScreenReaderStrategy
(
:
string
[
]
,
:
,
:
)
:
void
{
const
=
createTextModel
(
.
join
(
'\n'
)
)
;
const
=
new
SimplePagedScreenReaderStrategy
(
)
;
const
=
.
fromEditorSelection
(
,
,
10
,
true
)
;
const
=
.
fromScreenReaderContentState
(
)
;
.
ok
(
equalsTextAreaState
(
,
)
)
;
.
dispose
(
)
;
}
test
(
'simple'
,
(
)
=>
{
testPagedScreenReaderStrategy
(
[
'Hello world!'
]
,
new
Selection
(
1
,
13
,
1
,
13
)
,
new
TextAreaState
(
'Hello world!'
,
12
,
12
,
new
Range
(
1
,
13
,
1
,
13
)
,
0
)
)
;
testPagedScreenReaderStrategy
(
[
'Hello world!'
]
,
new
Selection
(
1
,
1
,
1
,
1
)
,
new
TextAreaState
(
'Hello world!'
,
0
,
0
,
new
Range
(
1
,
1
,
1
,
1
)
,
0
)
)
;
testPagedScreenReaderStrategy
(
[
'Hello world!'
]
,
new
Selection
(
1
,
1
,
1
,
6
)
,
new
TextAreaState
(
'Hello world!'
,
0
,
5
,
new
Range
(
1
,
1
,
1
,
6
)
,
0
)
)
;
}
)
;
test
(
'multiline'
,
(
)
=>
{
testPagedScreenReaderStrategy
(
[
'Hello world!'
,
'How are you?'
]
,
new
Selection
(
1
,
1
,
1
,
1
)
,
new
TextAreaState
(
'Hello world!\nHow are you?'
,
0
,
0
,
new
Range
(
1
,
1
,
1
,
1
)
,
0
)
)
;
testPagedScreenReaderStrategy
(
[
'Hello world!'
,
'How are you?'
]
,
new
Selection
(
2
,
1
,
2
,
1
)
,
new
TextAreaState
(
'Hello world!\nHow are you?'
,
13
,
13
,
new
Range
(
2
,
1
,
2
,
1
)
,
1
)
)
;
}
)
;
test
(
'page'
,
(
)
=>
{
testPagedScreenReaderStrategy
(
[
'L1\nL2\nL3\nL4\nL5\nL6\nL7\nL8\nL9\nL10\nL11\nL12\nL13\nL14\nL15\nL16\nL17\nL18\nL19\nL20\nL21'
]
,
new
Selection
(
1
,
1
,
1
,
1
)
,
new
TextAreaState
(
'L1\nL2\nL3\nL4\nL5\nL6\nL7\nL8\nL9\nL10\n'
,
0
,
0
,
new
Range
(
1
,
1
,
1
,
1
)
,
0
)
)
;
testPagedScreenReaderStrategy
(
[
'L1\nL2\nL3\nL4\nL5\nL6\nL7\nL8\nL9\nL10\nL11\nL12\nL13\nL14\nL15\nL16\nL17\nL18\nL19\nL20\nL21'
]
,
new
Selection
(
11
,
1
,
11
,
1
)
,
new
TextAreaState
(
'L11\nL12\nL13\nL14\nL15\nL16\nL17\nL18\nL19\nL20\n'
,
0
,
0
,
new
Range
(
11
,
1
,
11
,
1
)
,
0
)
)
;
testPagedScreenReaderStrategy
(
[
'L1\nL2\nL3\nL4\nL5\nL6\nL7\nL8\nL9\nL10\nL11\nL12\nL13\nL14\nL15\nL16\nL17\nL18\nL19\nL20\nL21'
]
,
new
Selection
(
12
,
1
,
12
,
1
)
,
new
TextAreaState
(
'L11\nL12\nL13\nL14\nL15\nL16\nL17\nL18\nL19\nL20\n'
,
4
,
4
,
new
Range
(
12
,
1
,
12
,
1
)
,
1
)
)
;
testPagedScreenReaderStrategy
(
[
'L1\nL2\nL3\nL4\nL5\nL6\nL7\nL8\nL9\nL10\nL11\nL12\nL13\nL14\nL15\nL16\nL17\nL18\nL19\nL20\nL21'
]
,
new
Selection
(
21
,
1
,
21
,
1
)
,
new
TextAreaState
(
'L21'
,
0
,
0
,
new
Range
(
21
,
1
,
21
,
1
)
,
0
)
)
;
}
)
;
}
)
;
}
)
;