Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
5a5a9f7a
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,发现更多精彩内容 >>
提交
5a5a9f7a
编写于
9月 13, 2016
作者:
D
Daniel Imms
提交者:
Daniel Imms
9月 13, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reintroduce terminal API request queue system
Fixes #11990
上级
1e51cd3d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
41 addition
and
12 deletion
+41
-12
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+1
-1
src/vs/workbench/api/node/extHostTerminalService.ts
src/vs/workbench/api/node/extHostTerminalService.ts
+37
-9
src/vs/workbench/api/node/mainThreadTerminalService.ts
src/vs/workbench/api/node/mainThreadTerminalService.ts
+3
-2
未找到文件。
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
5a5a9f7a
...
...
@@ -153,7 +153,7 @@ export abstract class MainThreadOutputServiceShape {
}
export
abstract
class
MainThreadTerminalServiceShape
{
$createTerminal
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[]):
number
{
throw
ni
();
}
$createTerminal
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[]):
TPromise
<
number
>
{
throw
ni
();
}
$dispose
(
terminalId
:
number
):
void
{
throw
ni
();
}
$hide
(
terminalId
:
number
):
void
{
throw
ni
();
}
$sendText
(
terminalId
:
number
,
text
:
string
,
addNewLine
:
boolean
):
void
{
throw
ni
();
}
...
...
src/vs/workbench/api/node/extHostTerminalService.ts
浏览文件 @
5a5a9f7a
...
...
@@ -10,16 +10,21 @@ import {MainContext, MainThreadTerminalServiceShape} from './extHost.protocol';
export
class
ExtHostTerminal
implements
vscode
.
Terminal
{
public
_name
:
string
;
private
_name
:
string
;
private
_id
:
number
;
private
_proxy
:
MainThreadTerminalServiceShape
;
private
_disposed
:
boolean
;
private
_queuedRequests
:
ApiRequest
[]
=
[];
constructor
(
proxy
:
MainThreadTerminalServiceShape
,
id
:
number
,
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[])
{
constructor
(
proxy
:
MainThreadTerminalServiceShape
,
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[])
{
this
.
_name
=
name
;
this
.
_proxy
=
proxy
;
this
.
_id
=
this
.
_proxy
.
$createTerminal
(
name
,
shellPath
,
shellArgs
);
this
.
_proxy
.
$createTerminal
(
name
,
shellPath
,
shellArgs
).
then
((
id
)
=>
{
this
.
_id
=
id
;
this
.
_queuedRequests
.
forEach
((
r
)
=>
{
r
.
run
(
this
.
_proxy
,
this
.
_id
);
});
});
}
public
get
name
():
string
{
...
...
@@ -29,26 +34,35 @@ export class ExtHostTerminal implements vscode.Terminal {
public
sendText
(
text
:
string
,
addNewLine
:
boolean
=
true
):
void
{
this
.
_checkDisposed
();
this
.
_
proxy
.
$sendText
(
this
.
_id
,
text
,
addNewLine
);
this
.
_
queueApiRequest
(
this
.
_proxy
.
$sendText
,
[
text
,
addNewLine
]
);
}
public
show
(
preserveFocus
:
boolean
):
void
{
this
.
_checkDisposed
();
this
.
_
proxy
.
$show
(
this
.
_id
,
preserveFocus
);
this
.
_
queueApiRequest
(
this
.
_proxy
.
$show
,
[
preserveFocus
]
);
}
public
hide
():
void
{
this
.
_checkDisposed
();
this
.
_
proxy
.
$hide
(
this
.
_id
);
this
.
_
queueApiRequest
(
this
.
_proxy
.
$hide
,
[]
);
}
public
dispose
():
void
{
if
(
!
this
.
_disposed
)
{
this
.
_disposed
=
true
;
this
.
_
proxy
.
$dispose
(
this
.
_id
);
this
.
_
queueApiRequest
(
this
.
_proxy
.
$dispose
,
[]
);
}
}
private
_queueApiRequest
(
callback
:
(...
args
:
any
[])
=>
void
,
args
:
any
[])
{
let
request
:
ApiRequest
=
new
ApiRequest
(
callback
,
args
);
if
(
!
this
.
_id
)
{
this
.
_queuedRequests
.
push
(
request
);
return
;
}
request
.
run
(
this
.
_proxy
,
this
.
_id
);
}
private
_checkDisposed
()
{
if
(
this
.
_disposed
)
{
throw
new
Error
(
'
Terminal has already been disposed
'
);
...
...
@@ -65,6 +79,20 @@ export class ExtHostTerminalService {
}
public
createTerminal
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[]):
vscode
.
Terminal
{
return
new
ExtHostTerminal
(
this
.
_proxy
,
-
1
,
name
,
shellPath
,
shellArgs
);
return
new
ExtHostTerminal
(
this
.
_proxy
,
name
,
shellPath
,
shellArgs
);
}
}
class
ApiRequest
{
private
_callback
:
(...
args
:
any
[])
=>
void
;
private
_args
:
any
[];
constructor
(
callback
:
(...
args
:
any
[])
=>
void
,
args
:
any
[])
{
this
.
_callback
=
callback
;
this
.
_args
=
args
;
}
public
run
(
proxy
:
MainThreadTerminalServiceShape
,
id
:
number
)
{
this
.
_callback
.
apply
(
proxy
,
[
id
].
concat
(
this
.
_args
));
}
}
\ No newline at end of file
src/vs/workbench/api/node/mainThreadTerminalService.ts
浏览文件 @
5a5a9f7a
...
...
@@ -8,6 +8,7 @@ import {ITerminalService} from 'vs/workbench/parts/terminal/electron-browser/ter
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
MainThreadTerminalServiceShape
}
from
'
./extHost.protocol
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
export
class
MainThreadTerminalService
extends
MainThreadTerminalServiceShape
{
...
...
@@ -19,8 +20,8 @@ export class MainThreadTerminalService extends MainThreadTerminalServiceShape {
super
();
}
public
$createTerminal
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[]):
number
{
return
this
.
terminalService
.
createInstance
(
name
,
shellPath
,
shellArgs
).
id
;
public
$createTerminal
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[]):
TPromise
<
number
>
{
return
TPromise
.
as
(
this
.
terminalService
.
createInstance
(
name
,
shellPath
,
shellArgs
).
id
)
;
}
public
$show
(
terminalId
:
number
,
preserveFocus
:
boolean
):
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录