Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
2e02b52d
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,发现更多精彩内容 >>
提交
2e02b52d
编写于
9月 15, 2016
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Have terminal service clean up instances using event
上级
5094cf07
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
16 deletion
+13
-16
src/vs/workbench/api/node/mainThreadTerminalService.ts
src/vs/workbench/api/node/mainThreadTerminalService.ts
+2
-2
src/vs/workbench/parts/terminal/electron-browser/terminal.ts
src/vs/workbench/parts/terminal/electron-browser/terminal.ts
+1
-1
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
...bench/parts/terminal/electron-browser/terminalInstance.ts
+4
-7
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
...kbench/parts/terminal/electron-browser/terminalService.ts
+6
-6
未找到文件。
src/vs/workbench/api/node/mainThreadTerminalService.ts
浏览文件 @
2e02b52d
...
...
@@ -26,7 +26,7 @@ export class MainThreadTerminalService extends MainThreadTerminalServiceShape {
super
();
this
.
_proxy
=
threadService
.
get
(
ExtHostContext
.
ExtHostTerminalService
);
this
.
_toDispose
=
[];
this
.
_toDispose
.
push
(
terminalService
.
onInstance
Closed
((
terminalInstance
)
=>
this
.
_onTerminalCl
osed
(
terminalInstance
)));
this
.
_toDispose
.
push
(
terminalService
.
onInstance
Disposed
((
terminalInstance
)
=>
this
.
_onTerminalDisp
osed
(
terminalInstance
)));
}
public
dispose
():
void
{
...
...
@@ -65,7 +65,7 @@ export class MainThreadTerminalService extends MainThreadTerminalServiceShape {
}
}
private
_onTerminal
Cl
osed
(
terminalInstance
:
ITerminalInstance
):
void
{
private
_onTerminal
Disp
osed
(
terminalInstance
:
ITerminalInstance
):
void
{
this
.
_proxy
.
$acceptTerminalClosed
(
terminalInstance
.
id
);
}
}
src/vs/workbench/parts/terminal/electron-browser/terminal.ts
浏览文件 @
2e02b52d
...
...
@@ -58,7 +58,7 @@ export interface ITerminalService {
activeTerminalInstanceIndex
:
number
;
configHelper
:
TerminalConfigHelper
;
onActiveInstanceChanged
:
Event
<
string
>
;
onInstance
Cl
osed
:
Event
<
ITerminalInstance
>
;
onInstance
Disp
osed
:
Event
<
ITerminalInstance
>
;
onInstancesChanged
:
Event
<
string
>
;
onInstanceTitleChanged
:
Event
<
string
>
;
terminalInstances
:
ITerminalInstance
[];
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
浏览文件 @
2e02b52d
...
...
@@ -31,11 +31,11 @@ export class TerminalInstance implements ITerminalInstance {
private
_id
:
number
;
private
_title
:
string
;
private
_on
Cl
osed
:
Emitter
<
TerminalInstance
>
;
private
_on
Disp
osed
:
Emitter
<
TerminalInstance
>
;
private
_onTitleChanged
:
Emitter
<
string
>
;
public
get
id
():
number
{
return
this
.
_id
;
}
public
get
title
():
string
{
return
this
.
_title
;
}
public
get
onClosed
():
Event
<
TerminalInstance
>
{
return
this
.
_on
Cl
osed
.
event
;
}
public
get
onClosed
():
Event
<
TerminalInstance
>
{
return
this
.
_on
Disp
osed
.
event
;
}
public
get
onTitleChanged
():
Event
<
string
>
{
return
this
.
_onTitleChanged
.
event
;
}
private
isExiting
:
boolean
=
false
;
...
...
@@ -49,7 +49,6 @@ export class TerminalInstance implements ITerminalInstance {
public
constructor
(
private
terminalFocusContextKey
:
IContextKey
<
boolean
>
,
private
onExitCallback
:
(
TerminalInstance
)
=>
void
,
private
configHelper
:
TerminalConfigHelper
,
private
container
:
HTMLElement
,
private
workspace
:
IWorkspace
,
...
...
@@ -60,7 +59,7 @@ export class TerminalInstance implements ITerminalInstance {
)
{
this
.
_id
=
TerminalInstance
.
ID_COUNTER
++
;
this
.
_onTitleChanged
=
new
Emitter
<
string
>
();
this
.
_on
Cl
osed
=
new
Emitter
<
TerminalInstance
>
();
this
.
_on
Disp
osed
=
new
Emitter
<
TerminalInstance
>
();
this
.
createProcess
(
workspace
,
name
,
shell
);
if
(
container
)
{
...
...
@@ -170,10 +169,8 @@ export class TerminalInstance implements ITerminalInstance {
}
this
.
process
=
null
;
}
this
.
_on
Cl
osed
.
fire
(
this
);
this
.
_on
Disp
osed
.
fire
(
this
);
this
.
toDispose
=
lifecycle
.
dispose
(
this
.
toDispose
);
// TODO: Move exit callback to listen onClose event
this
.
onExitCallback
(
this
);
}
public
focus
(
force
?:
boolean
):
void
{
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
浏览文件 @
2e02b52d
...
...
@@ -23,14 +23,14 @@ export class TerminalService implements ITerminalService {
private
_activeTerminalInstanceIndex
:
number
=
0
;
private
_configHelper
:
TerminalConfigHelper
;
private
_onActiveInstanceChanged
:
Emitter
<
string
>
;
private
_onInstance
Cl
osed
:
Emitter
<
ITerminalInstance
>
;
private
_onInstance
Disp
osed
:
Emitter
<
ITerminalInstance
>
;
private
_onInstanceTitleChanged
:
Emitter
<
string
>
;
private
_onInstancesChanged
:
Emitter
<
string
>
;
private
_terminalInstances
:
ITerminalInstance
[]
=
[];
public
get
activeTerminalInstanceIndex
():
number
{
return
this
.
_activeTerminalInstanceIndex
;
}
public
get
configHelper
():
TerminalConfigHelper
{
return
this
.
_configHelper
;
}
public
get
onActiveInstanceChanged
():
Event
<
string
>
{
return
this
.
_onActiveInstanceChanged
.
event
;
}
public
get
onInstance
Closed
():
Event
<
ITerminalInstance
>
{
return
this
.
_onInstanceCl
osed
.
event
;
}
public
get
onInstance
Disposed
():
Event
<
ITerminalInstance
>
{
return
this
.
_onInstanceDisp
osed
.
event
;
}
public
get
onInstanceTitleChanged
():
Event
<
string
>
{
return
this
.
_onInstanceTitleChanged
.
event
;
}
public
get
onInstancesChanged
():
Event
<
string
>
{
return
this
.
_onInstancesChanged
.
event
;
}
public
get
terminalInstances
():
ITerminalInstance
[]
{
return
this
.
_terminalInstances
;
}
...
...
@@ -47,11 +47,12 @@ export class TerminalService implements ITerminalService {
@
IWorkspaceContextService
private
workspaceContextService
:
IWorkspaceContextService
)
{
this
.
_onActiveInstanceChanged
=
new
Emitter
<
string
>
();
this
.
_onInstance
Cl
osed
=
new
Emitter
<
ITerminalInstance
>
();
this
.
_onInstance
Disp
osed
=
new
Emitter
<
ITerminalInstance
>
();
this
.
_onInstancesChanged
=
new
Emitter
<
string
>
();
this
.
_onInstanceTitleChanged
=
new
Emitter
<
string
>
();
this
.
terminalFocusContextKey
=
KEYBINDING_CONTEXT_TERMINAL_FOCUS
.
bindTo
(
this
.
contextKeyService
);
this
.
_configHelper
=
<
TerminalConfigHelper
>
this
.
instantiationService
.
createInstance
(
TerminalConfigHelper
,
platform
.
platform
);
this
.
onInstanceDisposed
((
terminalInstance
)
=>
{
this
.
removeInstance
(
terminalInstance
);
});
}
public
createInstance
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[]):
ITerminalInstance
{
...
...
@@ -61,14 +62,13 @@ export class TerminalService implements ITerminalService {
};
let
terminalInstance
=
<
TerminalInstance
>
this
.
instantiationService
.
createInstance
(
TerminalInstance
,
this
.
terminalFocusContextKey
,
this
.
onTerminalInstanceDispose
.
bind
(
this
),
this
.
_configHelper
,
this
.
terminalContainer
,
this
.
workspaceContextService
.
getWorkspace
(),
name
,
shell
);
terminalInstance
.
addDisposable
(
terminalInstance
.
onTitleChanged
(
this
.
_onInstanceTitleChanged
.
fire
,
this
.
_onInstanceTitleChanged
));
terminalInstance
.
addDisposable
(
terminalInstance
.
onClosed
(
this
.
_onInstance
Closed
.
fire
,
this
.
_onInstanceCl
osed
));
terminalInstance
.
addDisposable
(
terminalInstance
.
onClosed
(
this
.
_onInstance
Disposed
.
fire
,
this
.
_onInstanceDisp
osed
));
this
.
terminalInstances
.
push
(
terminalInstance
);
if
(
this
.
terminalInstances
.
length
===
1
)
{
// It's the first instance so it should be made active automatically
...
...
@@ -82,7 +82,7 @@ export class TerminalService implements ITerminalService {
return
this
.
_terminalInstances
.
map
((
instance
,
index
)
=>
`
${
index
+
1
}
:
${
instance
.
title
}
`
);
}
private
onTerminalInstanceDispose
(
terminalInstance
:
TerminalInstance
):
void
{
private
removeInstance
(
terminalInstance
:
I
TerminalInstance
):
void
{
let
index
=
this
.
terminalInstances
.
indexOf
(
terminalInstance
);
let
wasActiveInstance
=
terminalInstance
===
this
.
getActiveInstance
();
if
(
index
!==
-
1
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录