Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
91635e83
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,发现更多精彩内容 >>
提交
91635e83
编写于
5月 17, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
grid - add onDidOpen event to groups
上级
e4740f3f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
40 addition
and
21 deletion
+40
-21
src/vs/workbench/browser/parts/editor2/nextEditorGroupView.ts
...vs/workbench/browser/parts/editor2/nextEditorGroupView.ts
+12
-6
src/vs/workbench/services/group/common/nextEditorGroupsService.ts
...orkbench/services/group/common/nextEditorGroupsService.ts
+16
-11
src/vs/workbench/services/group/test/browser/nextEditorGroupsService.test.ts
...rvices/group/test/browser/nextEditorGroupsService.test.ts
+12
-4
未找到文件。
src/vs/workbench/browser/parts/editor2/nextEditorGroupView.ts
浏览文件 @
91635e83
...
...
@@ -78,15 +78,18 @@ export class NextEditorGroupView extends Themable implements INextEditorGroupVie
private
_onWillOpenEditor
:
Emitter
<
IEditorOpeningEvent
>
=
this
.
_register
(
new
Emitter
<
IEditorOpeningEvent
>
());
get
onWillOpenEditor
():
Event
<
IEditorOpeningEvent
>
{
return
this
.
_onWillOpenEditor
.
event
;
}
private
_onDidOpenEditor
:
Emitter
<
EditorInput
>
=
this
.
_register
(
new
Emitter
<
EditorInput
>
());
get
onDidOpenEditor
():
Event
<
EditorInput
>
{
return
this
.
_onDidOpenEditor
.
event
;
}
private
_onDidOpenEditorFail
:
Emitter
<
EditorInput
>
=
this
.
_register
(
new
Emitter
<
EditorInput
>
());
get
onDidOpenEditorFail
():
Event
<
EditorInput
>
{
return
this
.
_onDidOpenEditorFail
.
event
;
}
private
_onWillCloseEditor
:
Emitter
<
IEditorCloseEvent
>
=
this
.
_register
(
new
Emitter
<
IEditorCloseEvent
>
());
get
onWillCloseEditor
():
Event
<
IEditorCloseEvent
>
{
return
this
.
_onWillCloseEditor
.
event
;
}
private
_onDidCloseEditor
:
Emitter
<
IEditorCloseEvent
>
=
this
.
_register
(
new
Emitter
<
IEditorCloseEvent
>
());
get
onDidCloseEditor
():
Event
<
IEditorCloseEvent
>
{
return
this
.
_onDidCloseEditor
.
event
;
}
private
_onDidOpenEditorFail
:
Emitter
<
EditorInput
>
=
this
.
_register
(
new
Emitter
<
EditorInput
>
());
get
onDidOpenEditorFail
():
Event
<
EditorInput
>
{
return
this
.
_onDidOpenEditorFail
.
event
;
}
//#endregion
private
_group
:
EditorGroup
;
...
...
@@ -365,6 +368,9 @@ export class NextEditorGroupView extends Themable implements INextEditorGroupVie
// Update container
this
.
updateContainer
();
// Event
this
.
_onDidOpenEditor
.
fire
(
editor
);
}
private
onDidEditorClose
(
event
:
EditorCloseEvent
):
void
{
...
...
@@ -389,9 +395,6 @@ export class NextEditorGroupView extends Themable implements INextEditorGroupVie
}
});
// After close
this
.
_onDidCloseEditor
.
fire
(
event
);
/* __GDPR__
"editorClosed" : {
"${include}": [
...
...
@@ -403,6 +406,9 @@ export class NextEditorGroupView extends Themable implements INextEditorGroupVie
// Update container
this
.
updateContainer
();
// Event
this
.
_onDidCloseEditor
.
fire
(
event
);
}
private
onDidEditorDispose
(
editor
:
EditorInput
):
void
{
...
...
src/vs/workbench/services/group/common/nextEditorGroupsService.ts
浏览文件 @
91635e83
...
...
@@ -287,6 +287,22 @@ export interface INextEditorGroup {
*/
readonly
onDidActiveEditorChange
:
Event
<
void
>
;
/**
* Emitted when an editor is about to open. This can be prevented from
* the provided event.
*/
readonly
onWillOpenEditor
:
Event
<
IEditorOpeningEvent
>
;
/**
* Emitted when an editor has opened successfully.
*/
readonly
onDidOpenEditor
:
Event
<
IEditorInput
>
;
/**
* Emitted when an editor failed to open.
*/
readonly
onDidOpenEditorFail
:
Event
<
IEditorInput
>
;
/**
* Emitted when an editor of this group is about to get closed.
*
...
...
@@ -300,17 +316,6 @@ export interface INextEditorGroup {
*/
readonly
onDidCloseEditor
:
Event
<
IEditorCloseEvent
>
;
/**
* Emitted when an editor is about to open. This can be prevented from
* the provided event.
*/
readonly
onWillOpenEditor
:
Event
<
IEditorOpeningEvent
>
;
/**
* Emitted when an editor failed to open.
*/
readonly
onDidOpenEditorFail
:
Event
<
IEditorInput
>
;
/**
* An event for when the label of the group changes.
*/
...
...
src/vs/workbench/services/group/test/browser/nextEditorGroupsService.test.ts
浏览文件 @
91635e83
...
...
@@ -356,6 +356,16 @@ suite('Editor groups service (editor2)', () => {
activeEditorChangeCounter
++
;
});
let
editorWillOpenCounter
=
0
;
const
editorWillOpenListener
=
group
.
onWillOpenEditor
(()
=>
{
editorWillOpenCounter
++
;
});
let
editorDidOpenCounter
=
0
;
const
editorDidOpenListener
=
group
.
onDidOpenEditor
(()
=>
{
editorDidOpenCounter
++
;
});
let
editorCloseCounter
=
0
;
const
editorCloseListener
=
group
.
onDidCloseEditor
(()
=>
{
editorCloseCounter
++
;
...
...
@@ -365,10 +375,6 @@ suite('Editor groups service (editor2)', () => {
const
editorWillCloseListener
=
group
.
onWillCloseEditor
(()
=>
{
editorWillCloseCounter
++
;
});
let
editorWillOpenCounter
=
0
;
const
editorWillOpenListener
=
group
.
onWillOpenEditor
(()
=>
{
editorWillOpenCounter
++
;
});
const
input
=
new
TestEditorInput
(
URI
.
file
(
'
foo/bar
'
));
const
inputInactive
=
new
TestEditorInput
(
URI
.
file
(
'
foo/bar/inactive
'
));
...
...
@@ -382,6 +388,7 @@ suite('Editor groups service (editor2)', () => {
assert
.
equal
(
group
.
isEmpty
(),
false
);
assert
.
equal
(
group
.
count
,
2
);
assert
.
equal
(
editorWillOpenCounter
,
2
);
assert
.
equal
(
editorDidOpenCounter
,
2
);
assert
.
equal
(
activeEditorChangeCounter
,
1
);
assert
.
equal
(
group
.
getEditor
(
0
),
input
);
assert
.
equal
(
group
.
getEditor
(
1
),
inputInactive
);
...
...
@@ -413,6 +420,7 @@ suite('Editor groups service (editor2)', () => {
editorCloseListener
.
dispose
();
editorWillCloseListener
.
dispose
();
editorWillOpenListener
.
dispose
();
editorDidOpenListener
.
dispose
();
part
.
dispose
();
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录