Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
87b18670
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,发现更多精彩内容 >>
提交
87b18670
编写于
5月 23, 2019
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Get onData listener working
上级
da245253
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
53 addition
and
8 deletion
+53
-8
src/vs/workbench/contrib/terminal/browser/terminalService.ts
src/vs/workbench/contrib/terminal/browser/terminalService.ts
+25
-1
src/vs/workbench/contrib/terminal/browser/terminalTab.ts
src/vs/workbench/contrib/terminal/browser/terminalTab.ts
+12
-7
src/vs/workbench/contrib/terminal/common/terminalService.ts
src/vs/workbench/contrib/terminal/common/terminalService.ts
+16
-0
未找到文件。
src/vs/workbench/contrib/terminal/browser/terminalService.ts
浏览文件 @
87b18670
...
...
@@ -53,11 +53,13 @@ export abstract class TerminalService extends CommonTerminalService implements I
if
(
shell
.
runInBackground
)
{
// TODO: When show is triggered, create a TerminalTab for this instance
// TODO: How do backgrounded terminals interact with extensions listening for them, just ignore?
return
this
.
createInstance
(
this
.
_terminalFocusContextKey
,
const
instance
=
this
.
createInstance
(
this
.
_terminalFocusContextKey
,
this
.
configHelper
,
undefined
,
shell
,
true
);
this
.
_backgroundedTerminalInstances
.
push
(
instance
);
return
instance
;
}
const
terminalTab
=
this
.
_instantiationService
.
createInstance
(
TerminalTab
,
this
.
_terminalFocusContextKey
,
...
...
@@ -77,6 +79,28 @@ export abstract class TerminalService extends CommonTerminalService implements I
return
instance
;
}
protected
_showBackgroundTerminal
(
instance
:
ITerminalInstance
):
void
{
// TODO: Remove from _backgroundedTerminalInstances
this
.
_backgroundedTerminalInstances
=
this
.
_backgroundedTerminalInstances
.
splice
(
this
.
_backgroundedTerminalInstances
.
indexOf
(
instance
),
1
);
instance
.
shellLaunchConfig
.
runInBackground
=
false
;
console
.
log
(
'
show backgrounded terminal
'
,
instance
);
const
terminalTab
=
this
.
_instantiationService
.
createInstance
(
TerminalTab
,
this
.
_terminalFocusContextKey
,
this
.
configHelper
,
this
.
_terminalContainer
,
instance
);
this
.
_terminalTabs
.
push
(
terminalTab
);
terminalTab
.
addDisposable
(
terminalTab
.
onDisposed
(
this
.
_onTabDisposed
.
fire
,
this
.
_onTabDisposed
));
terminalTab
.
addDisposable
(
terminalTab
.
onInstancesChanged
(
this
.
_onInstancesChanged
.
fire
,
this
.
_onInstancesChanged
));
this
.
_initInstanceListeners
(
instance
);
if
(
this
.
terminalInstances
.
length
===
1
)
{
// It's the first instance so it should be made active automatically
this
.
setActiveInstanceByIndex
(
0
);
}
this
.
_onInstancesChanged
.
fire
();
}
public
focusFindWidget
():
Promise
<
void
>
{
return
this
.
showPanel
(
false
).
then
(()
=>
{
const
panel
=
this
.
_panelService
.
getActivePanel
()
as
TerminalPanel
;
...
...
src/vs/workbench/contrib/terminal/browser/terminalTab.ts
浏览文件 @
87b18670
...
...
@@ -225,7 +225,7 @@ export class TerminalTab extends Disposable implements ITerminalTab {
terminalFocusContextKey
:
IContextKey
<
boolean
>
,
configHelper
:
ITerminalConfigHelper
,
private
_container
:
HTMLElement
,
shellLaunchConfig
:
IShellLaunchConfig
,
shellLaunchConfig
OrInstance
:
IShellLaunchConfig
|
ITerminalInstance
,
@
ITerminalService
private
readonly
_terminalService
:
ITerminalService
,
@
IWorkbenchLayoutService
private
readonly
_layoutService
:
IWorkbenchLayoutService
)
{
...
...
@@ -233,12 +233,17 @@ export class TerminalTab extends Disposable implements ITerminalTab {
this
.
_onDisposed
=
new
Emitter
<
ITerminalTab
>
();
this
.
_onInstancesChanged
=
new
Emitter
<
void
>
();
const
instance
=
this
.
_terminalService
.
createInstance
(
terminalFocusContextKey
,
configHelper
,
undefined
,
shellLaunchConfig
,
true
);
let
instance
:
ITerminalInstance
;
if
(
'
id
'
in
shellLaunchConfigOrInstance
)
{
instance
=
shellLaunchConfigOrInstance
;
}
else
{
instance
=
this
.
_terminalService
.
createInstance
(
terminalFocusContextKey
,
configHelper
,
undefined
,
shellLaunchConfigOrInstance
,
true
);
}
this
.
_terminalInstances
.
push
(
instance
);
this
.
_initInstanceListeners
(
instance
);
this
.
_activeInstanceIndex
=
0
;
...
...
src/vs/workbench/contrib/terminal/common/terminalService.ts
浏览文件 @
87b18670
...
...
@@ -30,6 +30,7 @@ export abstract class TerminalService implements ITerminalService {
protected
_findWidgetVisible
:
IContextKey
<
boolean
>
;
protected
_terminalContainer
:
HTMLElement
;
protected
_terminalTabs
:
ITerminalTab
[]
=
[];
protected
_backgroundedTerminalInstances
:
ITerminalInstance
[]
=
[];
protected
get
_terminalInstances
():
ITerminalInstance
[]
{
return
this
.
_terminalTabs
.
reduce
((
p
,
c
)
=>
p
.
concat
(
c
.
terminalInstances
),
<
ITerminalInstance
[]
>
[]);
}
...
...
@@ -103,6 +104,7 @@ export abstract class TerminalService implements ITerminalService {
protected
abstract
_getWslPath
(
path
:
string
):
Promise
<
string
>
;
protected
abstract
_getWindowsBuildNumber
():
number
;
protected
abstract
_showBackgroundTerminal
(
instance
:
ITerminalInstance
):
void
;
public
abstract
refreshActiveTab
():
void
;
public
abstract
createTerminal
(
shell
?:
IShellLaunchConfig
,
wasNewTerminalAction
?:
boolean
):
ITerminalInstance
;
...
...
@@ -222,6 +224,15 @@ export abstract class TerminalService implements ITerminalService {
}
public
getInstanceFromId
(
terminalId
:
number
):
ITerminalInstance
{
let
bgIndex
=
-
1
;
this
.
_backgroundedTerminalInstances
.
forEach
((
terminalInstance
,
i
)
=>
{
if
(
terminalInstance
.
id
===
terminalId
)
{
bgIndex
=
i
;
}
});
if
(
bgIndex
!==
-
1
)
{
return
this
.
_backgroundedTerminalInstances
[
bgIndex
];
}
return
this
.
terminalInstances
[
this
.
_getIndexFromId
(
terminalId
)];
}
...
...
@@ -230,6 +241,11 @@ export abstract class TerminalService implements ITerminalService {
}
public
setActiveInstance
(
terminalInstance
:
ITerminalInstance
):
void
{
// If this was a runInBackground terminal created by the API this was triggered by show,
// in which case we need to create the terminal tab
if
(
terminalInstance
.
shellLaunchConfig
.
runInBackground
)
{
this
.
_showBackgroundTerminal
(
terminalInstance
);
}
this
.
setActiveInstanceByIndex
(
this
.
_getIndexFromId
(
terminalInstance
.
id
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录