Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5b14c984
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,发现更多精彩内容 >>
提交
5b14c984
编写于
8月 28, 2016
作者:
S
sprinkle131313
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implements recently closed editors opening at same position as they were closed.
上级
de177843
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
17 addition
and
11 deletion
+17
-11
src/vs/workbench/browser/parts/editor/editorActions.ts
src/vs/workbench/browser/parts/editor/editorActions.ts
+2
-2
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+1
-0
src/vs/workbench/common/editor/editorStacksModel.ts
src/vs/workbench/common/editor/editorStacksModel.ts
+1
-1
src/vs/workbench/services/history/browser/history.ts
src/vs/workbench/services/history/browser/history.ts
+7
-7
src/vs/workbench/services/history/common/history.ts
src/vs/workbench/services/history/common/history.ts
+6
-1
未找到文件。
src/vs/workbench/browser/parts/editor/editorActions.ts
浏览文件 @
5b14c984
...
@@ -905,12 +905,12 @@ export class ReopenClosedEditorAction extends Action {
...
@@ -905,12 +905,12 @@ export class ReopenClosedEditorAction extends Action {
// Find an editor that was closed and is currently not opened in the group
// Find an editor that was closed and is currently not opened in the group
let
lastClosedEditor
=
this
.
historyService
.
popLastClosedEditor
();
let
lastClosedEditor
=
this
.
historyService
.
popLastClosedEditor
();
while
(
lastClosedEditor
&&
stacks
.
activeGroup
&&
stacks
.
activeGroup
.
indexOf
(
lastClosedEditor
)
>=
0
)
{
while
(
lastClosedEditor
&&
stacks
.
activeGroup
&&
stacks
.
activeGroup
.
indexOf
(
lastClosedEditor
.
editor
)
>=
0
)
{
lastClosedEditor
=
this
.
historyService
.
popLastClosedEditor
();
lastClosedEditor
=
this
.
historyService
.
popLastClosedEditor
();
}
}
if
(
lastClosedEditor
)
{
if
(
lastClosedEditor
)
{
this
.
editorService
.
openEditor
(
lastClosedEditor
,
{
pinned
:
true
});
this
.
editorService
.
openEditor
(
lastClosedEditor
.
editor
,
{
pinned
:
true
,
index
:
lastClosedEditor
.
index
});
}
}
return
TPromise
.
as
(
false
);
return
TPromise
.
as
(
false
);
...
...
src/vs/workbench/common/editor.ts
浏览文件 @
5b14c984
...
@@ -831,6 +831,7 @@ export interface IEditorContext extends IEditorIdentifier {
...
@@ -831,6 +831,7 @@ export interface IEditorContext extends IEditorIdentifier {
export
interface
IGroupEvent
{
export
interface
IGroupEvent
{
editor
:
IEditorInput
;
editor
:
IEditorInput
;
pinned
:
boolean
;
pinned
:
boolean
;
index
:
number
;
}
}
export
type
GroupIdentifier
=
number
;
export
type
GroupIdentifier
=
number
;
...
...
src/vs/workbench/common/editor/editorStacksModel.ts
浏览文件 @
5b14c984
...
@@ -346,7 +346,7 @@ export class EditorGroup implements IEditorGroup {
...
@@ -346,7 +346,7 @@ export class EditorGroup implements IEditorGroup {
this
.
splice
(
index
,
true
);
this
.
splice
(
index
,
true
);
// Event
// Event
this
.
fireEvent
(
this
.
_onEditorClosed
,
{
editor
,
pinned
},
true
);
this
.
fireEvent
(
this
.
_onEditorClosed
,
{
editor
,
pinned
,
index
},
true
);
}
}
public
closeEditors
(
except
:
EditorInput
,
direction
?:
Direction
):
void
{
public
closeEditors
(
except
:
EditorInput
,
direction
?:
Direction
):
void
{
...
...
src/vs/workbench/services/history/browser/history.ts
浏览文件 @
5b14c984
...
@@ -14,7 +14,7 @@ import {IEditor as IBaseEditor} from 'vs/platform/editor/common/editor';
...
@@ -14,7 +14,7 @@ import {IEditor as IBaseEditor} from 'vs/platform/editor/common/editor';
import
{
EditorInput
,
IGroupEvent
,
IEditorRegistry
,
Extensions
}
from
'
vs/workbench/common/editor
'
;
import
{
EditorInput
,
IGroupEvent
,
IEditorRegistry
,
Extensions
}
from
'
vs/workbench/common/editor
'
;
import
{
BaseTextEditor
}
from
'
vs/workbench/browser/parts/editor/textEditor
'
;
import
{
BaseTextEditor
}
from
'
vs/workbench/browser/parts/editor/textEditor
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IHistoryService
}
from
'
vs/workbench/services/history/common/history
'
;
import
{
RecentlyClosedEditorInput
,
IHistoryService
}
from
'
vs/workbench/services/history/common/history
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
IEditorInput
,
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IEditorInput
,
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IEventService
}
from
'
vs/platform/event/common/event
'
;
import
{
IEventService
}
from
'
vs/platform/event/common/event
'
;
...
@@ -228,7 +228,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
...
@@ -228,7 +228,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
private
currentFileEditorState
:
EditorState
;
private
currentFileEditorState
:
EditorState
;
private
history
:
IEditorInput
[];
private
history
:
IEditorInput
[];
private
recentlyClosed
:
I
EditorInput
[];
private
recentlyClosed
:
RecentlyClosed
EditorInput
[];
private
loaded
:
boolean
;
private
loaded
:
boolean
;
private
registry
:
IEditorRegistry
;
private
registry
:
IEditorRegistry
;
...
@@ -268,7 +268,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
...
@@ -268,7 +268,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
// Remove all inputs matching and add as last recently closed
// Remove all inputs matching and add as last recently closed
this
.
removeFromRecentlyClosed
(
editor
);
this
.
removeFromRecentlyClosed
(
editor
);
this
.
recentlyClosed
.
push
(
editor
);
this
.
recentlyClosed
.
push
(
{
editor
,
index
:
event
.
index
}
);
// Bounding
// Bounding
if
(
this
.
recentlyClosed
.
length
>
HistoryService
.
MAX_RECENTLY_CLOSED_EDITORS
)
{
if
(
this
.
recentlyClosed
.
length
>
HistoryService
.
MAX_RECENTLY_CLOSED_EDITORS
)
{
...
@@ -283,7 +283,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
...
@@ -283,7 +283,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
}
}
}
}
public
popLastClosedEditor
():
I
EditorInput
{
public
popLastClosedEditor
():
RecentlyClosed
EditorInput
{
this
.
ensureLoaded
();
this
.
ensureLoaded
();
return
this
.
recentlyClosed
.
pop
();
return
this
.
recentlyClosed
.
pop
();
...
@@ -531,14 +531,14 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
...
@@ -531,14 +531,14 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
let
restored
=
false
;
let
restored
=
false
;
this
.
recentlyClosed
.
forEach
((
e
,
i
)
=>
{
this
.
recentlyClosed
.
forEach
((
e
,
i
)
=>
{
if
(
e
.
matches
(
input
))
{
if
(
e
.
editor
.
matches
(
input
))
{
if
(
!
restored
)
{
if
(
!
restored
)
{
restoredInput
=
this
.
restoreInput
(
input
);
restoredInput
=
this
.
restoreInput
(
input
);
restored
=
true
;
restored
=
true
;
}
}
if
(
restoredInput
)
{
if
(
restoredInput
)
{
this
.
recentlyClosed
[
i
]
=
restoredInput
;
this
.
recentlyClosed
[
i
]
.
editor
=
restoredInput
;
}
else
{
}
else
{
this
.
stack
.
splice
(
i
,
1
);
this
.
stack
.
splice
(
i
,
1
);
}
}
...
@@ -573,7 +573,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
...
@@ -573,7 +573,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
private
removeFromRecentlyClosed
(
input
:
IEditorInput
):
void
{
private
removeFromRecentlyClosed
(
input
:
IEditorInput
):
void
{
this
.
recentlyClosed
.
forEach
((
e
,
i
)
=>
{
this
.
recentlyClosed
.
forEach
((
e
,
i
)
=>
{
if
(
e
.
matches
(
input
))
{
if
(
e
.
editor
.
matches
(
input
))
{
this
.
recentlyClosed
.
splice
(
i
,
1
);
this
.
recentlyClosed
.
splice
(
i
,
1
);
}
}
});
});
...
...
src/vs/workbench/services/history/common/history.ts
浏览文件 @
5b14c984
...
@@ -9,6 +9,11 @@ import {IEditorInput} from 'vs/platform/editor/common/editor';
...
@@ -9,6 +9,11 @@ import {IEditorInput} from 'vs/platform/editor/common/editor';
export
const
IHistoryService
=
createDecorator
<
IHistoryService
>
(
'
historyService
'
);
export
const
IHistoryService
=
createDecorator
<
IHistoryService
>
(
'
historyService
'
);
export
class
RecentlyClosedEditorInput
{
editor
:
IEditorInput
;
index
:
number
;
}
export
interface
IHistoryService
{
export
interface
IHistoryService
{
_serviceBrand
:
ServiceIdentifier
<
any
>
;
_serviceBrand
:
ServiceIdentifier
<
any
>
;
...
@@ -16,7 +21,7 @@ export interface IHistoryService {
...
@@ -16,7 +21,7 @@ export interface IHistoryService {
/**
/**
* Removes and returns the last closed editor if any.
* Removes and returns the last closed editor if any.
*/
*/
popLastClosedEditor
():
I
EditorInput
;
popLastClosedEditor
():
RecentlyClosed
EditorInput
;
/**
/**
* Navigate forwards in history.
* Navigate forwards in history.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录