Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
dc517c0a
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dc517c0a
编写于
11月 08, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Renames (#37834)
上级
ad75f5e5
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
163 addition
and
167 deletion
+163
-167
src/vs/editor/contrib/bracketMatching/test/bracketMatching.test.ts
...itor/contrib/bracketMatching/test/bracketMatching.test.ts
+3
-3
src/vs/editor/contrib/find/test/find.test.ts
src/vs/editor/contrib/find/test/find.test.ts
+4
-4
src/vs/editor/contrib/find/test/findController.test.ts
src/vs/editor/contrib/find/test/findController.test.ts
+16
-16
src/vs/editor/contrib/find/test/findModel.test.ts
src/vs/editor/contrib/find/test/findModel.test.ts
+2
-2
src/vs/editor/contrib/linesOperations/test/linesOperations.test.ts
...itor/contrib/linesOperations/test/linesOperations.test.ts
+20
-20
src/vs/editor/contrib/multicursor/test/multicursor.test.ts
src/vs/editor/contrib/multicursor/test/multicursor.test.ts
+11
-11
src/vs/editor/contrib/quickFix/test/quickFixModel.test.ts
src/vs/editor/contrib/quickFix/test/quickFixModel.test.ts
+2
-2
src/vs/editor/contrib/snippet/test/snippetController2.old.test.ts
...ditor/contrib/snippet/test/snippetController2.old.test.ts
+3
-3
src/vs/editor/contrib/snippet/test/snippetController2.test.ts
...vs/editor/contrib/snippet/test/snippetController2.test.ts
+2
-2
src/vs/editor/contrib/snippet/test/snippetSession.test.ts
src/vs/editor/contrib/snippet/test/snippetSession.test.ts
+2
-2
src/vs/editor/contrib/suggest/test/suggestModel.test.ts
src/vs/editor/contrib/suggest/test/suggestModel.test.ts
+3
-3
src/vs/editor/contrib/wordOperations/test/wordOperations.test.ts
...editor/contrib/wordOperations/test/wordOperations.test.ts
+35
-35
src/vs/editor/test/browser/commands/sideEditing.test.ts
src/vs/editor/test/browser/commands/sideEditing.test.ts
+2
-2
src/vs/editor/test/browser/controller/cursor.test.ts
src/vs/editor/test/browser/controller/cursor.test.ts
+39
-39
src/vs/editor/test/browser/testCodeEditor.ts
src/vs/editor/test/browser/testCodeEditor.ts
+8
-12
src/vs/editor/test/browser/testCommand.ts
src/vs/editor/test/browser/testCommand.ts
+2
-2
src/vs/workbench/parts/emmet/test/electron-browser/emmetAction.test.ts
...nch/parts/emmet/test/electron-browser/emmetAction.test.ts
+2
-2
src/vs/workbench/test/browser/parts/editor/rangeDecorations.test.ts
...kbench/test/browser/parts/editor/rangeDecorations.test.ts
+2
-2
src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts
...lectron-browser/api/mainThreadDocumentsAndEditors.test.ts
+5
-5
未找到文件。
src/vs/editor/contrib/bracketMatching/test/bracketMatching.test.ts
浏览文件 @
dc517c0a
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
with
Mock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
with
Test
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Model
}
from
'
vs/editor/common/model/model
'
;
import
{
LanguageConfigurationRegistry
}
from
'
vs/editor/common/modes/languageConfigurationRegistry
'
;
...
...
@@ -34,7 +34,7 @@ suite('bracket matching', () => {
let
mode
=
new
BracketMode
();
let
model
=
Model
.
createFromString
(
'
var x = (3 + (5-7)) + ((5+3)+5);
'
,
undefined
,
mode
.
getLanguageIdentifier
());
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
let
bracketMatchingController
=
editor
.
registerAndInstantiateContribution
<
BracketMatchingController
>
(
BracketMatchingController
);
// start on closing bracket
...
...
@@ -66,7 +66,7 @@ suite('bracket matching', () => {
let
mode
=
new
BracketMode
();
let
model
=
Model
.
createFromString
(
'
var x = (3 + (5-7)); y();
'
,
undefined
,
mode
.
getLanguageIdentifier
());
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
let
bracketMatchingController
=
editor
.
registerAndInstantiateContribution
<
BracketMatchingController
>
(
BracketMatchingController
);
// start position between brackets
...
...
src/vs/editor/contrib/find/test/find.test.ts
浏览文件 @
dc517c0a
...
...
@@ -8,13 +8,13 @@ import * as assert from 'assert';
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
getSelectionSearchString
}
from
'
vs/editor/contrib/find/common/find
'
;
import
{
with
Mock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
with
Test
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
suite
(
'
Find
'
,
()
=>
{
test
(
'
search string at position
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
ABC DEF
'
,
'
0123 456
'
],
{},
(
editor
,
cursor
)
=>
{
...
...
@@ -37,7 +37,7 @@ suite('Find', () => {
});
test
(
'
search string with selection
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
ABC DEF
'
,
'
0123 456
'
],
{},
(
editor
,
cursor
)
=>
{
...
...
@@ -61,7 +61,7 @@ suite('Find', () => {
});
test
(
'
search string with multiline selection
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
ABC DEF
'
,
'
0123 456
'
],
{},
(
editor
,
cursor
)
=>
{
...
...
src/vs/editor/contrib/find/test/findController.test.ts
浏览文件 @
dc517c0a
...
...
@@ -13,7 +13,7 @@ import { Selection } from 'vs/editor/common/core/selection';
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
CommonFindController
,
FindStartFocusAction
,
IFindStartOptions
,
NextMatchFindAction
,
StartFindAction
}
from
'
vs/editor/contrib/find/common/findController
'
;
import
{
with
Mock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
with
Test
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
HistoryNavigator
}
from
'
vs/base/common/history
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
...
...
@@ -78,7 +78,7 @@ suite('FindController', () => {
}
as
IStorageService
);
test
(
'
issue #1857: F3, Find Next, acts like "Find Under Cursor"
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
ABC
'
,
'
ABC
'
,
'
XYZ
'
,
...
...
@@ -136,7 +136,7 @@ suite('FindController', () => {
});
test
(
'
issue #3090: F3 does not loop with two matches on a single line
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
import nls = require(
\'
vs/nls
\'
);
'
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
...
...
@@ -159,7 +159,7 @@ suite('FindController', () => {
});
test
(
'
issue #6149: Auto-escape highlighted text for search and replace regex mode
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
...
...
@@ -185,7 +185,7 @@ suite('FindController', () => {
});
test
(
'
issue #9043: Clear search scope when find widget is hidden
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
...
...
@@ -213,7 +213,7 @@ suite('FindController', () => {
});
test
(
'
find term is added to history on state change
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
...
...
@@ -229,7 +229,7 @@ suite('FindController', () => {
});
test
(
'
find term is added with delay
'
,
(
done
)
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
...
...
@@ -249,7 +249,7 @@ suite('FindController', () => {
});
test
(
'
show previous find term
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
...
...
@@ -266,7 +266,7 @@ suite('FindController', () => {
});
test
(
'
show previous find term do not update history
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
...
...
@@ -283,7 +283,7 @@ suite('FindController', () => {
});
test
(
'
show next find term
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
...
...
@@ -303,7 +303,7 @@ suite('FindController', () => {
});
test
(
'
show next find term do not update history
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
...
...
@@ -323,7 +323,7 @@ suite('FindController', () => {
});
test
(
'
issue #18111: Regex replace with single space replaces with no space
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
HRESULT OnAmbientPropertyChange(DISPID dispid);
'
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
...
...
@@ -348,7 +348,7 @@ suite('FindController', () => {
});
test
(
'
issue #24714: Regular expression with ^ in search & replace
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
''
,
'
line2
'
,
'
line3
'
...
...
@@ -399,7 +399,7 @@ suite('FindController query options persistence', () => {
}
as
IStorageService
);
test
(
'
matchCase
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
abc
'
,
'
ABC
'
,
'
XYZ
'
,
...
...
@@ -426,7 +426,7 @@ suite('FindController query options persistence', () => {
queryState
=
{
'
editor.isRegex
'
:
false
,
'
editor.matchCase
'
:
false
,
'
editor.wholeWord
'
:
true
};
test
(
'
wholeWord
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
ABC
'
,
'
AB
'
,
'
XYZ
'
,
...
...
@@ -451,7 +451,7 @@ suite('FindController query options persistence', () => {
});
test
(
'
toggling options is saved
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
ABC
'
,
'
AB
'
,
'
XYZ
'
,
...
...
src/vs/editor/contrib/find/test/findModel.test.ts
浏览文件 @
dc517c0a
...
...
@@ -12,14 +12,14 @@ import { Range } from 'vs/editor/common/core/range';
import
{
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
FindModelBoundToEditorModel
}
from
'
vs/editor/contrib/find/common/findModel
'
;
import
{
FindReplaceState
}
from
'
vs/editor/contrib/find/common/findState
'
;
import
{
with
Mock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
with
Test
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
CoreNavigationCommands
}
from
'
vs/editor/common/controller/coreCommands
'
;
suite
(
'
FindModel
'
,
()
=>
{
function
findTest
(
testName
:
string
,
callback
:
(
editor
:
ICommonCodeEditor
,
cursor
:
Cursor
)
=>
void
):
void
{
test
(
testName
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
// my cool header
'
,
'
#include "cool.h"
'
,
'
#include <iostream>
'
,
...
...
src/vs/editor/contrib/linesOperations/test/linesOperations.test.ts
浏览文件 @
dc517c0a
...
...
@@ -8,7 +8,7 @@ import * as assert from 'assert';
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Handler
,
IModel
,
DefaultEndOfLine
}
from
'
vs/editor/common/editorCommon
'
;
import
{
with
Mock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
with
Test
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
DeleteAllLeftAction
,
JoinLinesAction
,
TransposeAction
,
UpperCaseAction
,
LowerCaseAction
,
DeleteAllRightAction
,
InsertLineBeforeAction
,
InsertLineAfterAction
,
IndentLinesAction
}
from
'
vs/editor/contrib/linesOperations/common/linesOperations
'
;
import
{
Cursor
}
from
'
vs/editor/common/controller/cursor
'
;
import
{
Model
}
from
'
vs/editor/common/model/model
'
;
...
...
@@ -17,7 +17,7 @@ import { CoreEditingCommands } from 'vs/editor/common/controller/coreCommands';
suite
(
'
Editor Contrib - Line Operations
'
,
()
=>
{
suite
(
'
DeleteAllLeftAction
'
,
()
=>
{
test
(
'
should delete to the left of the cursor
'
,
function
()
{
with
Mock
CodeEditor
(
with
Test
CodeEditor
(
[
'
one
'
,
'
two
'
,
...
...
@@ -38,7 +38,7 @@ suite('Editor Contrib - Line Operations', () => {
});
test
(
'
should work in multi cursor mode
'
,
function
()
{
with
Mock
CodeEditor
(
with
Test
CodeEditor
(
[
'
hello
'
,
'
world
'
,
...
...
@@ -75,7 +75,7 @@ suite('Editor Contrib - Line Operations', () => {
});
test
(
'
issue #36234: should push undo stop
'
,
()
=>
{
with
Mock
CodeEditor
(
with
Test
CodeEditor
(
[
'
one
'
,
'
two
'
,
...
...
@@ -103,7 +103,7 @@ suite('Editor Contrib - Line Operations', () => {
suite
(
'
JoinLinesAction
'
,
()
=>
{
test
(
'
should join lines and insert space if necessary
'
,
function
()
{
with
Mock
CodeEditor
(
with
Test
CodeEditor
(
[
'
hello
'
,
'
world
'
,
...
...
@@ -148,7 +148,7 @@ suite('Editor Contrib - Line Operations', () => {
});
test
(
'
should work in multi cursor mode
'
,
function
()
{
with
Mock
CodeEditor
(
with
Test
CodeEditor
(
[
'
hello
'
,
'
world
'
,
...
...
@@ -192,7 +192,7 @@ suite('Editor Contrib - Line Operations', () => {
});
test
(
'
should push undo stop
'
,
function
()
{
with
Mock
CodeEditor
(
with
Test
CodeEditor
(
[
'
hello
'
,
'
world
'
...
...
@@ -218,7 +218,7 @@ suite('Editor Contrib - Line Operations', () => {
});
test
(
'
transpose
'
,
function
()
{
with
Mock
CodeEditor
(
with
Test
CodeEditor
(
[
'
hello world
'
,
''
,
...
...
@@ -256,7 +256,7 @@ suite('Editor Contrib - Line Operations', () => {
);
// fix #16633
with
Mock
CodeEditor
(
with
Test
CodeEditor
(
[
''
,
''
,
...
...
@@ -294,7 +294,7 @@ suite('Editor Contrib - Line Operations', () => {
});
test
(
'
toggle case
'
,
function
()
{
with
Mock
CodeEditor
(
with
Test
CodeEditor
(
[
'
hello world
'
,
'
öçşğü
'
...
...
@@ -335,7 +335,7 @@ suite('Editor Contrib - Line Operations', () => {
}
);
with
Mock
CodeEditor
(
with
Test
CodeEditor
(
[
''
,
'
'
...
...
@@ -369,7 +369,7 @@ suite('Editor Contrib - Line Operations', () => {
suite
(
'
DeleteAllRightAction
'
,
()
=>
{
test
(
'
should be noop on empty
'
,
()
=>
{
with
Mock
CodeEditor
([
''
],
{},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
([
''
],
{},
(
editor
,
cursor
)
=>
{
const
model
=
editor
.
getModel
();
const
action
=
new
DeleteAllRightAction
();
...
...
@@ -390,7 +390,7 @@ suite('Editor Contrib - Line Operations', () => {
});
test
(
'
should delete selected range
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
hello
'
,
'
world
'
],
{},
(
editor
,
cursor
)
=>
{
...
...
@@ -415,7 +415,7 @@ suite('Editor Contrib - Line Operations', () => {
});
test
(
'
should delete to the right of the cursor
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
hello
'
,
'
world
'
],
{},
(
editor
,
cursor
)
=>
{
...
...
@@ -435,7 +435,7 @@ suite('Editor Contrib - Line Operations', () => {
});
test
(
'
should join two lines, if at the end of the line
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
hello
'
,
'
world
'
],
{},
(
editor
,
cursor
)
=>
{
...
...
@@ -460,7 +460,7 @@ suite('Editor Contrib - Line Operations', () => {
});
test
(
'
should work with multiple cursors
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
hello
'
,
'
there
'
,
'
world
'
...
...
@@ -509,7 +509,7 @@ suite('Editor Contrib - Line Operations', () => {
});
test
(
'
should work with undo/redo
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
hello
'
,
'
there
'
,
'
world
'
...
...
@@ -551,7 +551,7 @@ suite('Editor Contrib - Line Operations', () => {
'
Second line
'
,
'
Third line
'
];
with
Mock
CodeEditor
(
TEXT
,
{},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
TEXT
,
{},
(
editor
,
cursor
)
=>
{
editor
.
setPosition
(
new
Position
(
lineNumber
,
column
));
let
insertLineBeforeAction
=
new
InsertLineBeforeAction
();
...
...
@@ -592,7 +592,7 @@ suite('Editor Contrib - Line Operations', () => {
'
Second line
'
,
'
Third line
'
];
with
Mock
CodeEditor
(
TEXT
,
{},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
TEXT
,
{},
(
editor
,
cursor
)
=>
{
editor
.
setPosition
(
new
Position
(
lineNumber
,
column
));
let
insertLineAfterAction
=
new
InsertLineAfterAction
();
...
...
@@ -641,7 +641,7 @@ suite('Editor Contrib - Line Operations', () => {
}
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
let
indentLinesAction
=
new
IndentLinesAction
();
editor
.
setPosition
(
new
Position
(
1
,
2
));
...
...
src/vs/editor/contrib/multicursor/test/multicursor.test.ts
浏览文件 @
dc517c0a
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
with
MockCodeEditor
,
Mock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
with
TestCodeEditor
,
Test
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
InsertCursorAbove
,
InsertCursorBelow
,
MultiCursorSelectionController
,
SelectHighlightsAction
,
AddSelectionToNextFindMatchAction
}
from
'
vs/editor/contrib/multicursor/common/multicursor
'
;
...
...
@@ -17,7 +17,7 @@ import { CommonFindController } from 'vs/editor/contrib/find/common/findControll
suite
(
'
Multicursor
'
,
()
=>
{
test
(
'
issue #2205: Multi-cursor pastes in reverse order
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
abc
'
,
'
def
'
],
{},
(
editor
,
cursor
)
=>
{
...
...
@@ -35,7 +35,7 @@ suite('Multicursor', () => {
});
test
(
'
issue #1336: Insert cursor below on last line adds a cursor to the end of the current line
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
abc
'
],
{},
(
editor
,
cursor
)
=>
{
let
addCursorDownAction
=
new
InsertCursorBelow
();
...
...
@@ -60,7 +60,7 @@ suite('Multicursor selection', () => {
}
as
IStorageService
);
test
(
'
issue #8817: Cursor position changes when you cancel multicursor
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
var x = (3 * 5)
'
,
'
var y = (3 * 5)
'
,
'
var z = (3 * 5)
'
,
...
...
@@ -89,7 +89,7 @@ suite('Multicursor selection', () => {
});
test
(
'
issue #5400: "Select All Occurrences of Find Match" does not select all if find uses regex
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
something
'
,
'
someething
'
,
'
someeething
'
,
...
...
@@ -120,7 +120,7 @@ suite('Multicursor selection', () => {
});
test
(
'
AddSelectionToNextFindMatchAction can work with multiline
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
''
,
'
qwe
'
,
'
rty
'
,
...
...
@@ -154,7 +154,7 @@ suite('Multicursor selection', () => {
});
test
(
'
issue #6661: AddSelectionToNextFindMatchAction can work with touching ranges
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
abcabc
'
,
'
abc
'
,
'
abcabc
'
,
...
...
@@ -203,7 +203,7 @@ suite('Multicursor selection', () => {
});
test
(
'
issue #23541: Multiline Ctrl+D does not work in CRLF files
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
''
,
'
qwe
'
,
'
rty
'
,
...
...
@@ -238,8 +238,8 @@ suite('Multicursor selection', () => {
});
});
function
testMulticursor
(
text
:
string
[],
callback
:
(
editor
:
Mock
CodeEditor
,
findController
:
CommonFindController
)
=>
void
):
void
{
with
Mock
CodeEditor
(
text
,
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
function
testMulticursor
(
text
:
string
[],
callback
:
(
editor
:
Test
CodeEditor
,
findController
:
CommonFindController
)
=>
void
):
void
{
with
Test
CodeEditor
(
text
,
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
CommonFindController
>
(
CommonFindController
);
let
multiCursorSelectController
=
editor
.
registerAndInstantiateContribution
<
MultiCursorSelectionController
>
(
MultiCursorSelectionController
);
...
...
@@ -250,7 +250,7 @@ suite('Multicursor selection', () => {
});
}
function
testAddSelectionToNextFindMatchAction
(
text
:
string
[],
callback
:
(
editor
:
Mock
CodeEditor
,
action
:
AddSelectionToNextFindMatchAction
,
findController
:
CommonFindController
)
=>
void
):
void
{
function
testAddSelectionToNextFindMatchAction
(
text
:
string
[],
callback
:
(
editor
:
Test
CodeEditor
,
action
:
AddSelectionToNextFindMatchAction
,
findController
:
CommonFindController
)
=>
void
):
void
{
testMulticursor
(
text
,
(
editor
,
findController
)
=>
{
let
action
=
new
AddSelectionToNextFindMatchAction
();
callback
(
editor
,
action
,
findController
);
...
...
src/vs/editor/contrib/quickFix/test/quickFixModel.test.ts
浏览文件 @
dc517c0a
...
...
@@ -9,7 +9,7 @@ import { ICommonCodeEditor } from 'vs/editor/common/editorCommon';
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Model
}
from
'
vs/editor/common/model/model
'
;
import
{
mock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
createTest
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
MarkerService
}
from
'
vs/platform/markers/common/markerService
'
;
import
{
QuickFixOracle
}
from
'
vs/editor/contrib/quickFix/browser/quickFixModel
'
;
import
{
CodeActionProviderRegistry
,
LanguageIdentifier
}
from
'
vs/editor/common/modes
'
;
...
...
@@ -33,7 +33,7 @@ suite('QuickFix', () => {
});
markerService
=
new
MarkerService
();
model
=
Model
.
createFromString
(
'
foobar foo bar
\n
farboo far boo
'
,
undefined
,
languageIdentifier
,
uri
);
editor
=
mockCodeEditor
([],
{
model
}
);
editor
=
createTestCodeEditor
(
model
);
editor
.
setPosition
({
lineNumber
:
1
,
column
:
1
});
});
...
...
src/vs/editor/contrib/snippet/test/snippetController2.old.test.ts
浏览文件 @
dc517c0a
...
...
@@ -8,7 +8,7 @@ import * as assert from 'assert';
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
SnippetController2
}
from
'
vs/editor/contrib/snippet/browser/snippetController2
'
;
import
{
MockCodeEditor
,
withMock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
TestCodeEditor
,
withTest
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
Cursor
}
from
'
vs/editor/common/controller/cursor
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
...
...
@@ -30,7 +30,7 @@ class TestSnippetController extends SnippetController2 {
suite
(
'
SnippetController
'
,
()
=>
{
function
snippetTest
(
cb
:
(
editor
:
Mock
CodeEditor
,
cursor
:
Cursor
,
template
:
string
,
snippetController
:
TestSnippetController
)
=>
void
,
lines
?:
string
[]):
void
{
function
snippetTest
(
cb
:
(
editor
:
Test
CodeEditor
,
cursor
:
Cursor
,
template
:
string
,
snippetController
:
TestSnippetController
)
=>
void
,
lines
?:
string
[]):
void
{
if
(
!
lines
)
{
lines
=
[
...
...
@@ -42,7 +42,7 @@ suite('SnippetController', () => {
];
}
with
Mock
CodeEditor
(
lines
,
{},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
lines
,
{},
(
editor
,
cursor
)
=>
{
editor
.
getModel
().
updateOptions
({
insertSpaces
:
false
});
...
...
src/vs/editor/contrib/snippet/test/snippetController2.test.ts
浏览文件 @
dc517c0a
...
...
@@ -8,7 +8,7 @@ import * as assert from 'assert';
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
SnippetController2
}
from
'
vs/editor/contrib/snippet/browser/snippetController2
'
;
import
{
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
mock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
createTest
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
Model
}
from
'
vs/editor/common/model/model
'
;
import
{
MockContextKeyService
}
from
'
vs/platform/keybinding/test/common/mockKeybindingService
'
;
...
...
@@ -35,7 +35,7 @@ suite('SnippetController2', function () {
setup
(
function
()
{
contextKeys
=
new
MockContextKeyService
();
model
=
Model
.
createFromString
(
'
if
\n
$state
\n
fi
'
);
editor
=
mockCodeEditor
([],
{
model
}
);
editor
=
createTestCodeEditor
(
model
);
editor
.
setSelections
([
new
Selection
(
1
,
1
,
1
,
1
),
new
Selection
(
2
,
5
,
2
,
5
)]);
assert
.
equal
(
model
.
getEOL
(),
'
\n
'
);
});
...
...
src/vs/editor/contrib/snippet/test/snippetSession.test.ts
浏览文件 @
dc517c0a
...
...
@@ -10,7 +10,7 @@ import { Range } from 'vs/editor/common/core/range';
import
{
IPosition
,
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
SnippetSession
}
from
'
vs/editor/contrib/snippet/browser/snippetSession
'
;
import
{
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
mock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
createTest
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
Model
}
from
'
vs/editor/common/model/model
'
;
suite
(
'
SnippetSession
'
,
function
()
{
...
...
@@ -28,7 +28,7 @@ suite('SnippetSession', function () {
setup
(
function
()
{
model
=
Model
.
createFromString
(
'
function foo() {
\n
console.log(a);
\n
}
'
);
editor
=
mockCodeEditor
([],
{
model
}
);
editor
=
createTestCodeEditor
(
model
);
editor
.
setSelections
([
new
Selection
(
1
,
1
,
1
,
1
),
new
Selection
(
2
,
5
,
2
,
5
)]);
assert
.
equal
(
model
.
getEOL
(),
'
\n
'
);
});
...
...
src/vs/editor/contrib/suggest/test/suggestModel.test.ts
浏览文件 @
dc517c0a
...
...
@@ -13,7 +13,7 @@ import { Model } from 'vs/editor/common/model/model';
import
{
ICommonCodeEditor
,
Handler
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ISuggestSupport
,
ISuggestResult
,
SuggestRegistry
,
SuggestTriggerKind
}
from
'
vs/editor/common/modes
'
;
import
{
SuggestModel
,
LineContext
}
from
'
vs/editor/contrib/suggest/browser/suggestModel
'
;
import
{
Mock
CodeEditor
,
MockScopeLocation
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
Test
CodeEditor
,
MockScopeLocation
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
InstantiationService
}
from
'
vs/platform/instantiation/common/instantiationService
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -23,7 +23,7 @@ import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtil
import
{
EditOperation
}
from
'
vs/editor/common/core/editOperation
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
function
createMockEditor
(
model
:
Model
):
Mock
CodeEditor
{
function
createMockEditor
(
model
:
Model
):
Test
CodeEditor
{
const
contextKeyService
=
new
MockContextKeyService
();
const
telemetryService
=
NullTelemetryService
;
const
instantiationService
=
new
InstantiationService
(
new
ServiceCollection
(
...
...
@@ -31,7 +31,7 @@ function createMockEditor(model: Model): MockCodeEditor {
[
ITelemetryService
,
telemetryService
]
));
const
editor
=
new
Mock
CodeEditor
(
new
MockScopeLocation
(),
{},
instantiationService
,
contextKeyService
);
const
editor
=
new
Test
CodeEditor
(
new
MockScopeLocation
(),
{},
instantiationService
,
contextKeyService
);
editor
.
setModel
(
model
);
return
editor
;
}
...
...
src/vs/editor/contrib/wordOperations/test/wordOperations.test.ts
浏览文件 @
dc517c0a
...
...
@@ -8,7 +8,7 @@ import * as assert from 'assert';
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
with
Mock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
with
Test
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
CursorWordLeft
,
CursorWordLeftSelect
,
CursorWordStartLeft
,
CursorWordEndLeft
,
CursorWordStartLeftSelect
,
CursorWordEndLeftSelect
,
...
...
@@ -81,7 +81,7 @@ suite('WordOperations', () => {
}
test
(
'
move word left
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
'
Third Line🐶
'
,
...
...
@@ -118,7 +118,7 @@ suite('WordOperations', () => {
});
test
(
'
move word left selection
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
'
Third Line🐶
'
,
...
...
@@ -132,7 +132,7 @@ suite('WordOperations', () => {
});
test
(
'
issue #832: moveWordLeft
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
/* Just some more text a+= 3 +5-3 + 7 */
'
],
{},
(
editor
,
_
)
=>
{
editor
.
setPosition
(
new
Position
(
1
,
50
));
...
...
@@ -156,7 +156,7 @@ suite('WordOperations', () => {
});
test
(
'
moveWordStartLeft
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
/* Just some more text a+= 3 +5-3 + 7 */
'
],
{},
(
editor
,
_
)
=>
{
editor
.
setPosition
(
new
Position
(
1
,
50
));
...
...
@@ -180,7 +180,7 @@ suite('WordOperations', () => {
});
test
(
'
moveWordEndLeft
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
/* Just some more text a+= 3 +5-3 + 7 */
'
],
{},
(
editor
,
_
)
=>
{
editor
.
setPosition
(
new
Position
(
1
,
50
));
...
...
@@ -205,7 +205,7 @@ suite('WordOperations', () => {
});
test
(
'
move word right
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
'
Third Line🐶
'
,
...
...
@@ -240,7 +240,7 @@ suite('WordOperations', () => {
});
test
(
'
move word right selection
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
'
Third Line🐶
'
,
...
...
@@ -254,7 +254,7 @@ suite('WordOperations', () => {
});
test
(
'
issue #832: moveWordRight
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
/* Just some more text a+= 3 +5-3 + 7 */
'
],
{},
(
editor
,
_
)
=>
{
editor
.
setPosition
(
new
Position
(
1
,
1
));
...
...
@@ -280,7 +280,7 @@ suite('WordOperations', () => {
});
test
(
'
moveWordEndRight
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
/* Just some more text a+= 3 +5-3 + 7 */
'
],
{},
(
editor
,
_
)
=>
{
editor
.
setPosition
(
new
Position
(
1
,
1
));
...
...
@@ -306,7 +306,7 @@ suite('WordOperations', () => {
});
test
(
'
moveWordStartRight
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
/* Just some more text a+= 3 +5-3 + 7 */
'
],
{},
(
editor
,
_
)
=>
{
editor
.
setPosition
(
new
Position
(
1
,
1
));
...
...
@@ -331,7 +331,7 @@ suite('WordOperations', () => {
});
test
(
'
delete word left for non-empty selection
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
'
Third Line🐶
'
,
...
...
@@ -347,7 +347,7 @@ suite('WordOperations', () => {
});
test
(
'
delete word left for caret at beginning of document
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
'
Third Line🐶
'
,
...
...
@@ -363,7 +363,7 @@ suite('WordOperations', () => {
});
test
(
'
delete word left for caret at end of whitespace
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
'
Third Line🐶
'
,
...
...
@@ -379,7 +379,7 @@ suite('WordOperations', () => {
});
test
(
'
delete word left for caret just behind a word
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
'
Third Line🐶
'
,
...
...
@@ -395,7 +395,7 @@ suite('WordOperations', () => {
});
test
(
'
delete word left for caret inside of a word
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
'
Third Line🐶
'
,
...
...
@@ -411,7 +411,7 @@ suite('WordOperations', () => {
});
test
(
'
delete word right for non-empty selection
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
'
Third Line🐶
'
,
...
...
@@ -427,7 +427,7 @@ suite('WordOperations', () => {
});
test
(
'
delete word right for caret at end of document
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
'
Third Line🐶
'
,
...
...
@@ -443,7 +443,7 @@ suite('WordOperations', () => {
});
test
(
'
delete word right for caret at beggining of whitespace
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
'
Third Line🐶
'
,
...
...
@@ -459,7 +459,7 @@ suite('WordOperations', () => {
});
test
(
'
delete word right for caret just before a word
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
'
Third Line🐶
'
,
...
...
@@ -475,7 +475,7 @@ suite('WordOperations', () => {
});
test
(
'
delete word right for caret inside of a word
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
'
Third Line🐶
'
,
...
...
@@ -491,7 +491,7 @@ suite('WordOperations', () => {
});
test
(
'
issue #832: deleteWordLeft
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
/* Just some text a+= 3 +5 */
'
],
{},
(
editor
,
_
)
=>
{
const
model
=
editor
.
getModel
();
...
...
@@ -512,7 +512,7 @@ suite('WordOperations', () => {
});
test
(
'
deleteWordStartLeft
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
/* Just some text a+= 3 +5 */
'
],
{},
(
editor
,
_
)
=>
{
const
model
=
editor
.
getModel
();
...
...
@@ -533,7 +533,7 @@ suite('WordOperations', () => {
});
test
(
'
deleteWordEndLeft
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
/* Just some text a+= 3 +5 */
'
],
{},
(
editor
,
_
)
=>
{
const
model
=
editor
.
getModel
();
...
...
@@ -553,7 +553,7 @@ suite('WordOperations', () => {
});
test
(
'
issue #24947
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
{
'
,
'
}
'
],
{},
(
editor
,
_
)
=>
{
...
...
@@ -562,7 +562,7 @@ suite('WordOperations', () => {
deleteWordLeft
(
editor
);
assert
.
equal
(
model
.
getLineContent
(
1
),
'
{}
'
);
});
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
{
'
,
'
}
'
],
{},
(
editor
,
_
)
=>
{
...
...
@@ -571,7 +571,7 @@ suite('WordOperations', () => {
deleteWordStartLeft
(
editor
);
assert
.
equal
(
model
.
getLineContent
(
1
),
'
{}
'
);
});
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
{
'
,
'
}
'
],
{},
(
editor
,
_
)
=>
{
...
...
@@ -582,7 +582,7 @@ suite('WordOperations', () => {
});
test
(
'
issue #832: deleteWordRight
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
/* Just some text a+= 3 +5-3 */
'
],
{},
(
editor
,
_
)
=>
{
const
model
=
editor
.
getModel
();
...
...
@@ -604,7 +604,7 @@ suite('WordOperations', () => {
});
test
(
'
issue #3882: deleteWordRight
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
public void Add( int x,
'
,
'
int y )
'
],
{},
(
editor
,
_
)
=>
{
...
...
@@ -615,7 +615,7 @@ suite('WordOperations', () => {
});
test
(
'
issue #3882: deleteWordStartRight
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
public void Add( int x,
'
,
'
int y )
'
],
{},
(
editor
,
_
)
=>
{
...
...
@@ -626,7 +626,7 @@ suite('WordOperations', () => {
});
test
(
'
issue #3882: deleteWordEndRight
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
public void Add( int x,
'
,
'
int y )
'
],
{},
(
editor
,
_
)
=>
{
...
...
@@ -637,7 +637,7 @@ suite('WordOperations', () => {
});
test
(
'
deleteWordStartRight
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
/* Just some text a+= 3 +5-3 */
'
],
{},
(
editor
,
_
)
=>
{
const
model
=
editor
.
getModel
();
...
...
@@ -660,7 +660,7 @@ suite('WordOperations', () => {
});
test
(
'
deleteWordEndRight
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
/* Just some text a+= 3 +5-3 */
'
],
{},
(
editor
,
_
)
=>
{
const
model
=
editor
.
getModel
();
...
...
@@ -681,7 +681,7 @@ suite('WordOperations', () => {
});
test
(
'
issue #3882 (1): Ctrl+Delete removing entire line when used at the end of line
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
A line with text.
'
,
'
And another one
'
],
{},
(
editor
,
_
)
=>
{
...
...
@@ -692,7 +692,7 @@ suite('WordOperations', () => {
});
test
(
'
issue #3882 (2): Ctrl+Delete removing entire line when used at the end of line
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
A line with text.
'
,
'
And another one
'
],
{},
(
editor
,
_
)
=>
{
...
...
src/vs/editor/test/browser/commands/sideEditing.test.ts
浏览文件 @
dc517c0a
...
...
@@ -10,14 +10,14 @@ import { Position } from 'vs/editor/common/core/position';
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
IIdentifiedSingleEditOperation
}
from
'
vs/editor/common/editorCommon
'
;
import
{
with
Mock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
with
Test
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
Model
}
from
'
vs/editor/common/model/model
'
;
import
{
TestConfiguration
}
from
'
vs/editor/test/common/mocks/testConfiguration
'
;
import
{
ViewModel
}
from
'
vs/editor/common/viewModel/viewModelImpl
'
;
import
{
Cursor
}
from
'
vs/editor/common/controller/cursor
'
;
function
testCommand
(
lines
:
string
[],
selections
:
Selection
[],
edits
:
IIdentifiedSingleEditOperation
[],
expectedLines
:
string
[],
expectedSelections
:
Selection
[]):
void
{
with
Mock
CodeEditor
(
lines
,
{},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
lines
,
{},
(
editor
,
cursor
)
=>
{
const
model
=
editor
.
getModel
();
cursor
.
setSelections
(
'
tests
'
,
selections
);
...
...
src/vs/editor/test/browser/controller/cursor.test.ts
浏览文件 @
dc517c0a
...
...
@@ -23,7 +23,7 @@ import { MockMode } from 'vs/editor/test/common/mocks/mockMode';
import
{
LanguageIdentifier
}
from
'
vs/editor/common/modes
'
;
import
{
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
CoreNavigationCommands
,
CoreEditingCommands
}
from
'
vs/editor/common/controller/coreCommands
'
;
import
{
with
Mock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
with
Test
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
TextModel
}
from
'
vs/editor/common/model/textModel
'
;
import
{
ViewModel
}
from
'
vs/editor/common/viewModel/viewModelImpl
'
;
let
H
=
Handler
;
...
...
@@ -696,7 +696,7 @@ suite('Editor Controller - Cursor', () => {
});
test
(
'
column select 1
'
,
()
=>
{
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
\t
private compute(a:number): boolean {
'
,
'
\t\t
if (a + 3 === 0 || a + 5 === 0) {
'
,
'
\t\t\t
return false;
'
,
...
...
@@ -1146,7 +1146,7 @@ suite('Editor Controller - Regression tests', () => {
},
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
cursor
.
setSelections
(
'
test
'
,
[
new
Selection
(
1
,
1
,
1
,
13
)]);
// Check that indenting maintains the selection start at column 1
...
...
@@ -1171,7 +1171,7 @@ suite('Editor Controller - Regression tests', () => {
},
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
cursorCommand
(
cursor
,
H
.
Type
,
{
text
:
'
\n
'
},
'
keyboard
'
);
assert
.
equal
(
model
.
getValue
(
EndOfLinePreference
.
LF
),
'
\n
'
,
'
assert1
'
);
...
...
@@ -1237,7 +1237,7 @@ suite('Editor Controller - Regression tests', () => {
mode
.
getLanguageIdentifier
()
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
1
,
6
,
false
);
assertCursor
(
cursor
,
new
Selection
(
1
,
6
,
1
,
6
));
...
...
@@ -1264,7 +1264,7 @@ suite('Editor Controller - Regression tests', () => {
}
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
1
,
7
,
false
);
assertCursor
(
cursor
,
new
Selection
(
1
,
7
,
1
,
7
));
...
...
@@ -1296,7 +1296,7 @@ suite('Editor Controller - Regression tests', () => {
},
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
7
,
1
,
false
);
assertCursor
(
cursor
,
new
Selection
(
7
,
1
,
7
,
1
));
...
...
@@ -1311,7 +1311,7 @@ suite('Editor Controller - Regression tests', () => {
test
(
'
bug #16740: [editor] Cut line doesn
\'
t quite cut the last line
'
,
()
=>
{
// Part 1 => there is text on the last line
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
asdasd
'
,
'
qwerty
'
],
{},
(
editor
,
cursor
)
=>
{
...
...
@@ -1327,7 +1327,7 @@ suite('Editor Controller - Regression tests', () => {
});
// Part 2 => there is no text on the last line
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
'
asdasd
'
,
''
],
{},
(
editor
,
cursor
)
=>
{
...
...
@@ -1385,7 +1385,7 @@ suite('Editor Controller - Regression tests', () => {
},
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
3
,
2
,
false
);
moveTo
(
cursor
,
1
,
14
,
true
);
assertCursor
(
cursor
,
new
Selection
(
3
,
2
,
1
,
14
));
...
...
@@ -1434,7 +1434,7 @@ suite('Editor Controller - Regression tests', () => {
}
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
1
,
1
,
false
);
moveTo
(
cursor
,
3
,
4
,
true
);
...
...
@@ -1516,7 +1516,7 @@ suite('Editor Controller - Regression tests', () => {
}
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
3
,
2
,
false
);
CoreEditingCommands
.
Tab
.
runEditorCommand
(
null
,
editor
,
null
);
assert
.
equal
(
model
.
getLineContent
(
3
),
'
\t
\t
x: 3
'
);
...
...
@@ -1540,7 +1540,7 @@ suite('Editor Controller - Regression tests', () => {
}
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
1
,
15
,
false
);
moveTo
(
cursor
,
1
,
22
,
true
);
CoreEditingCommands
.
Tab
.
runEditorCommand
(
null
,
editor
,
null
);
...
...
@@ -1636,7 +1636,7 @@ suite('Editor Controller - Regression tests', () => {
].
join
(
'
\n
'
)
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
CoreNavigationCommands
.
WordSelect
.
runCoreEditorCommand
(
cursor
,
{
position
:
new
Position
(
1
,
8
)
});
assert
.
deepEqual
(
cursor
.
getSelection
(),
new
Selection
(
1
,
6
,
1
,
10
));
...
...
@@ -1744,7 +1744,7 @@ suite('Editor Controller - Regression tests', () => {
test
(
'
issue #36740: wordwrap creates an extra step / character at the wrapping point
'
,
()
=>
{
// a single model line => 4 view lines
with
Mock
CodeEditor
([
with
Test
CodeEditor
([
[
'
Lorem ipsum
'
,
'
dolor sit amet
'
,
...
...
@@ -1824,7 +1824,7 @@ suite('Editor Controller - Cursor Configuration', () => {
}
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
// Tab on column 1
CoreNavigationCommands
.
MoveTo
.
runCoreEditorCommand
(
cursor
,
{
position
:
new
Position
(
2
,
1
)
});
CoreEditingCommands
.
Tab
.
runEditorCommand
(
null
,
editor
,
null
);
...
...
@@ -2053,7 +2053,7 @@ suite('Editor Controller - Cursor Configuration', () => {
}
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
3
,
1
);
CoreEditingCommands
.
Tab
.
runEditorCommand
(
null
,
editor
,
null
);
...
...
@@ -2097,7 +2097,7 @@ suite('Editor Controller - Cursor Configuration', () => {
}
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
// Move cursor to the end, verify that we do not trim whitespaces if line has values
moveTo
(
cursor
,
1
,
model
.
getLineContent
(
1
).
length
+
1
);
...
...
@@ -2163,7 +2163,7 @@ suite('Editor Controller - Cursor Configuration', () => {
}
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
,
useTabStops
:
false
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
,
useTabStops
:
false
},
(
editor
,
cursor
)
=>
{
// DeleteLeft removes just one whitespace
moveTo
(
cursor
,
2
,
9
);
CoreEditingCommands
.
DeleteLeft
.
runEditorCommand
(
null
,
editor
,
null
);
...
...
@@ -2189,7 +2189,7 @@ suite('Editor Controller - Cursor Configuration', () => {
}
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
,
useTabStops
:
true
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
,
useTabStops
:
true
},
(
editor
,
cursor
)
=>
{
// DeleteLeft does not remove tab size, because some text exists before
moveTo
(
cursor
,
2
,
model
.
getLineContent
(
2
).
length
+
1
);
CoreEditingCommands
.
DeleteLeft
.
runEditorCommand
(
null
,
editor
,
null
);
...
...
@@ -2260,7 +2260,7 @@ suite('Editor Controller - Cursor Configuration', () => {
}
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
cursorCommand
(
cursor
,
H
.
Type
,
{
text
:
'
\n
'
},
'
keyboard
'
);
assert
.
equal
(
model
.
getValue
(
EndOfLinePreference
.
LF
),
'
\n
'
,
'
assert1
'
);
...
...
@@ -2428,7 +2428,7 @@ suite('Editor Controller - Indentation Rules', () => {
mode
.
getLanguageIdentifier
()
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
,
autoIndent
:
true
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
,
autoIndent
:
true
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
2
,
11
,
false
);
assertCursor
(
cursor
,
new
Selection
(
2
,
11
,
2
,
11
));
...
...
@@ -2907,7 +2907,7 @@ suite('Editor Controller - Indentation Rules', () => {
mode
.
getLanguageIdentifier
()
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
4
,
1
,
false
);
assertCursor
(
cursor
,
new
Selection
(
4
,
1
,
4
,
1
));
...
...
@@ -2939,7 +2939,7 @@ suite('Editor Controller - Indentation Rules', () => {
mode
.
getLanguageIdentifier
()
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
4
,
2
,
false
);
assertCursor
(
cursor
,
new
Selection
(
4
,
2
,
4
,
2
));
...
...
@@ -2971,7 +2971,7 @@ suite('Editor Controller - Indentation Rules', () => {
mode
.
getLanguageIdentifier
()
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
4
,
1
,
false
);
assertCursor
(
cursor
,
new
Selection
(
4
,
1
,
4
,
1
));
...
...
@@ -3002,7 +3002,7 @@ suite('Editor Controller - Indentation Rules', () => {
mode
.
getLanguageIdentifier
()
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
4
,
3
,
false
);
assertCursor
(
cursor
,
new
Selection
(
4
,
3
,
4
,
3
));
...
...
@@ -3033,7 +3033,7 @@ suite('Editor Controller - Indentation Rules', () => {
mode
.
getLanguageIdentifier
()
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
4
,
4
,
false
);
assertCursor
(
cursor
,
new
Selection
(
4
,
4
,
4
,
4
));
...
...
@@ -3064,7 +3064,7 @@ suite('Editor Controller - Indentation Rules', () => {
mode
.
getLanguageIdentifier
()
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
3
,
1
);
CoreEditingCommands
.
Tab
.
runEditorCommand
(
null
,
editor
,
null
);
...
...
@@ -3100,7 +3100,7 @@ suite('Editor Controller - Indentation Rules', () => {
rubyMode
.
getLanguageIdentifier
()
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
,
autoIndent
:
true
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
,
autoIndent
:
true
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
4
,
7
,
false
);
assertCursor
(
cursor
,
new
Selection
(
4
,
7
,
4
,
7
));
...
...
@@ -3237,7 +3237,7 @@ suite('Editor Controller - Indentation Rules', () => {
mode
.
getLanguageIdentifier
()
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
,
autoIndent
:
false
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
,
autoIndent
:
false
},
(
editor
,
cursor
)
=>
{
moveTo
(
cursor
,
7
,
6
,
false
);
assertCursor
(
cursor
,
new
Selection
(
7
,
6
,
7
,
6
));
...
...
@@ -3841,7 +3841,7 @@ suite('autoClosingPairs', () => {
mode
.
getLanguageIdentifier
()
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
cursor
.
setSelections
(
'
test
'
,
[
new
Selection
(
1
,
4
,
1
,
4
),
new
Selection
(
1
,
10
,
1
,
10
),
...
...
@@ -3870,7 +3870,7 @@ suite('autoClosingPairs', () => {
].
join
(
'
\n
'
)
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
CoreNavigationCommands
.
WordSelect
.
runEditorCommand
(
null
,
editor
,
{
position
:
new
Position
(
3
,
7
)
});
...
...
@@ -3894,7 +3894,7 @@ suite('Undo stops', () => {
].
join
(
'
\n
'
)
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
cursor
.
setSelections
(
'
test
'
,
[
new
Selection
(
1
,
3
,
1
,
3
)]);
cursorCommand
(
cursor
,
H
.
Type
,
{
text
:
'
first
'
},
'
keyboard
'
);
assert
.
equal
(
model
.
getLineContent
(
1
),
'
A first line
'
);
...
...
@@ -3923,7 +3923,7 @@ suite('Undo stops', () => {
].
join
(
'
\n
'
)
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
cursor
.
setSelections
(
'
test
'
,
[
new
Selection
(
1
,
3
,
1
,
3
)]);
cursorCommand
(
cursor
,
H
.
Type
,
{
text
:
'
first
'
},
'
keyboard
'
);
assert
.
equal
(
model
.
getLineContent
(
1
),
'
A first line
'
);
...
...
@@ -3952,7 +3952,7 @@ suite('Undo stops', () => {
].
join
(
'
\n
'
)
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
cursor
.
setSelections
(
'
test
'
,
[
new
Selection
(
2
,
8
,
2
,
8
)]);
CoreEditingCommands
.
DeleteLeft
.
runEditorCommand
(
null
,
editor
,
null
);
CoreEditingCommands
.
DeleteLeft
.
runEditorCommand
(
null
,
editor
,
null
);
...
...
@@ -3986,7 +3986,7 @@ suite('Undo stops', () => {
].
join
(
'
\n
'
)
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
cursor
.
setSelections
(
'
test
'
,
[
new
Selection
(
2
,
8
,
2
,
8
)]);
CoreEditingCommands
.
DeleteLeft
.
runEditorCommand
(
null
,
editor
,
null
);
CoreEditingCommands
.
DeleteLeft
.
runEditorCommand
(
null
,
editor
,
null
);
...
...
@@ -4024,7 +4024,7 @@ suite('Undo stops', () => {
].
join
(
'
\n
'
)
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
cursor
.
setSelections
(
'
test
'
,
[
new
Selection
(
2
,
9
,
2
,
9
)]);
CoreEditingCommands
.
DeleteRight
.
runEditorCommand
(
null
,
editor
,
null
);
CoreEditingCommands
.
DeleteRight
.
runEditorCommand
(
null
,
editor
,
null
);
...
...
@@ -4055,7 +4055,7 @@ suite('Undo stops', () => {
].
join
(
'
\n
'
)
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
cursor
.
setSelections
(
'
test
'
,
[
new
Selection
(
2
,
9
,
2
,
9
)]);
CoreEditingCommands
.
DeleteRight
.
runEditorCommand
(
null
,
editor
,
null
);
CoreEditingCommands
.
DeleteRight
.
runEditorCommand
(
null
,
editor
,
null
);
...
...
@@ -4091,7 +4091,7 @@ suite('Undo stops', () => {
].
join
(
'
\n
'
)
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
cursor
.
setSelections
(
'
test
'
,
[
new
Selection
(
1
,
3
,
1
,
3
)]);
cursorCommand
(
cursor
,
H
.
Type
,
{
text
:
'
first and interesting
'
},
'
keyboard
'
);
assert
.
equal
(
model
.
getLineContent
(
1
),
'
A first and interesting line
'
);
...
...
src/vs/editor/test/browser/testCodeEditor.ts
浏览文件 @
dc517c0a
...
...
@@ -17,7 +17,7 @@ import { TestConfiguration } from 'vs/editor/test/common/mocks/testConfiguration
import
*
as
editorOptions
from
'
vs/editor/common/config/editorOptions
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
export
class
Mock
CodeEditor
extends
CommonCodeEditor
{
export
class
Test
CodeEditor
extends
CommonCodeEditor
{
public
_isFocused
=
true
;
...
...
@@ -67,7 +67,7 @@ export class MockScopeLocation implements IContextKeyServiceTarget {
getAttribute
(
attr
:
string
):
string
{
return
undefined
;
}
}
export
interface
Mock
CodeEditorCreationOptions
extends
editorOptions
.
IEditorOptions
{
export
interface
Test
CodeEditorCreationOptions
extends
editorOptions
.
IEditorOptions
{
/**
* The initial model associated with this code editor.
*/
...
...
@@ -75,7 +75,7 @@ export interface MockCodeEditorCreationOptions extends editorOptions.IEditorOpti
serviceCollection
?:
ServiceCollection
;
}
export
function
with
MockCodeEditor
(
text
:
string
[],
options
:
MockCodeEditorCreationOptions
,
callback
:
(
editor
:
Mock
CodeEditor
,
cursor
:
Cursor
)
=>
void
):
void
{
export
function
with
TestCodeEditor
(
text
:
string
[],
options
:
TestCodeEditorCreationOptions
,
callback
:
(
editor
:
Test
CodeEditor
,
cursor
:
Cursor
)
=>
void
):
void
{
// create a model if necessary and remember it in order to dispose it.
let
modelToDispose
:
Model
=
null
;
if
(
!
options
.
model
)
{
...
...
@@ -83,7 +83,7 @@ export function withMockCodeEditor(text: string[], options: MockCodeEditorCreati
options
.
model
=
modelToDispose
;
}
let
editor
=
<
MockCodeEditor
>
_mock
CodeEditor
(
options
);
let
editor
=
<
TestCodeEditor
>
_createTest
CodeEditor
(
options
);
callback
(
editor
,
editor
.
getCursor
());
if
(
modelToDispose
)
{
...
...
@@ -92,15 +92,11 @@ export function withMockCodeEditor(text: string[], options: MockCodeEditorCreati
editor
.
dispose
();
}
export
function
mockCodeEditor
(
text
:
string
[],
options
:
MockCodeEditorCreationOptions
):
CommonCodeEditor
{
// TODO: who owns this model now?
if
(
!
options
.
model
)
{
options
.
model
=
Model
.
createFromString
(
text
.
join
(
'
\n
'
));
}
return
_mockCodeEditor
(
options
);
export
function
createTestCodeEditor
(
model
:
editorCommon
.
IModel
):
CommonCodeEditor
{
return
_createTestCodeEditor
({
model
:
model
});
}
function
_
mockCodeEditor
(
options
:
Mock
CodeEditorCreationOptions
):
CommonCodeEditor
{
function
_
createTestCodeEditor
(
options
:
Test
CodeEditorCreationOptions
):
CommonCodeEditor
{
let
contextKeyService
=
new
MockContextKeyService
();
...
...
@@ -108,7 +104,7 @@ function _mockCodeEditor(options: MockCodeEditorCreationOptions): CommonCodeEdit
services
.
set
(
IContextKeyService
,
contextKeyService
);
let
instantiationService
=
new
InstantiationService
(
services
);
let
editor
=
new
Mock
CodeEditor
(
new
MockScopeLocation
(),
options
,
instantiationService
,
contextKeyService
);
let
editor
=
new
Test
CodeEditor
(
new
MockScopeLocation
(),
options
,
instantiationService
,
contextKeyService
);
editor
.
setModel
(
options
.
model
);
return
editor
;
}
src/vs/editor/test/browser/testCommand.ts
浏览文件 @
dc517c0a
...
...
@@ -10,7 +10,7 @@ import { Selection } from 'vs/editor/common/core/selection';
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
Model
}
from
'
vs/editor/common/model/model
'
;
import
{
LanguageIdentifier
}
from
'
vs/editor/common/modes
'
;
import
{
with
Mock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
with
Test
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
export
function
testCommand
(
lines
:
string
[],
...
...
@@ -21,7 +21,7 @@ export function testCommand(
expectedSelection
:
Selection
):
void
{
let
model
=
Model
.
createFromString
(
lines
.
join
(
'
\n
'
),
undefined
,
languageIdentifier
);
with
Mock
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
with
Test
CodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
cursor
.
setSelections
(
'
tests
'
,
[
selection
]);
...
...
src/vs/workbench/parts/emmet/test/electron-browser/emmetAction.test.ts
浏览文件 @
dc517c0a
...
...
@@ -6,7 +6,7 @@
'
use strict
'
;
import
{
IGrammarContributions
,
ILanguageIdentifierResolver
,
EmmetEditorAction
}
from
'
vs/workbench/parts/emmet/electron-browser/emmetActions
'
;
import
{
with
Mock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
with
Test
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
assert
=
require
(
'
assert
'
);
import
{
LanguageId
,
LanguageIdentifier
}
from
'
vs/editor/common/modes
'
;
...
...
@@ -43,7 +43,7 @@ class MockGrammarContributions implements IGrammarContributions {
suite
(
'
Emmet
'
,
()
=>
{
test
(
'
Get language mode and parent mode for emmet
'
,
()
=>
{
with
Mock
CodeEditor
([],
{},
(
editor
)
=>
{
with
Test
CodeEditor
([],
{},
(
editor
)
=>
{
function
testIsEnabled
(
mode
:
string
,
scopeName
:
string
,
expectedLanguage
?:
string
,
expectedParentLanguage
?:
string
)
{
const
languageIdentifier
=
new
LanguageIdentifier
(
mode
,
73
);
...
...
src/vs/workbench/test/browser/parts/editor/rangeDecorations.test.ts
浏览文件 @
dc517c0a
...
...
@@ -13,7 +13,7 @@ import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
import
WorkbenchEditorService
=
require
(
'
vs/workbench/services/editor/common/editorService
'
);
import
{
RangeHighlightDecorations
}
from
'
vs/workbench/common/editor/rangeDecorations
'
;
import
{
Model
}
from
'
vs/editor/common/model/model
'
;
import
{
mock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
createTest
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditorInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
FileEditorInput
}
from
'
vs/workbench/parts/files/common/editors/fileEditorInput
'
;
...
...
@@ -41,7 +41,7 @@ suite('Editor - Range decorations', () => {
instantiationService
.
stub
(
IModelService
,
stubModelService
(
instantiationService
));
text
=
'
LINE1
'
+
'
\n
'
+
'
LINE2
'
+
'
\n
'
+
'
LINE3
'
+
'
\n
'
+
'
LINE4
'
+
'
\r\n
'
+
'
LINE5
'
;
model
=
aModel
(
URI
.
file
(
'
some_file
'
));
codeEditor
=
mockCodeEditor
([],
{
model
}
);
codeEditor
=
createTestCodeEditor
(
model
);
mockEditorService
(
codeEditor
.
getModel
().
uri
);
instantiationService
.
stub
(
WorkbenchEditorService
.
IWorkbenchEditorService
,
'
getActiveEditor
'
,
{
getControl
:
()
=>
{
return
codeEditor
;
}
});
...
...
src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts
浏览文件 @
dc517c0a
...
...
@@ -14,7 +14,7 @@ import { MockCodeEditorService } from 'vs/editor/test/common/mocks/mockCodeEdito
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
ExtHostDocumentsAndEditorsShape
,
IDocumentsAndEditorsDelta
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
mock
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
createTest
CodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
mock
}
from
'
vs/workbench/test/electron-browser/api/mock
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
Event
from
'
vs/base/common/event
'
;
...
...
@@ -103,7 +103,7 @@ suite('MainThreadDocumentsAndEditors', () => {
this
.
timeout
(
1000
*
60
);
// increase timeout for this one test
const
model
=
modelService
.
createModel
(
hugeModelString
,
null
,
null
);
const
editor
=
mockCodeEditor
(
null
,
{
model
,
wordWrap
:
'
off
'
,
wordWrapMinified
:
false
}
);
const
editor
=
createTestCodeEditor
(
model
);
assert
.
equal
(
deltas
.
length
,
1
);
deltas
.
length
=
0
;
...
...
@@ -112,7 +112,7 @@ suite('MainThreadDocumentsAndEditors', () => {
});
test
(
'
ignore editor w/o model
'
,
()
=>
{
const
editor
=
mockCodeEditor
([],
{}
);
const
editor
=
createTestCodeEditor
(
null
);
editor
.
setModel
(
null
);
codeEditorService
.
addCodeEditor
(
editor
);
assert
.
equal
(
deltas
.
length
,
1
);
...
...
@@ -128,7 +128,7 @@ suite('MainThreadDocumentsAndEditors', () => {
deltas
.
length
=
0
;
const
model
=
modelService
.
createModel
(
'
farboo
'
,
null
,
null
);
codeEditorService
.
addCodeEditor
(
mockCodeEditor
(
null
,
{
model
}
));
codeEditorService
.
addCodeEditor
(
createTestCodeEditor
(
model
));
assert
.
equal
(
deltas
.
length
,
2
);
const
[
first
,
second
]
=
deltas
;
...
...
@@ -148,7 +148,7 @@ suite('MainThreadDocumentsAndEditors', () => {
test
(
'
editor with dispos-ed/-ing model
'
,
()
=>
{
modelService
.
createModel
(
'
foobar
'
,
null
,
null
);
const
model
=
modelService
.
createModel
(
'
farboo
'
,
null
,
null
);
const
editor
=
mockCodeEditor
(
null
,
{
model
}
);
const
editor
=
createTestCodeEditor
(
model
);
codeEditorService
.
addCodeEditor
(
editor
);
// ignore things until now
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录