Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
51c98a8e
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,发现更多精彩内容 >>
提交
51c98a8e
编写于
5月 10, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
上级
eb9ed47e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
32 addition
and
30 deletion
+32
-30
src/vs/workbench/browser/parts/editor/editorPart.ts
src/vs/workbench/browser/parts/editor/editorPart.ts
+2
-2
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+3
-4
src/vs/workbench/common/editor/editorStacksModel.ts
src/vs/workbench/common/editor/editorStacksModel.ts
+18
-15
src/vs/workbench/parts/files/browser/editors/textFileEditor.ts
...s/workbench/parts/files/browser/editors/textFileEditor.ts
+2
-2
src/vs/workbench/services/history/browser/history.ts
src/vs/workbench/services/history/browser/history.ts
+2
-2
src/vs/workbench/test/browser/editorStacksModel.test.ts
src/vs/workbench/test/browser/editorStacksModel.test.ts
+5
-5
未找到文件。
src/vs/workbench/browser/parts/editor/editorPart.ts
浏览文件 @
51c98a8e
...
...
@@ -35,7 +35,7 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
import
{
IMessageService
,
IMessageWithAction
,
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
EditorStacksModel
,
EditorGroup
,
EditorIdentifier
,
Group
Event
}
from
'
vs/workbench/common/editor/editorStacksModel
'
;
import
{
EditorStacksModel
,
EditorGroup
,
EditorIdentifier
,
EditorClose
Event
}
from
'
vs/workbench/common/editor/editorStacksModel
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IContextKey
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
...
...
@@ -234,7 +234,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
this
.
telemetryService
.
publicLog
(
'
editorOpened
'
,
identifier
.
editor
.
getTelemetryDescriptor
());
}
private
onEditorClosed
(
event
:
Group
Event
):
void
{
private
onEditorClosed
(
event
:
EditorClose
Event
):
void
{
this
.
telemetryService
.
publicLog
(
'
editorClosed
'
,
event
.
editor
.
getTelemetryDescriptor
());
}
...
...
src/vs/workbench/common/editor.ts
浏览文件 @
51c98a8e
...
...
@@ -845,8 +845,8 @@ export interface IEditorStacksModel {
onModelChanged
:
Event
<
IStacksModelChangeEvent
>
;
onWillCloseEditor
:
Event
<
IEditor
Identifier
>
;
onEditorClosed
:
Event
<
I
Group
Event
>
;
onWillCloseEditor
:
Event
<
IEditor
CloseEvent
>
;
onEditorClosed
:
Event
<
I
EditorClose
Event
>
;
groups
:
IEditorGroup
[];
activeGroup
:
IEditorGroup
;
...
...
@@ -895,8 +895,7 @@ export interface IEditorContext extends IEditorIdentifier {
event
?:
any
;
}
export
interface
IGroupEvent
{
editor
:
IEditorInput
;
export
interface
IEditorCloseEvent
extends
IEditorIdentifier
{
pinned
:
boolean
;
index
:
number
;
}
...
...
src/vs/workbench/common/editor/editorStacksModel.ts
浏览文件 @
51c98a8e
...
...
@@ -6,7 +6,7 @@
'
use strict
'
;
import
Event
,
{
Emitter
,
once
}
from
'
vs/base/common/event
'
;
import
{
IEditorRegistry
,
Extensions
,
EditorInput
,
toResource
,
IEditorStacksModel
,
IEditorGroup
,
IEditorIdentifier
,
I
Group
Event
,
GroupIdentifier
,
IStacksModelChangeEvent
,
IWorkbenchEditorConfiguration
,
EditorOpenPositioning
,
SideBySideEditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
IEditorRegistry
,
Extensions
,
EditorInput
,
toResource
,
IEditorStacksModel
,
IEditorGroup
,
IEditorIdentifier
,
I
EditorClose
Event
,
GroupIdentifier
,
IStacksModelChangeEvent
,
IWorkbenchEditorConfiguration
,
EditorOpenPositioning
,
SideBySideEditorInput
}
from
'
vs/workbench/common/editor
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -17,7 +17,7 @@ import { Registry } from 'vs/platform/platform';
import
{
Position
,
Direction
}
from
'
vs/platform/editor/common/editor
'
;
import
{
ResourceMap
}
from
'
vs/base/common/map
'
;
export
interface
GroupEvent
extends
IGroup
Event
{
export
interface
EditorCloseEvent
extends
IEditorClose
Event
{
editor
:
EditorInput
;
}
...
...
@@ -63,7 +63,7 @@ export class EditorGroup implements IEditorGroup {
private
_onEditorActivated
:
Emitter
<
EditorInput
>
;
private
_onEditorOpened
:
Emitter
<
EditorInput
>
;
private
_onEditorClosed
:
Emitter
<
Group
Event
>
;
private
_onEditorClosed
:
Emitter
<
EditorClose
Event
>
;
private
_onEditorDisposed
:
Emitter
<
EditorInput
>
;
private
_onEditorDirty
:
Emitter
<
EditorInput
>
;
private
_onEditorLabelChange
:
Emitter
<
EditorInput
>
;
...
...
@@ -88,7 +88,7 @@ export class EditorGroup implements IEditorGroup {
this
.
_onEditorActivated
=
new
Emitter
<
EditorInput
>
();
this
.
_onEditorOpened
=
new
Emitter
<
EditorInput
>
();
this
.
_onEditorClosed
=
new
Emitter
<
Group
Event
>
();
this
.
_onEditorClosed
=
new
Emitter
<
EditorClose
Event
>
();
this
.
_onEditorDisposed
=
new
Emitter
<
EditorInput
>
();
this
.
_onEditorDirty
=
new
Emitter
<
EditorInput
>
();
this
.
_onEditorLabelChange
=
new
Emitter
<
EditorInput
>
();
...
...
@@ -143,7 +143,7 @@ export class EditorGroup implements IEditorGroup {
return
this
.
_onEditorOpened
.
event
;
}
public
get
onEditorClosed
():
Event
<
Group
Event
>
{
public
get
onEditorClosed
():
Event
<
EditorClose
Event
>
{
return
this
.
_onEditorClosed
.
event
;
}
...
...
@@ -376,7 +376,7 @@ export class EditorGroup implements IEditorGroup {
this
.
splice
(
index
,
true
);
// Event
this
.
fireEvent
(
this
.
_onEditorClosed
,
{
editor
,
pinned
,
index
},
true
);
this
.
fireEvent
(
this
.
_onEditorClosed
,
{
editor
,
pinned
,
index
,
group
:
this
},
true
);
}
public
closeEditors
(
except
:
EditorInput
,
direction
?:
Direction
):
void
{
...
...
@@ -507,7 +507,7 @@ export class EditorGroup implements IEditorGroup {
return
!
this
.
matches
(
this
.
preview
,
editor
);
}
private
fireEvent
(
emitter
:
Emitter
<
EditorInput
|
GroupEvent
>
,
arg2
:
EditorInput
|
Group
Event
,
isStructuralChange
:
boolean
):
void
{
private
fireEvent
(
emitter
:
Emitter
<
EditorInput
|
EditorCloseEvent
>
,
arg2
:
EditorInput
|
EditorClose
Event
,
isStructuralChange
:
boolean
):
void
{
emitter
.
fire
(
arg2
);
if
(
isStructuralChange
)
{
...
...
@@ -699,12 +699,15 @@ export class EditorStacksModel implements IEditorStacksModel {
private
_onGroupActivated
:
Emitter
<
EditorGroup
>
;
private
_onGroupDeactivated
:
Emitter
<
EditorGroup
>
;
private
_onGroupRenamed
:
Emitter
<
EditorGroup
>
;
private
_onEditorDisposed
:
Emitter
<
EditorIdentifier
>
;
private
_onEditorDirty
:
Emitter
<
EditorIdentifier
>
;
private
_onEditorLabelChange
:
Emitter
<
EditorIdentifier
>
;
private
_onEditorOpened
:
Emitter
<
EditorIdentifier
>
;
private
_onWillCloseEditor
:
Emitter
<
EditorIdentifier
>
;
private
_onEditorClosed
:
Emitter
<
GroupEvent
>
;
private
_onWillCloseEditor
:
Emitter
<
EditorCloseEvent
>
;
private
_onEditorClosed
:
Emitter
<
EditorCloseEvent
>
;
private
_onModelChanged
:
Emitter
<
IStacksModelChangeEvent
>
;
constructor
(
...
...
@@ -729,8 +732,8 @@ export class EditorStacksModel implements IEditorStacksModel {
this
.
_onEditorDirty
=
new
Emitter
<
EditorIdentifier
>
();
this
.
_onEditorLabelChange
=
new
Emitter
<
EditorIdentifier
>
();
this
.
_onEditorOpened
=
new
Emitter
<
EditorIdentifier
>
();
this
.
_onWillCloseEditor
=
new
Emitter
<
Editor
Identifier
>
();
this
.
_onEditorClosed
=
new
Emitter
<
Group
Event
>
();
this
.
_onWillCloseEditor
=
new
Emitter
<
Editor
CloseEvent
>
();
this
.
_onEditorClosed
=
new
Emitter
<
EditorClose
Event
>
();
this
.
toDispose
.
push
(
this
.
_onGroupOpened
,
this
.
_onGroupClosed
,
this
.
_onGroupActivated
,
this
.
_onGroupDeactivated
,
this
.
_onGroupMoved
,
this
.
_onGroupRenamed
,
this
.
_onModelChanged
,
this
.
_onEditorDisposed
,
this
.
_onEditorDirty
,
this
.
_onEditorLabelChange
,
this
.
_onEditorClosed
,
this
.
_onWillCloseEditor
);
...
...
@@ -785,11 +788,11 @@ export class EditorStacksModel implements IEditorStacksModel {
return
this
.
_onEditorOpened
.
event
;
}
public
get
onWillCloseEditor
():
Event
<
Editor
Identifier
>
{
public
get
onWillCloseEditor
():
Event
<
Editor
CloseEvent
>
{
return
this
.
_onWillCloseEditor
.
event
;
}
public
get
onEditorClosed
():
Event
<
Group
Event
>
{
public
get
onEditorClosed
():
Event
<
EditorClose
Event
>
{
return
this
.
_onEditorClosed
.
event
;
}
...
...
@@ -1161,7 +1164,7 @@ export class EditorStacksModel implements IEditorStacksModel {
unbind
.
push
(
group
.
onEditorStateChanged
(
editor
=>
this
.
_onModelChanged
.
fire
({
group
,
editor
})));
unbind
.
push
(
group
.
onEditorOpened
(
editor
=>
this
.
_onEditorOpened
.
fire
({
editor
,
group
})));
unbind
.
push
(
group
.
onEditorClosed
(
event
=>
{
this
.
_onWillCloseEditor
.
fire
(
{
editor
:
event
.
editor
,
group
}
);
this
.
_onWillCloseEditor
.
fire
(
event
);
this
.
handleOnEditorClosed
(
event
);
this
.
_onEditorClosed
.
fire
(
event
);
}));
...
...
@@ -1177,7 +1180,7 @@ export class EditorStacksModel implements IEditorStacksModel {
return
group
;
}
private
handleOnEditorClosed
(
event
:
Group
Event
):
void
{
private
handleOnEditorClosed
(
event
:
EditorClose
Event
):
void
{
const
editor
=
event
.
editor
;
const
editorsToClose
=
[
editor
];
...
...
src/vs/workbench/parts/files/browser/editors/textFileEditor.ts
浏览文件 @
51c98a8e
...
...
@@ -14,7 +14,7 @@ import { Action } from 'vs/base/common/actions';
import
{
VIEWLET_ID
,
TEXT_FILE_EDITOR_ID
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
ITextFileEditorModel
,
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
BaseTextEditor
}
from
'
vs/workbench/browser/parts/editor/textEditor
'
;
import
{
EditorOptions
,
TextEditorOptions
,
IEditor
Identifier
}
from
'
vs/workbench/common/editor
'
;
import
{
EditorOptions
,
TextEditorOptions
,
IEditor
CloseEvent
}
from
'
vs/workbench/common/editor
'
;
import
{
BinaryEditorModel
}
from
'
vs/workbench/common/editor/binaryEditorModel
'
;
import
{
FileEditorInput
}
from
'
vs/workbench/parts/files/common/editors/fileEditorInput
'
;
import
{
ExplorerViewlet
}
from
'
vs/workbench/parts/files/browser/explorerViewlet
'
;
...
...
@@ -70,7 +70,7 @@ export class TextFileEditor extends BaseTextEditor {
}
}
private
onWillCloseEditor
(
e
:
IEditor
Identifier
):
void
{
private
onWillCloseEditor
(
e
:
IEditor
CloseEvent
):
void
{
if
(
e
.
editor
===
this
.
input
&&
this
.
position
===
this
.
editorGroupService
.
getStacksModel
().
positionOfGroup
(
e
.
group
))
{
this
.
doSaveTextEditorViewState
(
this
.
input
);
}
...
...
src/vs/workbench/services/history/browser/history.ts
浏览文件 @
51c98a8e
...
...
@@ -11,7 +11,7 @@ import objects = require('vs/base/common/objects');
import
URI
from
'
vs/base/common/uri
'
;
import
{
IEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditor
as
IBaseEditor
,
IEditorInput
,
ITextEditorOptions
,
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
EditorInput
,
I
Group
Event
,
IEditorRegistry
,
Extensions
,
toResource
,
IEditorGroup
}
from
'
vs/workbench/common/editor
'
;
import
{
EditorInput
,
I
EditorClose
Event
,
IEditorRegistry
,
Extensions
,
toResource
,
IEditorGroup
}
from
'
vs/workbench/common/editor
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IHistoryService
}
from
'
vs/workbench/services/history/common/history
'
;
import
{
FileChangesEvent
,
IFileService
,
FileChangeType
}
from
'
vs/platform/files/common/files
'
;
...
...
@@ -214,7 +214,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
}
}
private
onEditorClosed
(
event
:
I
Group
Event
):
void
{
private
onEditorClosed
(
event
:
I
EditorClose
Event
):
void
{
// Track closing of pinned editor to support to reopen closed editors
if
(
event
.
pinned
)
{
...
...
src/vs/workbench/test/browser/editorStacksModel.test.ts
浏览文件 @
51c98a8e
...
...
@@ -6,8 +6,8 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
EditorStacksModel
,
EditorGroup
,
Group
Event
}
from
'
vs/workbench/common/editor/editorStacksModel
'
;
import
{
EditorInput
,
IFileEditorInput
,
IEditorIdentifier
,
IEditorGroup
,
IStacksModelChangeEvent
,
IEditorRegistry
,
Extensions
as
EditorExtensions
,
IEditorInputFactory
,
I
Group
Event
}
from
'
vs/workbench/common/editor
'
;
import
{
EditorStacksModel
,
EditorGroup
,
EditorClose
Event
}
from
'
vs/workbench/common/editor/editorStacksModel
'
;
import
{
EditorInput
,
IFileEditorInput
,
IEditorIdentifier
,
IEditorGroup
,
IStacksModelChangeEvent
,
IEditorRegistry
,
Extensions
as
EditorExtensions
,
IEditorInputFactory
,
I
EditorClose
Event
}
from
'
vs/workbench/common/editor
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
TestStorageService
,
TestLifecycleService
,
TestContextService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
...
...
@@ -47,14 +47,14 @@ interface ModelEvents {
renamed
:
IEditorGroup
[];
disposed
:
IEditorIdentifier
[];
changed
:
IStacksModelChangeEvent
[];
editorClosed
:
I
Group
Event
[];
editorWillClose
:
IEditor
Identifier
[];
editorClosed
:
I
EditorClose
Event
[];
editorWillClose
:
IEditor
CloseEvent
[];
}
interface
GroupEvents
{
opened
:
EditorInput
[];
activated
:
EditorInput
[];
closed
:
Group
Event
[];
closed
:
EditorClose
Event
[];
pinned
:
EditorInput
[];
unpinned
:
EditorInput
[];
moved
:
EditorInput
[];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录