Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/import assert from'assert';import{ IDisposable }from'../../../../base/common/lifecycle.js';import{ ensureNoDisposablesAreLeakedInTestSuite }from'../../../../base/test/common/utils.js';import{ ISingleEditOperation }from'../../../common/core/editOperation.js';import{ Range }from'../../../common/core/range.js';import{ EndOfLinePreference, EndOfLineSequence }from'../../../common/model.js';import{ MirrorTextModel }from'../../../common/model/mirrorTextModel.js';import{ IModelContentChangedEvent }
assertSyncedModels testApplyEditsWithSyncedModels
createTextModel
original edits ISingleEditOperation before after
model original
modelEndOfLineSequence
assertmodel before
modeledits
assertmodel after
model
startLineNumber startColumn endLineNumber endColumn text ISingleEditOperation
range startLineNumber startColumn endLineNumber endColumn
text text
original edits ISingleEditOperation before after
model original
modelEndOfLineSequence
assertmodel before
modeledits
assertmodel after
model
startLineNumber startColumn endLineNumber endColumn text ISingleEditOperation
range startLineNumber startColumn endLineNumber endColumn
text text
startLineNumber startColumn endLineNumber endColumn text ISingleEditOperation
range startLineNumber startColumn endLineNumber endColumn
text text
forceMoveMarkers
original edits ISingleEditOperation
model original
hasThrown
modeledits
err
hasThrown
asserthasThrown
model
disposable IDisposable
model assertMirrorModels
model
range
text
model
isFirstTime
disposable model
isFirstTime
isFirstTime
model
range
text
disposable
disposable IDisposable
model assertMirrorModels
model
range
text
model
isFirstTime
disposable modele IModelContentChangedEvent
isFirstTime
isFirstTime
model
range
text
disposable
model
assertmodel
mirrorModel2 model model model
mirrorModel2PrevVersionId model
disposable modele IModelContentChangedEvent
versionId eversionId
versionId mirrorModel2PrevVersionId
mirrorModel2PrevVersionId versionId
mirrorModel2e
assertmirrorModel2 model
assertmirrorModel2version model
modelEndOfLineSequence
disposable
model
mirrorModel2
model
model
range text
range text
assertmodelEndOfLinePreference
assertmodel
model
range text
range text
assertmodelEndOfLinePreference
model
model
undoEdits model
range text
range text
range text
range text
modelundoEdits
assertmodel
model
model
modelEndOfLineSequence
assertmodel
assertmodel
assertmodel
assertmodel
model
range text
assertmodel
assertmodel
assertmodel
model
model
modelEndOfLineSequence
model
range text
assertmodel
assertmodel
assertmodel
assertmodel
model
model
modelEndOfLineSequence
model
range text
assertmodel
model
model
modelEndOfLineSequence
assertmodel
assertmodel
model
range text
assertmodel
model
model
modelEndOfLineSequence
assertmodel
assertmodel
assertmodel
assertmodel
assertmodel
model
range
text
assertmodel
assertmodel
assertmodel
assertmodel
assertmodel
model
'issue #2586 Replacing selected end-of-line with newline locks up the document'
,
(
)
=>
{
testApplyEditsWithSyncedModels
(
[
'something'
,
'interesting'
]
,
[
editOp
(
1
,
10
,
2
,
1
,
[
''
,
''
]
)
]
,
[
'something'
,
'interesting'
]
)
;
}
)
;
test
(
'issue #3980'
,
(
)
=>
{
testApplyEditsWithSyncedModels
(
[
'class A {'
,
' someProperty = false;'
,
' someMethod() {'
,
' this.someMethod();'
,
' }'
,
'}'
,
]
,
[
editOp
(
1
,
8
,
1
,
9
,
[
''
,
''
]
)
,
editOp
(
3
,
17
,
3
,
18
,
[
''
,
''
]
)
,
editOp
(
3
,
18
,
3
,
18
,
[
' '
]
)
,
editOp
(
4
,
5
,
4
,
5
,
[
' '
]
)
,
]
,
[
'class A'
,
'{'
,
' someProperty = false;'
,
' someMethod()'
,
' {'
,
' this.someMethod();'
,
' }'
,
'}'
,
]
)
;
}
)
;
function
testApplyEditsFails
(
:
string
[
]
,
:
[
]
)
:
void
{
const
=
createTextModel
(
.
join
(
'\n'
)
)
;
let
=
false
;
try
{
.
applyEdits
(
)
;
}
catch
(
)
{
=
true
;
}
.
ok
(
,
'expected model.applyEdits to fail.'
)
;
.
dispose
(
)
;
}
test
(
'touching edits: two inserts at the same position'
,
(
)
=>
{
testApplyEditsWithSyncedModels
(
[
'hello world'
]
,
[
editOp
(
1
,
1
,
1
,
1
,
[
'a'
]
)
,
editOp
(
1
,
1
,
1
,
1
,
[
'b'
]
)
,
]
,
[
'abhello world'
]
)
;
}
)
;
test
(
'touching edits: insert and replace touching'
,
(
)
=>
{
testApplyEditsWithSyncedModels
(
[
'hello world'
]
,
[
editOp
(
1
,
1
,
1
,
1
,
[
'b'
]
)
,
editOp
(
1
,
1
,
1
,
3
,
[
'ab'
]
)
,
]
,
[
'babllo world'
]
)
;
}
)
;
test
(
'overlapping edits: two overlapping replaces'
,
(
)
=>
{
testApplyEditsFails
(
[
'hello world'
]
,
[
editOp
(
1
,
1
,
1
,
2
,
[
'b'
]
)
,
editOp
(
1
,
1
,
1
,
3
,
[
'ab'
]
)
,
]
)
;
}
)
;
test
(
'overlapping edits: two overlapping deletes'
,
(
)
=>
{
testApplyEditsFails
(
[
'hello world'
]
,
[
editOp
(
1
,
1
,
1
,
2
,
[
''
]
)
,
editOp
(
1
,
1
,
1
,
3
,
[
''
]
)
,
]
)
;
}
)
;
test
(
'touching edits: two touching replaces'
,
(
)
=>
{
testApplyEditsWithSyncedModels
(
[
'hello world'
]
,
[
editOp
(
1
,
1
,
1
,
2
,
[
'H'
]
)
,
editOp
(
1
,
2
,
1
,
3
,
[
'E'
]
)
,
]
,
[
'HEllo world'
]
)
;
}
)
;
test
(
'touching edits: two touching deletes'
,
(
)
=>
{
testApplyEditsWithSyncedModels
(
[
'hello world'
]
,
[
editOp
(
1
,
1
,
1
,
2
,
[
''
]
)
,
editOp
(
1
,
2
,
1
,
3
,
[
''
]
)
,
]
,
[
'llo world'
]
)
;
}
)
;
test
(
'touching edits: insert and replace'
,
(
)
=>
{
testApplyEditsWithSyncedModels
(
[
'hello world'
]
,
[
editOp
(
1
,
1
,
1
,
1
,
[
'H'
]
)
,
editOp
(
1
,
1
,
1
,
3
,
[
'e'
]
)
,
]
,
[
'Hello world'
]
)
;
}
)
;
test
(
'touching edits: replace and insert'
,
(
)
=>
{
testApplyEditsWithSyncedModels
(
[
'hello world'
]
,
[
editOp
(
1
,
1
,
1
,
3
,
[
'H'
]
)
,
editOp
(
1
,
3
,
1
,
3
,
[
'e'
]
)
,
]
,
[
'Hello world'
]
)
;
}
)
;
test
(
'change while emitting events 1'
,
(
)
=>
{
let
!
:
;
assertSyncedModels
(
'Hello'
,
(
,
)
=>
{
.
applyEdits
(
[
{
:
new
Range
(
1
,
6
,
1
,
6
)
,
:
' world!'
,
// forceMoveMarkers: false
}
]
)
;
assertMirrorModels
(
)
;
}
,
(
)
=>
{
let
=
true
;
=
.
onDidChangeContent
(
(
)
=>
{
if
(
!
)
{
return
;
}
=
false
;
.
applyEdits
(
[
{
:
new
Range
(
1
,
13
,
1
,
13
)
,
:
' How are you?'
,
// forceMoveMarkers: false
}
]
)
;
}
)
;
}
)
;
.
dispose
(
)
;
}
)
;
test
(
'change while emitting events 2'
,
(
)
=>
{
let
!
:
;
assertSyncedModels
(
'Hello'
,
(
,
)
=>
{
.
applyEdits
(
[
{
:
new
Range
(
1
,
6
,
1
,
6
)
,
:
' world!'
,
// forceMoveMarkers: false
}
]
)
;
assertMirrorModels
(
)
;
}
,
(
)
=>
{
let
=
true
;
=
.
onDidChangeContent
(
(
:
)
=>
{
if
(
!
)
{
return
;
}
=
false
;
.
applyEdits
(
[
{
:
new
Range
(
1
,
13
,
1
,
13
)
,
:
' How are you?'
,
// forceMoveMarkers: false
}
]
)
;
}
)
;
}
)
;
.
dispose
(
)
;
}
)
;
test
(
'issue #1580: Changes in line endings are not correctly reflected in the extension host, leading to invalid offsets sent to external refactoring tools'
,
(
)
=>
{
const
=
createTextModel
(
'Hello\nWorld!'
)
;
.
strictEqual
(
.
getEOL
(
)
,
'\n'
)
;
const
=
new
MirrorTextModel
(
null
!
,
.
getLinesContent
(
)
,
.
getEOL
(
)
,
.
getVersionId
(
)
)
;
let
=
.
getVersionId
(
)
;
const
=
.
onDidChangeContent
(
(
:
)
=>
{
const
=
.
;
if
(
<
)
{
console
.
warn
(
'Model version id did not advance between edits (2)'
)
;
}
=
;
.
onEvents
(
)
;
}
)
;
const
assertMirrorModels
=
(
)
=>
{
.
strictEqual
(
.
getText
(
)
,
.
getValue
(
)
,
'mirror model 2 text OK'
)
;
.
strictEqual
(
.
,
.
getVersionId
(
)
,
'mirror model 2 version OK'
)
;
}
;
.
setEOL
(
.
CRLF
)
;
assertMirrorModels
(
)
;
.
dispose
(
)
;
.
dispose
(
)
;
.
dispose
(
)
;
}
)
;
test
(
'issue #47733: Undo mangles unicode characters'
,
(
)
=>
{
const
=
createTextModel
(
'\'👁\''
)
;
.
applyEdits
(
[
{
:
new
Range
(
1
,
1
,
1
,
1
)
,
:
'"'
}
,
{
:
new
Range
(
1
,
2
,
1
,
2
)
,
:
'"'
}
,
]
)
;
.
strictEqual
(
.
getValue
(
.
LF
)
,
'"\'"👁\''
)
;
.
deepStrictEqual
(
.
validateRange
(
new
Range
(
1
,
3
,
1
,
4
)
)
,
new
Range
(
1
,
3
,
1
,
4
)
)
;
.
applyEdits
(
[
{
:
new
Range
(
1
,
1
,
1
,
2
)
,
:
null
}
,
{
:
new
Range
(
1
,
3
,
1
,
4
)
,
:
null
}
,
]
)
;
.
strictEqual
(
.
getValue
(
.
LF
)
,
'\'👁\''
)
;
.
dispose
(
)
;
}
)
;
test
(
'issue #48741: Broken undo stack with move lines up with multiple cursors'
,
(
)
=>
{
const
=
createTextModel
(
[
'line1'
,
'line2'
,
'line3'
,
''
,
]
.
join
(
'\n'
)
)
;
const
=
.
applyEdits
(
[
{
:
new
Range
(
4
,
1
,
4
,
1
)
,
:
'line3'
,
}
,
{
:
new
Range
(
3
,
1
,
3
,
6
)
,
:
null
,
}
,
{
:
new
Range
(
2
,
1
,
3
,
1
)
,
:
null
,
}
,
{
:
new
Range
(
3
,
6
,
3
,
6
)
,
:
'\nline2'
}
]
,
true
)
;
.
applyEdits
(
)
;
.
deepStrictEqual
(
.
getValue
(
)
,
'line1\nline2\nline3\n'
)
;
.
dispose
(
)
;
}
)
;
}
)
;
suite
(
'CRLF edit normalization'
,
(
)
=>
{
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
test
(
'edit ending with \\r followed by \\n in buffer should strip trailing \\r'
,
(
)
=>
{
// Document: "abc\r\ndef\r\n"
// Edit: Replace range (1,1)-(1,4) "abc" with "xyz\r"
// The \r at end of replacement should be stripped since next char is \n
const
=
createTextModel
(
'abc\r\ndef\r\n'
)
;
.
setEOL
(
.
CRLF
)
;
.
strictEqual
(
.
getEOL
(
)
,
'\r\n'
)
;
.
strictEqual
(
.
getLineCount
(
)
,
3
)
;
.
strictEqual
(
.
getLineContent
(
1
)
,
'abc'
)
;
.
strictEqual
(
.
getLineContent
(
2
)
,
'def'
)
;
.
applyEdits
(
[
{
:
new
Range
(
1
,
1
,
1
,
4
)
,
:
'xyz\r'
}
]
)
;
// The trailing \r should be stripped, so we get "xyz" not "xyz\r"
.
strictEqual
(
.
getLineContent
(
1
)
,
'xyz'
)
;
.
strictEqual
(
.
getLineContent
(
2
)
,
'def'
)
;
.
strictEqual
(
.
getLineCount
(
)
,
3
)
;
.
dispose
(
)
;
}
)
;
test
(
'edit ending with \\r\\n should NOT be modified'
,
(
)
=>
{
// Document: "abc\r\ndef\r\n"
// Edit: Replace range (1,1)-(1,4) "abc" with "xyz\r\n"
// This is a proper CRLF so should not be modified
const
=
createTextModel
(
'abc\r\ndef\r\n'
)
;
.
setEOL
(
.
CRLF
)
;
.
applyEdits
(
[
{
:
new
Range
(
1
,
1
,
1
,
4
)
,
:
'xyz\r\n'
}
]
)
;
// Should add a new line
.
strictEqual
(
.
getLineContent
(
1
)
,
'xyz'
)
;
.
strictEqual
(
.
getLineContent
(
2
)
,
''
)
;
.
strictEqual
(
.
getLineContent
(
3
)
,
'def'
)
;
.
strictEqual
(
.
getLineCount
(
)
,
4
)
;
.
dispose
(
)
;
}
)
;
test
(
'edit ending with \\r NOT followed by \\n should NOT be modified'
,
(
)
=>
{
// Document: "abcdef" (no newline after)
// Edit: Replace range (1,1)-(1,4) "abc" with "xyz\r"
// Since there's no \n after the range, the \r should stay
const
=
createTextModel
(
'abcdef'
)
;
.
setEOL
(
.
CRLF
)
;
.
applyEdits
(
[
{
:
new
Range
(
1
,
1
,
1
,
4
)
,
:
'xyz\r'
}
]
)
;
// The \r should cause a new line since buffer normalizes EOL
// Actually since buffer uses CRLF, the lone \r will be normalized to \r\n
.
strictEqual
(
.
getLineCount
(
)
,
2
)
;
.
dispose
(
)
;
}
)
;
test
(
'edit in LF buffer should NOT strip trailing \\r'
,
(
)
=>
{
// Document with LF: "abc\ndef\n"
// Edit: Replace range (1,1)-(1,4) "abc" with "xyz\r"
// Since buffer is LF, no special handling needed
const
=
createTextModel
(
'abc\ndef\n'
)
;
.
setEOL
(
.
LF
)
;
.
strictEqual
(
.
getEOL
(
)
,
'\n'
)
;
.
strictEqual
(
.
getLineCount
(
)
,
3
)
;
.
applyEdits
(
[
{
:
new
Range
(
1
,
1
,
1
,
4
)
,
:
'xyz\r'
}
]
)
;
// The \r will be normalized to \n (buffer's EOL)
.
strictEqual
(
.
getLineCount
(
)
,
4
)
;
.
dispose
(
)
;
}
)
;
test
(
'LSP include sorting scenario - edit ending with \\r should be normalized'