Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
889454cc
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
889454cc
编写于
6月 01, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add event for input open fail
上级
43d78f09
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
31 addition
and
10 deletion
+31
-10
src/vs/workbench/browser/parts/editor/editorPart.ts
src/vs/workbench/browser/parts/editor/editorPart.ts
+8
-1
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
.../workbench/browser/parts/quickopen/quickOpenController.ts
+3
-4
src/vs/workbench/common/events.ts
src/vs/workbench/common/events.ts
+0
-5
src/vs/workbench/services/editor/browser/editorService.ts
src/vs/workbench/services/editor/browser/editorService.ts
+5
-0
src/vs/workbench/services/editor/common/editorService.ts
src/vs/workbench/services/editor/common/editorService.ts
+5
-0
src/vs/workbench/test/browser/services.test.ts
src/vs/workbench/test/browser/services.test.ts
+4
-0
src/vs/workbench/test/common/servicesTestUtils.ts
src/vs/workbench/test/common/servicesTestUtils.ts
+6
-0
未找到文件。
src/vs/workbench/browser/parts/editor/editorPart.ts
浏览文件 @
889454cc
...
...
@@ -85,6 +85,7 @@ export class EditorPart extends Part implements IEditorPart {
private
_onEditorsChanged
:
Emitter
<
void
>
;
private
_onEditorsMoved
:
Emitter
<
void
>
;
private
_onEditorOpenFail
:
Emitter
<
EditorInput
>
;
// The following data structures are partitioned into array of Position as provided by Services.POSITION array
private
visibleEditors
:
BaseEditor
[];
...
...
@@ -109,6 +110,7 @@ export class EditorPart extends Part implements IEditorPart {
this
.
_onEditorsChanged
=
new
Emitter
<
void
>
();
this
.
_onEditorsMoved
=
new
Emitter
<
void
>
();
this
.
_onEditorOpenFail
=
new
Emitter
<
EditorInput
>
();
this
.
visibleEditors
=
[];
...
...
@@ -157,6 +159,10 @@ export class EditorPart extends Part implements IEditorPart {
return
this
.
_onEditorsMoved
.
event
;
}
public
get
onEditorOpenFail
():
Event
<
EditorInput
>
{
return
this
.
_onEditorOpenFail
.
event
;
}
public
openEditor
(
input
:
EditorInput
,
options
?:
EditorOptions
,
sideBySide
?:
boolean
):
TPromise
<
BaseEditor
>
;
public
openEditor
(
input
:
EditorInput
,
options
?:
EditorOptions
,
position
?:
Position
,
widthRatios
?:
number
[]):
TPromise
<
BaseEditor
>
;
public
openEditor
(
input
:
EditorInput
,
options
?:
EditorOptions
,
arg3
?:
any
,
widthRatios
?:
number
[]):
TPromise
<
BaseEditor
>
{
...
...
@@ -463,7 +469,7 @@ export class EditorPart extends Part implements IEditorPart {
this
.
sideBySideControl
.
updateProgress
(
position
,
ProgressState
.
DONE
);
// Event
this
.
emit
(
WorkbenchEventType
.
EDITOR_SET_INPUT_ERROR
,
new
EditorInputEvent
(
input
)
);
this
.
_onEditorOpenFail
.
fire
(
input
);
// Recover by closing the active editor (if the input is still the active one)
if
(
group
.
activeEditor
===
input
)
{
...
...
@@ -1145,6 +1151,7 @@ export class EditorPart extends Part implements IEditorPart {
// Emitters
this
.
_onEditorsChanged
.
dispose
();
this
.
_onEditorsMoved
.
dispose
();
this
.
_onEditorOpenFail
.
dispose
();
// Reset Tokens
this
.
editorOpenToken
=
[];
...
...
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
浏览文件 @
889454cc
...
...
@@ -20,7 +20,6 @@ import {ContributableActionProvider} from 'vs/workbench/browser/actionBarRegistr
import
{
ITree
,
IElementCallback
}
from
'
vs/base/parts/tree/browser/tree
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
WorkbenchComponent
}
from
'
vs/workbench/common/component
'
;
import
{
EditorInputEvent
,
EventType
}
from
'
vs/workbench/common/events
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
Identifiers
}
from
'
vs/workbench/common/constants
'
;
import
{
IEditorInput
}
from
'
vs/platform/editor/common/editor
'
;
...
...
@@ -125,7 +124,7 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
// Listen on Editor Input Changes to show in MRU List
this
.
toUnbind
.
push
(
this
.
editorService
.
onEditorsChanged
(()
=>
this
.
onEditorsChanged
()));
this
.
toUnbind
.
push
(
this
.
e
ventService
.
addListener2
(
EventType
.
EDITOR_SET_INPUT_ERROR
,
(
e
:
EditorInputEvent
)
=>
this
.
onEditorInputSetError
(
e
)));
this
.
toUnbind
.
push
(
this
.
e
ditorService
.
onEditorOpenFail
(
e
=>
this
.
onEditorInputSetError
(
e
)));
// Editor History Model
this
.
editorHistoryModel
=
new
EditorHistoryModel
(
this
.
editorService
,
this
.
instantiationService
,
this
.
contextService
);
...
...
@@ -151,8 +150,8 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
}
}
private
onEditorInputSetError
(
e
:
EditorInputEven
t
):
void
{
this
.
removeEditorHistoryEntry
(
e
.
editorInput
);
// make sure this input does not show up in history if it failed to open
private
onEditorInputSetError
(
e
:
IEditorInpu
t
):
void
{
this
.
removeEditorHistoryEntry
(
e
);
// make sure this input does not show up in history if it failed to open
}
public
getEditorHistory
():
IEditorInput
[]
{
...
...
src/vs/workbench/common/events.ts
浏览文件 @
889454cc
...
...
@@ -31,11 +31,6 @@ export class EventType {
*/
static
EDITOR_INPUT_OPENING
=
'
editorInputOpening
'
;
/**
* Event type for when the editor input failed to be set to the editor.
*/
static
EDITOR_SET_INPUT_ERROR
=
'
editorSetInputError
'
;
/**
* Event type for when a composite is about to open.
*/
...
...
src/vs/workbench/services/editor/browser/editorService.ts
浏览文件 @
889454cc
...
...
@@ -31,6 +31,7 @@ export interface IEditorPart {
// Events
onEditorsChanged
:
Event
<
void
>
;
onEditorsMoved
:
Event
<
void
>
;
onEditorOpenFail
:
Event
<
IEditorInput
>
;
// Methods
openEditor
(
input
?:
EditorInput
,
options
?:
EditorOptions
,
sideBySide
?:
boolean
):
TPromise
<
BaseEditor
>
;
...
...
@@ -77,6 +78,10 @@ export class WorkbenchEditorService implements IWorkbenchEditorService {
return
this
.
editorPart
.
onEditorsMoved
;
}
public
get
onEditorOpenFail
():
Event
<
IEditorInput
>
{
return
this
.
editorPart
.
onEditorOpenFail
;
}
public
getActiveEditor
():
IEditor
{
return
this
.
editorPart
.
getActiveEditor
();
}
...
...
src/vs/workbench/services/editor/common/editorService.ts
浏览文件 @
889454cc
...
...
@@ -34,6 +34,11 @@ export interface IWorkbenchEditorService extends IEditorService {
*/
onEditorsMoved
:
Event
<
void
>
;
/**
* Emitted when opening an editor fails.
*/
onEditorOpenFail
:
Event
<
IEditorInput
>
;
/**
* Returns the currently active editor or null if none.
*/
...
...
src/vs/workbench/test/browser/services.test.ts
浏览文件 @
889454cc
...
...
@@ -79,6 +79,10 @@ class TestEditorPart implements IEditorPart {
return
null
;
}
public
get
onEditorOpenFail
():
Event
<
EditorInput
>
{
return
null
;
}
public
replaceEditors
(
editors
:
{
toReplace
:
EditorInput
,
replaceWith
:
EditorInput
,
options
?:
any
}[]):
TPromise
<
IEditor
[]
>
{
return
TPromise
.
as
([]);
}
...
...
src/vs/workbench/test/common/servicesTestUtils.ts
浏览文件 @
889454cc
...
...
@@ -294,12 +294,14 @@ export class TestEditorService implements WorkbenchEditorService.IWorkbenchEdito
private
_onEditorsChanged
:
Emitter
<
void
>
;
private
_onEditorsMoved
:
Emitter
<
void
>
;
private
_onEditorOpenFail
:
Emitter
<
IEditorInput
>
;
constructor
(
callback
?:
(
method
:
string
)
=>
void
)
{
this
.
callback
=
callback
||
((
s
:
string
)
=>
{
});
this
.
_onEditorsChanged
=
new
Emitter
<
void
>
();
this
.
_onEditorsMoved
=
new
Emitter
<
void
>
();
this
.
_onEditorOpenFail
=
new
Emitter
<
IEditorInput
>
();
let
services
=
new
ServiceCollection
();
...
...
@@ -325,6 +327,10 @@ export class TestEditorService implements WorkbenchEditorService.IWorkbenchEdito
return
this
.
_onEditorsMoved
.
event
;
}
public
get
onEditorOpenFail
():
Event
<
IEditorInput
>
{
return
this
.
_onEditorOpenFail
.
event
;
}
public
openEditors
(
inputs
):
Promise
{
return
TPromise
.
as
([]);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录