Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
936b1364
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,体验更适合开发者的 AI 搜索 >>
提交
936b1364
编写于
5月 18, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
grid - remove onWillCloseEditor() from editor service
上级
8cb8c024
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
15 addition
and
33 deletion
+15
-33
src/vs/workbench/parts/files/browser/editors/textFileEditor.ts
...s/workbench/parts/files/browser/editors/textFileEditor.ts
+15
-11
src/vs/workbench/services/editor/browser/nextEditorService.ts
...vs/workbench/services/editor/browser/nextEditorService.ts
+0
-7
src/vs/workbench/services/editor/common/nextEditorService.ts
src/vs/workbench/services/editor/common/nextEditorService.ts
+0
-7
src/vs/workbench/services/editor/test/browser/nextEditorService.test.ts
...ch/services/editor/test/browser/nextEditorService.test.ts
+0
-7
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+0
-1
未找到文件。
src/vs/workbench/parts/files/browser/editors/textFileEditor.ts
浏览文件 @
936b1364
...
...
@@ -14,7 +14,7 @@ import { Action } from 'vs/base/common/actions';
import
{
VIEWLET_ID
,
IExplorerViewlet
,
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
,
IEditorCloseEvent
}
from
'
vs/workbench/common/editor
'
;
import
{
EditorOptions
,
TextEditorOptions
}
from
'
vs/workbench/common/editor
'
;
import
{
BinaryEditorModel
}
from
'
vs/workbench/common/editor/binaryEditorModel
'
;
import
{
FileEditorInput
}
from
'
vs/workbench/parts/files/common/editors/fileEditorInput
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
...
...
@@ -30,7 +30,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import
{
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
import
{
INextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
INextEditorGroupsService
,
INextEditorGroup
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
/**
...
...
@@ -59,9 +59,6 @@ export class TextFileEditor extends BaseTextEditor {
// Clear view state for deleted files
this
.
toUnbind
.
push
(
this
.
fileService
.
onFileChanges
(
e
=>
this
.
onFilesChanged
(
e
)));
// React to editors closing to preserve view state
this
.
toUnbind
.
push
(
editorService
.
onWillCloseEditor
(
e
=>
this
.
onWillCloseEditor
(
e
)));
}
private
onFilesChanged
(
e
:
FileChangesEvent
):
void
{
...
...
@@ -71,12 +68,6 @@ export class TextFileEditor extends BaseTextEditor {
}
}
private
onWillCloseEditor
(
e
:
IEditorCloseEvent
):
void
{
if
(
e
.
editor
===
this
.
input
&&
this
.
group
.
id
===
e
.
groupId
)
{
this
.
doSaveTextEditorViewState
(
this
.
input
);
}
}
public
getTitle
():
string
{
return
this
.
input
?
this
.
input
.
getName
()
:
nls
.
localize
(
'
textFileEditor
'
,
"
Text File Editor
"
);
}
...
...
@@ -85,6 +76,19 @@ export class TextFileEditor extends BaseTextEditor {
return
this
.
_input
as
FileEditorInput
;
}
setEditorVisible
(
visible
:
boolean
,
group
:
INextEditorGroup
):
void
{
super
.
setEditorVisible
(
visible
,
group
);
// React to editors closing to preserve view state. This needs to happen
// in the onWillCloseEditor because at that time the editor has not yet
// been disposed and we can safely persist the view state still.
this
.
toUnbind
.
push
(
group
.
onWillCloseEditor
(
e
=>
{
if
(
e
.
editor
===
this
.
input
)
{
this
.
doSaveTextEditorViewState
(
this
.
input
);
}
}));
}
public
setOptions
(
options
:
EditorOptions
):
void
{
const
textOptions
=
<
TextEditorOptions
>
options
;
if
(
textOptions
&&
types
.
isFunction
(
textOptions
.
apply
))
{
...
...
src/vs/workbench/services/editor/browser/nextEditorService.ts
浏览文件 @
936b1364
...
...
@@ -48,9 +48,6 @@ export class NextEditorService extends Disposable implements INextEditorService
private
_onDidVisibleEditorsChange
:
Emitter
<
void
>
=
this
.
_register
(
new
Emitter
<
void
>
());
get
onDidVisibleEditorsChange
():
Event
<
void
>
{
return
this
.
_onDidVisibleEditorsChange
.
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
;
}
...
...
@@ -112,10 +109,6 @@ export class NextEditorService extends Disposable implements INextEditorService
}
}));
groupDisposeables
.
push
(
group
.
onWillCloseEditor
(
event
=>
{
this
.
_onWillCloseEditor
.
fire
(
event
);
}));
groupDisposeables
.
push
(
group
.
onDidCloseEditor
(
event
=>
{
this
.
_onDidCloseEditor
.
fire
(
event
);
}));
...
...
src/vs/workbench/services/editor/common/nextEditorService.ts
浏览文件 @
936b1364
...
...
@@ -41,13 +41,6 @@ export interface INextEditorService {
*/
readonly
onDidVisibleEditorsChange
:
Event
<
void
>
;
/**
* Emitted when an editor is about to get closed. Listeners can
* for example save view state now before the underlying widget
* gets disposed.
*/
readonly
onWillCloseEditor
:
Event
<
IEditorCloseEvent
>
;
/**
* Emitted when an editor is closed.
*/
...
...
src/vs/workbench/services/editor/test/browser/nextEditorService.test.ts
浏览文件 @
936b1364
...
...
@@ -99,11 +99,6 @@ suite('Editor service (editor2)', () => {
didCloseEditorListenerCounter
++
;
});
let
willCloseEditorListenerCounter
=
0
;
const
willCloseEditorListener
=
service
.
onWillCloseEditor
(
editor
=>
{
willCloseEditorListenerCounter
++
;
});
// Open input
return
service
.
openEditor
(
input
,
{
pinned
:
true
}).
then
(
editor
=>
{
assert
.
ok
(
editor
instanceof
TestEditorControl
);
...
...
@@ -121,7 +116,6 @@ suite('Editor service (editor2)', () => {
// Close input
editor
.
group
.
closeEditor
(
input
);
assert
.
equal
(
willCloseEditorListenerCounter
,
1
);
assert
.
equal
(
didCloseEditorListenerCounter
,
1
);
assert
.
equal
(
activeEditorChangeEventCounter
,
2
);
assert
.
equal
(
visibleEditorChangeEventCounter
,
2
);
...
...
@@ -139,7 +133,6 @@ suite('Editor service (editor2)', () => {
activeEditorChangeListener
.
dispose
();
visibleEditorChangeListener
.
dispose
();
willCloseEditorListener
.
dispose
();
didCloseEditorListener
.
dispose
();
willOpenEditorListener
.
dispose
();
});
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
936b1364
...
...
@@ -859,7 +859,6 @@ export class TestNextEditorService implements INextEditorService {
onDidActiveEditorChange
:
Event
<
void
>
=
Event
.
None
;
onDidVisibleEditorsChange
:
Event
<
void
>
=
Event
.
None
;
onWillCloseEditor
:
Event
<
IEditorCloseEvent
>
=
Event
.
None
;
onDidCloseEditor
:
Event
<
IEditorCloseEvent
>
=
Event
.
None
;
onWillOpenEditor
:
Event
<
IEditorOpeningEvent
>
=
Event
.
None
;
onDidOpenEditorFail
:
Event
<
IEditorIdentifier
>
=
Event
.
None
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录