Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
2342d2e2
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,发现更多精彩内容 >>
提交
2342d2e2
编写于
5月 19, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify cursor.trigger
上级
80e93de8
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
18 addition
and
32 deletion
+18
-32
src/vs/editor/common/controller/cursor.ts
src/vs/editor/common/controller/cursor.ts
+0
-11
src/vs/editor/contrib/find/test/common/findModel.test.ts
src/vs/editor/contrib/find/test/common/findModel.test.ts
+5
-5
src/vs/editor/contrib/linesOperations/test/common/linesOperations.test.ts
...ntrib/linesOperations/test/common/linesOperations.test.ts
+2
-2
src/vs/editor/test/common/controller/cursor.test.ts
src/vs/editor/test/common/controller/cursor.test.ts
+9
-9
src/vs/workbench/test/common/editor/rangeDecorations.test.ts
src/vs/workbench/test/common/editor/rangeDecorations.test.ts
+2
-5
未找到文件。
src/vs/editor/common/controller/cursor.ts
浏览文件 @
2342d2e2
...
...
@@ -20,8 +20,6 @@ import { DeleteOperations } from 'vs/editor/common/controller/cursorDeleteOperat
import
{
TypeOperations
}
from
'
vs/editor/common/controller/cursorTypeOperations
'
;
import
{
TextModelEventType
,
ModelRawContentChangedEvent
,
RawContentChangedType
}
from
'
vs/editor/common/model/textModelEvents
'
;
import
{
CursorEventType
,
CursorChangeReason
,
ICursorPositionChangedEvent
,
VerticalRevealType
,
ICursorSelectionChangedEvent
,
ICursorRevealRangeEvent
,
CursorScrollRequest
}
from
'
vs/editor/common/controller/cursorEvents
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
CoreEditorCommand
}
from
'
vs/editor/common/controller/coreCommands
'
;
class
CursorOperationArgs
<
T
>
{
public
readonly
eventSource
:
string
;
...
...
@@ -486,14 +484,6 @@ export class Cursor extends Disposable implements ICursors {
public
trigger
(
source
:
string
,
handlerId
:
string
,
payload
:
any
):
void
{
if
(
!
this
.
_handlers
.
hasOwnProperty
(
handlerId
))
{
const
command
=
CommonEditorRegistry
.
getEditorCommand
(
handlerId
);
if
(
!
command
||
!
(
command
instanceof
CoreEditorCommand
))
{
return
;
}
payload
=
payload
||
{};
payload
.
source
=
source
;
command
.
runCoreEditorCommand
(
this
,
payload
);
return
;
}
const
handler
=
this
.
_handlers
[
handlerId
];
...
...
@@ -509,7 +499,6 @@ export class Cursor extends Disposable implements ICursors {
this
.
_handlers
[
H
.
CompositionStart
]
=
(
args
)
=>
this
.
_compositionStart
(
args
);
this
.
_handlers
[
H
.
CompositionEnd
]
=
(
args
)
=>
this
.
_compositionEnd
(
args
);
this
.
_handlers
[
H
.
Paste
]
=
(
args
)
=>
this
.
_paste
(
args
);
this
.
_handlers
[
H
.
Cut
]
=
(
args
)
=>
this
.
_cut
(
args
);
this
.
_handlers
[
H
.
Undo
]
=
(
args
)
=>
this
.
_undo
(
args
);
...
...
src/vs/editor/contrib/find/test/common/findModel.test.ts
浏览文件 @
2342d2e2
...
...
@@ -303,7 +303,7 @@ suite('FindModel', () => {
]
);
curs
or
.
trigger
(
'
mouse
'
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
edit
or
.
trigger
(
'
mouse
'
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
position
:
new
Position
(
6
,
20
)
});
...
...
@@ -663,7 +663,7 @@ suite('FindModel', () => {
]
);
curs
or
.
trigger
(
'
mouse
'
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
edit
or
.
trigger
(
'
mouse
'
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
position
:
new
Position
(
6
,
20
)
});
assertFindState
(
...
...
@@ -1150,7 +1150,7 @@ suite('FindModel', () => {
]
);
curs
or
.
trigger
(
'
mouse
'
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
edit
or
.
trigger
(
'
mouse
'
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
position
:
new
Position
(
6
,
20
)
});
assertFindState
(
...
...
@@ -1311,7 +1311,7 @@ suite('FindModel', () => {
]
);
curs
or
.
trigger
(
'
mouse
'
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
edit
or
.
trigger
(
'
mouse
'
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
position
:
new
Position
(
6
,
20
)
});
assertFindState
(
...
...
@@ -1741,7 +1741,7 @@ suite('FindModel', () => {
findState
.
change
({
searchString
:
'
hello(?=
\\
sworld)
'
,
replaceString
:
'
hi
'
,
isRegex
:
true
},
false
);
let
findModel
=
new
FindModelBoundToEditorModel
(
editor
,
findState
);
curs
or
.
trigger
(
'
mouse
'
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
edit
or
.
trigger
(
'
mouse
'
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
position
:
new
Position
(
8
,
14
)
});
...
...
src/vs/editor/contrib/linesOperations/test/common/linesOperations.test.ts
浏览文件 @
2342d2e2
...
...
@@ -478,13 +478,13 @@ suite('Editor Contrib - Line Operations', () => {
new
Selection
(
2
,
4
,
2
,
4
)
]);
curs
or
.
trigger
(
'
tests
'
,
Handler
.
Undo
,
{});
edit
or
.
trigger
(
'
tests
'
,
Handler
.
Undo
,
{});
assert
.
deepEqual
(
editor
.
getSelections
(),
[
new
Selection
(
1
,
3
,
1
,
3
),
new
Selection
(
1
,
6
,
1
,
6
),
new
Selection
(
3
,
4
,
3
,
4
)
]);
curs
or
.
trigger
(
'
tests
'
,
Handler
.
Redo
,
{});
edit
or
.
trigger
(
'
tests
'
,
Handler
.
Redo
,
{});
assert
.
deepEqual
(
editor
.
getSelections
(),
[
new
Selection
(
1
,
3
,
1
,
3
),
new
Selection
(
2
,
4
,
2
,
4
)
...
...
src/vs/editor/test/common/controller/cursor.test.ts
浏览文件 @
2342d2e2
...
...
@@ -1863,7 +1863,7 @@ suite('Editor Controller - Cursor Configuration', () => {
],
modelOpts
:
{
insertSpaces
:
true
,
tabSize
:
4
,
detectIndentation
:
false
,
defaultEOL
:
DefaultEndOfLine
.
LF
,
trimAutoWhitespace
:
true
}
},
(
model
,
cursor
)
=>
{
cursorCommand
(
cursor
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
position
:
new
Position
(
1
,
21
)
},
'
keyboard
'
);
CoreNavigationCommands
.
MoveTo
.
runCoreEditorCommand
(
cursor
,
{
position
:
new
Position
(
1
,
21
),
source
:
'
keyboard
'
}
);
cursorCommand
(
cursor
,
H
.
Type
,
{
text
:
'
\n
'
},
'
keyboard
'
);
assert
.
equal
(
model
.
getLineContent
(
1
),
'
\t
My First Line
\t
'
);
assert
.
equal
(
model
.
getLineContent
(
2
),
'
'
);
...
...
@@ -1890,56 +1890,56 @@ suite('Editor Controller - Cursor Configuration', () => {
withMockCodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
// Tab on column 1
cursorCommand
(
cursor
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
position
:
new
Position
(
2
,
1
)
},
'
keyboard
'
);
CoreNavigationCommands
.
MoveTo
.
runCoreEditorCommand
(
cursor
,
{
position
:
new
Position
(
2
,
1
)
}
);
CoreEditingCommands
.
Tab
.
runEditorCommand
(
null
,
editor
,
null
);
assert
.
equal
(
model
.
getLineContent
(
2
),
'
My Second Line123
'
);
cursorCommand
(
cursor
,
H
.
Undo
,
null
,
'
keyboard
'
);
// Tab on column 2
assert
.
equal
(
model
.
getLineContent
(
2
),
'
My Second Line123
'
);
cursorCommand
(
cursor
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
position
:
new
Position
(
2
,
2
)
},
'
keyboard
'
);
CoreNavigationCommands
.
MoveTo
.
runCoreEditorCommand
(
cursor
,
{
position
:
new
Position
(
2
,
2
)
}
);
CoreEditingCommands
.
Tab
.
runEditorCommand
(
null
,
editor
,
null
);
assert
.
equal
(
model
.
getLineContent
(
2
),
'
M y Second Line123
'
);
cursorCommand
(
cursor
,
H
.
Undo
,
null
,
'
keyboard
'
);
// Tab on column 3
assert
.
equal
(
model
.
getLineContent
(
2
),
'
My Second Line123
'
);
cursorCommand
(
cursor
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
position
:
new
Position
(
2
,
3
)
},
'
keyboard
'
);
CoreNavigationCommands
.
MoveTo
.
runCoreEditorCommand
(
cursor
,
{
position
:
new
Position
(
2
,
3
)
}
);
CoreEditingCommands
.
Tab
.
runEditorCommand
(
null
,
editor
,
null
);
assert
.
equal
(
model
.
getLineContent
(
2
),
'
My Second Line123
'
);
cursorCommand
(
cursor
,
H
.
Undo
,
null
,
'
keyboard
'
);
// Tab on column 4
assert
.
equal
(
model
.
getLineContent
(
2
),
'
My Second Line123
'
);
cursorCommand
(
cursor
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
position
:
new
Position
(
2
,
4
)
},
'
keyboard
'
);
CoreNavigationCommands
.
MoveTo
.
runCoreEditorCommand
(
cursor
,
{
position
:
new
Position
(
2
,
4
)
}
);
CoreEditingCommands
.
Tab
.
runEditorCommand
(
null
,
editor
,
null
);
assert
.
equal
(
model
.
getLineContent
(
2
),
'
My Second Line123
'
);
cursorCommand
(
cursor
,
H
.
Undo
,
null
,
'
keyboard
'
);
// Tab on column 5
assert
.
equal
(
model
.
getLineContent
(
2
),
'
My Second Line123
'
);
cursorCommand
(
cursor
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
position
:
new
Position
(
2
,
5
)
},
'
keyboard
'
);
CoreNavigationCommands
.
MoveTo
.
runCoreEditorCommand
(
cursor
,
{
position
:
new
Position
(
2
,
5
)
}
);
CoreEditingCommands
.
Tab
.
runEditorCommand
(
null
,
editor
,
null
);
assert
.
equal
(
model
.
getLineContent
(
2
),
'
My S econd Line123
'
);
cursorCommand
(
cursor
,
H
.
Undo
,
null
,
'
keyboard
'
);
// Tab on column 5
assert
.
equal
(
model
.
getLineContent
(
2
),
'
My Second Line123
'
);
cursorCommand
(
cursor
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
position
:
new
Position
(
2
,
5
)
},
'
keyboard
'
);
CoreNavigationCommands
.
MoveTo
.
runCoreEditorCommand
(
cursor
,
{
position
:
new
Position
(
2
,
5
)
}
);
CoreEditingCommands
.
Tab
.
runEditorCommand
(
null
,
editor
,
null
);
assert
.
equal
(
model
.
getLineContent
(
2
),
'
My S econd Line123
'
);
cursorCommand
(
cursor
,
H
.
Undo
,
null
,
'
keyboard
'
);
// Tab on column 13
assert
.
equal
(
model
.
getLineContent
(
2
),
'
My Second Line123
'
);
cursorCommand
(
cursor
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
position
:
new
Position
(
2
,
13
)
},
'
keyboard
'
);
CoreNavigationCommands
.
MoveTo
.
runCoreEditorCommand
(
cursor
,
{
position
:
new
Position
(
2
,
13
)
}
);
CoreEditingCommands
.
Tab
.
runEditorCommand
(
null
,
editor
,
null
);
assert
.
equal
(
model
.
getLineContent
(
2
),
'
My Second Li ne123
'
);
cursorCommand
(
cursor
,
H
.
Undo
,
null
,
'
keyboard
'
);
// Tab on column 14
assert
.
equal
(
model
.
getLineContent
(
2
),
'
My Second Line123
'
);
cursorCommand
(
cursor
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
position
:
new
Position
(
2
,
14
)
},
'
keyboard
'
);
CoreNavigationCommands
.
MoveTo
.
runCoreEditorCommand
(
cursor
,
{
position
:
new
Position
(
2
,
14
)
}
);
CoreEditingCommands
.
Tab
.
runEditorCommand
(
null
,
editor
,
null
);
assert
.
equal
(
model
.
getLineContent
(
2
),
'
My Second Lin e123
'
);
});
...
...
src/vs/workbench/test/common/editor/rangeDecorations.test.ts
浏览文件 @
2342d2e2
...
...
@@ -13,14 +13,13 @@ 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
{
mockCodeEditor
,
MockCodeEditor
}
from
'
vs/editor/test/common/mocks/mockCodeEditor
'
;
import
{
mockCodeEditor
}
from
'
vs/editor/test/common/mocks/mockCodeEditor
'
;
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
'
;
import
{
TextModel
}
from
'
vs/editor/common/model/textModel
'
;
import
{
Range
,
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Cursor
}
from
'
vs/editor/common/controller/cursor
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
ModelServiceImpl
}
from
'
vs/editor/common/services/modelServiceImpl
'
;
...
...
@@ -33,7 +32,6 @@ suite('Editor - Range decorations', () => {
let
modelService
:
IModelService
;
let
modeService
:
IModeService
;
let
codeEditor
:
editorCommon
.
ICommonCodeEditor
;
let
cursor
:
Cursor
;
let
model
:
Model
;
let
text
:
string
;
let
testObject
:
RangeHighlightDecorations
;
...
...
@@ -47,7 +45,6 @@ suite('Editor - Range decorations', () => {
text
=
'
LINE1
'
+
'
\n
'
+
'
LINE2
'
+
'
\n
'
+
'
LINE3
'
+
'
\n
'
+
'
LINE4
'
+
'
\r\n
'
+
'
LINE5
'
;
model
=
aModel
(
URI
.
file
(
'
some_file
'
));
codeEditor
=
mockCodeEditor
([],
{
model
});
cursor
=
(
<
MockCodeEditor
>
codeEditor
).
getCursor
();
mockEditorService
(
codeEditor
.
getModel
().
uri
);
instantiationService
.
stub
(
WorkbenchEditorService
.
IWorkbenchEditorService
,
'
getActiveEditor
'
,
{
getControl
:
()
=>
{
return
codeEditor
;
}
});
...
...
@@ -111,7 +108,7 @@ suite('Editor - Range decorations', () => {
test
(
'
highlight is removed on cursor position change
'
,
function
()
{
testObject
.
highlightRange
({
resource
:
model
.
uri
,
range
:
{
startLineNumber
:
1
,
startColumn
:
1
,
endLineNumber
:
1
,
endColumn
:
1
}
});
c
urs
or
.
trigger
(
'
mouse
'
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
c
odeEdit
or
.
trigger
(
'
mouse
'
,
CoreNavigationCommands
.
MoveTo
.
id
,
{
position
:
new
Position
(
2
,
1
)
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录