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 / editTelemetry / test / browser / editTelemetry.test.ts 344 строк · изменён 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
import assert from 'assert' ;
import { Disposable, DisposableStore, toDisposable } from '../../../../../base/common/lifecycle.js' ;
import { constObservable, IObservable, IObservableWithChange, ISettableObservable, ITransaction, observableValue, subtransaction } from '../../../../../base/common/observable.js' ;
import { URI } from '../../../../../base/common/uri.js' ;
import { StringEdit, StringReplacement } from '../../../../../editor/common/core/edits/stringEdit.js' ;
import { OffsetRange } from '../../../../../editor/common/core/ranges/offsetRange.js' ;
StringText
ServiceCollection
TestInstantiationService
AnnotatedDocument AnnotatedDocuments IAnnotatedDocuments UriVisibilityProvider
IObservableDocument ObservableWorkspace StringEditWithReason
EditSourceTrackingImpl
ScmAdapter
EditSources
DiffService
computeStringDiff
runWithFakedTimers
timeout
ITelemetryService
IAiEditTelemetryService
Random
AiEditTelemetryServiceImpl
IRandomService RandomService
ensureNoDisposablesAreLeakedInTestSuite
SyncDescriptor
UserAttentionService UserAttentionServiceEnv
IUserAttentionService
ILogService NullLogService
ITextFileService
instantiationService
sentTelemetry eventName data Record
instantiationService ITelemetryService
eventName data
sentTelemetry eventName data
instantiationService IRandomService
aiEditTelemetryService instantiationService AiEditTelemetryServiceImpl
baseData
suggestionId
presentation
feature
source
languageId
editDeltaInfo
modeId
applyCodeBlockSuggestionId
modelId
sourceRequestId
aiEditTelemetryService baseData isAgentHostSession
aiEditTelemetryService baseData acceptanceMethod isAgentHostSession
aiEditTelemetryService baseData rejectionMethod isAgentHostSession
assert sentTelemetry event
eventName event eventName
isAgentHostSession event data isAgentHostSession
eventName isAgentHostSession
eventName isAgentHostSession
eventName isAgentHostSession
disposables
instantiationService disposables
IAiEditTelemetryService AiEditTelemetryServiceImpl
IUserAttentionService UserAttentionService
sentTelemetry
userActive
instantiationService UserAttentionServiceEnv
isUserActive userActive
isVsCodeFocused
instantiationService ITelemetryService
eventName data
sentTelemetry
instantiationService DiffService original modified original modified maxComputationTimeMs
instantiationService ScmAdapter uri reader
instantiationService UriVisibilityProvider uri reader
instantiationService IRandomService
instantiationService ILogService
instantiationService ITextFileService
w
docs disposables w instantiationService
disposables docs instantiationService
d1 disposables w
uri initialValue
chatEdit EditSources
languageId
modelId
codeBlockSuggestionId
extensionId
mode
requestId
sessionId
d1 StringEditWithReason d1 chatEdit
d1
StringReplacement d1
StringReplacement d1
EditSources kind
d1 StringEditWithReason d1 chatEdit
userActive
userActive
assert sentTelemetry
disposables
timeMs
totalMs Math timeMs
minutes Math totalMs
seconds Math totalMs
ms totalMs
str
str
_rand Random
override
_rand
documents IObservable AnnotatedDocument
documents
Could not find context `
matchStart startIndex beforeContext length
matchStart matchStart searchStr length
_openDocuments
documents _openDocuments
_documents
options uri workspaceRoot initialValue initialVersionId languageId tx ITransaction MutableObservableDocument
_documents options uri
document
options uri
options initialValue
options languageId
_documents options uri
docs _openDocuments
filteredDocs docs d d uri document uri
filteredDocs length docs length
_openDocuments filteredDocs tx added removed document
options initialVersionId
options workspaceRoot
_documents options uri document
_openDocuments _openDocuments document tx added document removed
document
override id MutableObservableDocument
_documents id
_openDocuments added removed _openDocuments
doc _documents
doc
_documents
_value ISettableObservable StringText StringEditWithReason
IObservableWithChange StringText StringEditWithReason _value
_selection ISettableObservable OffsetRange
IObservable OffsetRange _selection
_visibleRanges ISettableObservable OffsetRange
IObservable OffsetRange _visibleRanges
_languageId ISettableObservable
IObservable _languageId
_version ISettableObservable
IObservable _version
uri
value StringText
selection OffsetRange
languageId
versionId
workspaceRoot
_value value
_selection selection
_visibleRanges
_languageId languageId
_version versionId
onDispose
selection OffsetRange tx ITransaction
_selection selection tx
visibleRanges OffsetRange tx ITransaction
_visibleRanges visibleRanges tx
edit StringEdit StringEditWithReason tx ITransaction newVersion
newValue edit value
e edit edit edit replacements EditSources
tx tx
_value newValue tx e
_version newVersion _version tx
selection OffsetRange tx ITransaction
_selection selection tx
value StringText tx ITransaction newVersion
reason EditSources
e StringReplacement value value length value value reason
tx tx
_value value tx e
_version newVersion _version tx
search SearchString OffsetRange
value value search
import
{
}
from
'../../../../../editor/common/core/text/abstractText.js'
;
import
{
}
from
'../../../../../platform/instantiation/common/serviceCollection.js'
;
import
{
}
from
'../../../../../platform/instantiation/test/common/instantiationServiceMock.js'
;
import
{
,
,
,
}
from
'../../browser/helpers/annotatedDocuments.js'
;
import
{
,
,
}
from
'../../browser/helpers/observableWorkspace.js'
;
import
{
}
from
'../../browser/telemetry/editSourceTrackingImpl.js'
;
import
{
}
from
'../../browser/telemetry/scmAdapter.js'
;
import
{
}
from
'../../../../../editor/common/textModelEditSource.js'
;
import
{
}
from
'../../browser/helpers/documentWithAnnotatedEdits.js'
;
import
{
}
from
'../../../../../editor/common/services/editorWebWorker.js'
;
import
{
}
from
'../../../../../base/test/common/timeTravelScheduler.js'
;
import
{
}
from
'../../../../../base/common/async.js'
;
import
{
}
from
'../../../../../platform/telemetry/common/telemetry.js'
;
import
{
}
from
'../../browser/telemetry/aiEditTelemetry/aiEditTelemetryService.js'
;
import
{
}
from
'../../../../../editor/test/common/core/random.js'
;
import
{
}
from
'../../browser/telemetry/aiEditTelemetry/aiEditTelemetryServiceImpl.js'
;
import
{
,
}
from
'../../browser/randomService.js'
;
import
{
}
from
'../../../../../base/test/common/utils.js'
;
import
{
}
from
'../../../../../platform/instantiation/common/descriptors.js'
;
import
{
,
}
from
'../../../../services/userAttention/browser/userAttentionBrowser.js'
;
import
{
}
from
'../../../../services/userAttention/common/userAttentionService.js'
;
import
{
,
}
from
'../../../../../platform/log/common/log.js'
;
import
{
}
from
'../../../../services/textfile/common/textfiles.js'
;
suite
(
'Edit Telemetry'
,
(
)
=>
{
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
test
(
'reports Agent Host session mode for accepted and rejected edits'
,
(
)
=>
{
const
=
new
TestInstantiationService
(
)
;
const
:
{
readonly
:
string
;
readonly
:
<
string
,
unknown
>
|
undefined
}
[
]
=
[
]
;
.
stub
(
,
{
publicLog2
(
,
)
{
.
push
(
{
,
}
)
;
}
,
}
)
;
.
stub
(
,
new
DeterministicRandomService
(
)
)
;
const
=
.
createInstance
(
)
;
const
=
{
:
undefined
,
:
'highlightedEdit'
as
const
,
:
'inlineChat'
as
const
,
:
undefined
,
:
undefined
,
:
undefined
,
:
undefined
,
:
undefined
,
:
undefined
,
:
undefined
,
}
;
.
createSuggestionId
(
{
...
,
:
true
}
)
;
.
handleCodeAccepted
(
{
...
,
:
'accept'
,
:
true
}
)
;
.
handleCodeRejected
(
{
...
,
:
'reject'
,
:
false
}
)
;
.
deepStrictEqual
(
.
map
(
=>
(
{
:
.
,
:
.
?.
,
}
)
)
,
[
{
:
'editTelemetry.codeSuggested'
,
:
true
}
,
{
:
'editTelemetry.codeAccepted'
,
:
true
}
,
{
:
'editTelemetry.codeRejected'
,
:
false
}
,
]
)
;
}
)
;
test
(
'1'
,
async
(
)
=>
runWithFakedTimers
(
{
}
,
async
(
)
=>
{
const
=
new
DisposableStore
(
)
;
const
=
.
add
(
new
TestInstantiationService
(
new
ServiceCollection
(
[
,
new
SyncDescriptor
(
)
]
,
[
,
new
SyncDescriptor
(
)
]
)
,
false
,
undefined
,
true
)
)
;
const
:
unknown
[
]
=
[
]
;
const
=
observableValue
(
'userActive'
,
true
)
;
.
stubInstance
(
,
{
:
,
:
constObservable
(
true
)
,
dispose
:
(
)
=>
{
}
}
)
;
.
stub
(
,
{
publicLog2
(
,
)
{
.
push
(
` ${ formatTime ( Date. now ( ) ) } ${ eventName} : ${ JSON . stringify ( data) } `
)
;
}
,
}
)
;
.
stubInstance
(
,
{
computeDiff
:
async
(
,
)
=>
computeStringDiff
(
,
,
{
:
500
}
,
'advanced'
)
}
)
;
.
stubInstance
(
,
{
getRepo
:
(
,
)
=>
undefined
,
}
)
;
.
stubInstance
(
,
{
isVisible
:
(
,
)
=>
true
,
}
)
;
.
stub
(
,
new
DeterministicRandomService
(
)
)
;
.
stub
(
,
new
NullLogService
(
)
)
;
.
stub
(
,
{
isDirty
:
(
)
=>
false
}
)
;
const
=
new
MutableObservableWorkspace
(
)
;
const
=
.
add
(
new
AnnotatedDocuments
(
,
)
)
;
.
add
(
new
EditSourceTrackingImpl
(
constObservable
(
true
)
,
,
undefined
,
)
)
;
const
=
.
add
(
.
createDocument
(
{
:
URI
.
parse
(
'file:///a'
)
,
:
`
function fib(n) {
if (n <= 1) return n;
return fib(n - 1) + fib(n - 2);
}
`
}
,
undefined
)
)
;
await
timeout
(
10
)
;
const
=
.
chatApplyEdits
(
{
:
'plaintext'
,
:
undefined
,
:
undefined
,
:
undefined
,
:
undefined
,
:
undefined
,
:
undefined
,
}
)
;
.
applyEdit
(
.
replace
(
.
findRange
(
'≪≫function fib(n) {'
)
,
'// Computes the nth fibonacci number\n'
,
)
)
;
await
timeout
(
5000
)
;
.
applyEdit
(
new
StringEditWithReason
(
[
.
replace
(
.
findRange
(
'≪//≫ Computes'
)
,
'/*'
)
,
.
replace
(
.
findRange
(
'fibonacci number≪≫'
)
,
' */'
)
,
]
,
.
cursor
(
{
:
'type'
}
)
)
)
;
await
timeout
(
5000
)
;
.
applyEdit
(
.
replace
(
.
findRange
(
'Computes the nth fibonacci number'
)
,
'Berechnet die nte Fibonacci Zahl'
,
)
)
;
await
timeout
(
3
*
60
*
1000
)
;
.
set
(
false
,
undefined
)
;
await
timeout
(
3
*
60
*
1000
)
;
.
set
(
true
,
undefined
)
;
await
timeout
(
18
*
60
*
1000
)
;
.
deepStrictEqual
(
,
(
[
'00:01:010 editTelemetry.reportEditArc: {\"sourceKeyCleaned\":\"source:Chat.applyEdits\",\"languageId\":\"plaintext\",\"uniqueEditId\":\"8c97b7d8-9adb-4bd8-ac9f-a562704ce40e\",\"didBranchChange\":0,\"timeDelayMs\":0,\"originalCharCount\":37,\"originalLineCount\":1,\"originalDeletedLineCount\":0,\"arc\":37,\"currentLineCount\":1,\"currentDeletedLineCount\":0}'
,
'00:01:010 editTelemetry.codeSuggested: {\"eventId\":\"evt-055ed5f5-c723-4ede-ba79-cccd7685c7ad\",\"suggestionId\":\"sgt-f645627a-cacf-477a-9164-ecd6125616a5\",\"presentation\":\"highlightedEdit\",\"feature\":\"sideBarChat\",\"languageId\":\"plaintext\",\"editCharsInserted\":37,\"editCharsDeleted\":0,\"editLinesInserted\":1,\"editLinesDeleted\":0}'
,
'00:11:010 editTelemetry.reportEditArc: {\"sourceKeyCleaned\":\"source:Chat.applyEdits\",\"languageId\":\"plaintext\",\"uniqueEditId\":\"1eb8a394-2489-41c2-851b-6a79432fc6bc\",\"didBranchChange\":0,\"timeDelayMs\":0,\"originalCharCount\":19,\"originalLineCount\":1,\"originalDeletedLineCount\":1,\"arc\":19,\"currentLineCount\":1,\"currentDeletedLineCount\":1}'
,
'00:11:010 editTelemetry.codeSuggested: {\"eventId\":\"evt-5c9c6fe7-b219-4ff8-aaa7-ab2b355b21c0\",\"suggestionId\":\"sgt-74379122-0452-4e26-9c38-9d62f1e7ae73\",\"presentation\":\"highlightedEdit\",\"feature\":\"sideBarChat\",\"languageId\":\"plaintext\",\"editCharsInserted\":19,\"editCharsDeleted\":20,\"editLinesInserted\":1,\"editLinesDeleted\":1}'
,
'01:01:010 editTelemetry.reportEditArc: {\"sourceKeyCleaned\":\"source:Chat.applyEdits\",\"languageId\":\"plaintext\",\"uniqueEditId\":\"8c97b7d8-9adb-4bd8-ac9f-a562704ce40e\",\"didBranchChange\":0,\"timeDelayMs\":60000,\"originalCharCount\":37,\"originalLineCount\":1,\"originalDeletedLineCount\":0,\"arc\":16,\"currentLineCount\":1,\"currentDeletedLineCount\":0}'
,
'01:11:010 editTelemetry.reportEditArc: {\"sourceKeyCleaned\":\"source:Chat.applyEdits\",\"languageId\":\"plaintext\",\"uniqueEditId\":\"1eb8a394-2489-41c2-851b-6a79432fc6bc\",\"didBranchChange\":0,\"timeDelayMs\":60000,\"originalCharCount\":19,\"originalLineCount\":1,\"originalDeletedLineCount\":1,\"arc\":19,\"currentLineCount\":1,\"currentDeletedLineCount\":1}'
,
'05:01:010 editTelemetry.reportEditArc: {\"sourceKeyCleaned\":\"source:Chat.applyEdits\",\"languageId\":\"plaintext\",\"uniqueEditId\":\"8c97b7d8-9adb-4bd8-ac9f-a562704ce40e\",\"didBranchChange\":0,\"timeDelayMs\":300000,\"originalCharCount\":37,\"originalLineCount\":1,\"originalDeletedLineCount\":0,\"arc\":16,\"currentLineCount\":1,\"currentDeletedLineCount\":0}'
,
'05:11:010 editTelemetry.reportEditArc: {\"sourceKeyCleaned\":\"source:Chat.applyEdits\",\"languageId\":\"plaintext\",\"uniqueEditId\":\"1eb8a394-2489-41c2-851b-6a79432fc6bc\",\"didBranchChange\":0,\"timeDelayMs\":300000,\"originalCharCount\":19,\"originalLineCount\":1,\"originalDeletedLineCount\":1,\"arc\":19,\"currentLineCount\":1,\"currentDeletedLineCount\":1}'
,
'12:00:000 editTelemetry.editSources.details: {\"mode\":\"10minFocusWindow\",\"sourceKey\":\"source:Chat.applyEdits\",\"sourceKeyCleaned\":\"source:Chat.applyEdits\",\"trigger\":\"time\",\"languageId\":\"plaintext\",\"statsUuid\":\"509b5d53-9109-40a2-bdf5-1aa735a229fe\",\"modifiedCount\":35,\"deltaModifiedCount\":56,\"totalModifiedCount\":39}'
,
'12:00:000 editTelemetry.editSources.details: {\"mode\":\"10minFocusWindow\",\"sourceKey\":\"source:cursor-kind:type\",\"sourceKeyCleaned\":\"source:cursor-kind:type\",\"trigger\":\"time\",\"languageId\":\"plaintext\",\"statsUuid\":\"509b5d53-9109-40a2-bdf5-1aa735a229fe\",\"modifiedCount\":4,\"deltaModifiedCount\":4,\"totalModifiedCount\":39}'
,
'12:00:000 editTelemetry.editSources.stats: {\"attributionSchemaVersion\":2,\"mode\":\"10minFocusWindow\",\"languageId\":\"plaintext\",\"statsUuid\":\"509b5d53-9109-40a2-bdf5-1aa735a229fe\",\"nesModifiedCount\":0,\"inlineCompletionsCopilotModifiedCount\":0,\"inlineCompletionsNESModifiedCount\":0,\"otherAIModifiedCount\":35,\"agentHostModifiedCount\":0,\"unknownModifiedCount\":0,\"userModifiedCount\":4,\"ideModifiedCount\":0,\"totalModifiedCharacters\":39,\"externalModifiedCount\":0,\"isTrackedByGit\":0,\"focusTime\":600000,\"actualTime\":720000,\"trigger\":\"time\"}'
,
'22:00:000 editTelemetry.editSources.details: {\"mode\":\"20minFocusWindow\",\"sourceKey\":\"source:Chat.applyEdits\",\"sourceKeyCleaned\":\"source:Chat.applyEdits\",\"trigger\":\"time\",\"languageId\":\"plaintext\",\"statsUuid\":\"a794406a-7779-4e9f-a856-1caca85123c7\",\"modifiedCount\":35,\"deltaModifiedCount\":56,\"totalModifiedCount\":39}'
,
'22:00:000 editTelemetry.editSources.details: {\"mode\":\"20minFocusWindow\",\"sourceKey\":\"source:cursor-kind:type\",\"sourceKeyCleaned\":\"source:cursor-kind:type\",\"trigger\":\"time\",\"languageId\":\"plaintext\",\"statsUuid\":\"a794406a-7779-4e9f-a856-1caca85123c7\",\"modifiedCount\":4,\"deltaModifiedCount\":4,\"totalModifiedCount\":39}'
,
'22:00:000 editTelemetry.editSources.stats: {\"attributionSchemaVersion\":2,\"mode\":\"20minFocusWindow\",\"languageId\":\"plaintext\",\"statsUuid\":\"a794406a-7779-4e9f-a856-1caca85123c7\",\"nesModifiedCount\":0,\"inlineCompletionsCopilotModifiedCount\":0,\"inlineCompletionsNESModifiedCount\":0,\"otherAIModifiedCount\":35,\"agentHostModifiedCount\":0,\"unknownModifiedCount\":0,\"userModifiedCount\":4,\"ideModifiedCount\":0,\"totalModifiedCharacters\":39,\"externalModifiedCount\":0,\"isTrackedByGit\":0,\"focusTime\":1200000,\"actualTime\":1320000,\"trigger\":\"time\"}'
]
)
)
;
.
dispose
(
)
;
}
)
)
;
}
)
;
function
formatTime
(
:
number
)
:
string
{
const
=
.
floor
(
)
;
const
=
.
floor
(
/
60000
)
;
const
=
.
floor
(
(
%
60000
)
/
1000
)
;
const
=
%
1000
;
const
=
` ${ minutes. toString ( ) . padStart ( 2 , '0' ) } : ${ seconds. toString ( ) . padStart ( 2 , '0' ) } : ${ ms. toString ( ) . padStart ( 3 , '0' ) } `
;
return
;
}
class
DeterministicRandomService
extends
RandomService
{
private
readonly
=
.
create
(
0
)
;
generateUuid
(
)
:
string
{
return
this
.
.
nextUuid
(
)
;
}
}
export
class
FakeAnnotatedDocuments
extends
Disposable
implements
IAnnotatedDocuments
{
public
readonly
:
<
readonly
[
]
>
;
constructor
(
)
{
super
(
)
;
this
.
=
constObservable < readonly AnnotatedDocument[ ] >
(
[
]
)
;
}
}
` . */
type SearchString = string;
function findOffsetRange(str: string, search: SearchString): OffsetRange {
const startContextIndex = search.indexOf('≪');
const endContextIndex = search.indexOf('≫');
let searchStr: string;
let beforeContext = '';
let afterContext = '';
if (startContextIndex !== -1 && endContextIndex !== -1 && endContextIndex > startContextIndex) {
beforeContext = search.substring(0, startContextIndex);
afterContext = search.substring(endContextIndex + 1);
searchStr = search.substring(startContextIndex + 1, endContextIndex);
} else {
searchStr = search;
}
const startIndex = str.indexOf(beforeContext + searchStr + afterContext);
if (startIndex === -1) {
throw new Error( `
"${beforeContext}"
+
"${searchStr}"
+
"${afterContext}"
in
string
"${str}"
)
;
}
const
=
+
.
;
return
new
OffsetRange
(
,
+
.
)
;
}
export
class
MutableObservableWorkspace
extends
ObservableWorkspace
{
private
readonly
=
observableValue < readonly IObservableDocument[ ] , { added: readonly IObservableDocument[ ] ; removed: readonly IObservableDocument[ ] } >
(
this
,
[
]
)
;
public
readonly
=
this
.
;
private
readonly
=
new
Map< string , MutableObservableDocument>
(
)
;
constructor
(
)
{
super
(
)
;
}
public
createDocument
(
:
{
:
URI
;
?
:
URI
;
?
:
string
;
?
:
number
;
?
:
string
}
,
:
|
undefined
=
undefined
)
:
{
assert
(
!
this
.
.
has
(
.
.
toString
(
)
)
)
;
const
=
new
MutableObservableDocument
(
.
,
new
StringText
(
.
??
''
)
,
[
]
,
.
??
'plaintext'
,
(
)
=>
{
this
.
.
delete
(
.
.
toString
(
)
)
;
const
=
this
.
.
get
(
)
;
const
=
.
filter
(
=>
.
.
toString
(
)
!==
.
.
toString
(
)
)
;
if
(
.
!==
.
)
{
this
.
.
set
(
,
,
{
:
[
]
,
:
[
]
}
)
;
}
}
,
.
??
0
,
.
,
)
;
this
.
.
set
(
.
.
toString
(
)
,
)
;
this
.
.
set
(
[
...
this
.
.
get
(
)
,
]
,
,
{
:
[
]
,
:
[
]
}
)
;
return
;
}
public
getDocument
(
:
URI
)
:
|
undefined
{
return
this
.
.
get
(
.
toString
(
)
)
;
}
public
clear
(
)
:
void
{
this
.
.
set
(
[
]
,
undefined
,
{
:
[
]
,
:
this
.
.
get
(
)
}
)
;
for
(
const
of
this
.
.
values
(
)
)
{
.
dispose
(
)
;
}
this
.
.
clear
(
)
;
}
}
export
class
MutableObservableDocument
extends
Disposable
implements
IObservableDocument
{
private
readonly
:
<
,
>
;
public
get
value
(
)
:
<
,
>
{
return
this
.
;
}
private
readonly
:
<
readonly
[
]
>
;
public
get
selection
(
)
:
<
readonly
[
]
>
{
return
this
.
;
}
private
readonly
:
<
readonly
[
]
>
;
public
get
visibleRanges
(
)
:
<
readonly
[
]
>
{
return
this
.
;
}
private
readonly
:
<
string
>
;
public
get
languageId
(
)
:
<
string
>
{
return
this
.
;
}
private
readonly
:
<
number
>
;
public
get
version
(
)
:
<
number
>
{
return
this
.
;
}
constructor
(
public
readonly
:
URI
,
:
,
:
readonly
[
]
,
:
string
,
onDispose
:
(
)
=>
void
,
:
number
,
public
readonly
:
URI
|
undefined
,
)
{
super
(
)
;
this
.
=
observableValue
(
this
,
)
;
this
.
=
observableValue
(
this
,
)
;
this
.
=
observableValue
(
this
,
[
]
)
;
this
.
=
observableValue
(
this
,
)
;
this
.
=
observableValue
(
this
,
)
;
this
.
_register
(
toDisposable
(
)
)
;
}
setSelection
(
:
readonly
[
]
,
:
|
undefined
=
undefined
)
:
void
{
this
.
.
set
(
,
)
;
}
setVisibleRange
(
:
readonly
[
]
,
:
|
undefined
=
undefined
)
:
void
{
this
.
.
set
(
,
)
;
}
applyEdit
(
:
|
,
:
|
undefined
=
undefined
,
:
number
|
undefined
=
undefined
)
:
void
{
const
=
.
applyOnText
(
this
.
.
get
(
)
)
;
const
=
instanceof
StringEditWithReason
?
:
new
StringEditWithReason
(
.
,
.
unknown
(
{
}
)
)
;
subtransaction
(
,
=>
{
this
.
.
set
(
,
,
)
;
this
.
.
set
(
??
this
.
.
get
(
)
+
1
,
)
;
}
)
;
}
updateSelection
(
:
readonly
[
]
,
:
|
undefined
=
undefined
)
:
void
{
this
.
.
set
(
,
)
;
}
setValue
(
:
,
:
|
undefined
=
undefined
,
:
number
|
undefined
=
undefined
)
:
void
{
const
=
.
unknown
(
{
}
)
;
const
=
new
StringEditWithReason
(
[
.
replace
(
new
OffsetRange
(
0
,
this
.
.
get
(
)
.
.
)
,
.
)
]
,
)
;
subtransaction
(
,
=>
{
this
.
.
set
(
,
,
)
;
this
.
.
set
(
??
this
.
.
get
(
)
+
1
,
)
;
}
)
;
}
findRange
(
:
)
:
{
return
findOffsetRange
(
this
.
.
get
(
)
.
,
)
;
}
}