Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
6bf0cde9
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,发现更多精彩内容 >>
提交
6bf0cde9
编写于
1月 09, 2017
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add createTerminal with options API with new option waitOnExit
Fixes #15583
上级
1fafbd08
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
58 addition
and
8 deletion
+58
-8
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+34
-0
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+4
-1
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
+14
-2
src/vs/workbench/api/node/mainThreadTerminalService.ts
src/vs/workbench/api/node/mainThreadTerminalService.ts
+2
-2
src/vs/workbench/parts/terminal/common/terminal.ts
src/vs/workbench/parts/terminal/common/terminal.ts
+1
-1
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
...kbench/parts/terminal/electron-browser/terminalService.ts
+2
-1
未找到文件。
src/vs/vscode.d.ts
浏览文件 @
6bf0cde9
...
...
@@ -3669,6 +3669,40 @@ declare module 'vscode' {
* @return A new Terminal.
*/
export
function
createTerminal
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[]):
Terminal
;
/**
* Creates a [Terminal](#Terminal). The cwd of the terminal will be the workspace directory
* if it exists, regardless of whether an explicit customStartPath setting exists.
*
* @param options A TerminalOptions object describing the characteristics of the new terminal.
* @return A new Terminal.
*/
export
function
createTerminal
(
options
:
TerminalOptions
):
Terminal
;
}
/**
* Value-object describing what options formatting should use.
*/
export
interface
TerminalOptions
{
/**
* A human-readable string which will be used to represent the terminal in the UI.
*/
name
?:
string
;
/**
* A path to a custom shell executable to be used in the terminal.
*/
shellPath
?:
string
;
/**
* Args for the custom shell executable, this does not work on Windows (see #8429)
*/
shellArgs
?:
string
[];
/**
* Whether the terminal should wait on exit for a keypress before closing the instance.
*/
waitOnExit
?:
boolean
;
}
/**
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
6bf0cde9
...
...
@@ -277,7 +277,10 @@ export function createApiFactory(initData: IInitData, threadService: IThreadServ
createOutputChannel
(
name
:
string
):
vscode
.
OutputChannel
{
return
extHostOutputService
.
createOutputChannel
(
name
);
},
createTerminal
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[]):
vscode
.
Terminal
{
createTerminal
(
nameOrOptions
:
vscode
.
TerminalOptions
|
string
,
shellPath
?:
string
,
shellArgs
?:
string
[]):
vscode
.
Terminal
{
if
(
typeof
nameOrOptions
===
'
object
'
)
{
return
extHostTerminalService
.
createTerminalFromOptions
(
<
vscode
.
TerminalOptions
>
nameOrOptions
);
}
return
extHostTerminalService
.
createTerminal
(
name
,
shellPath
,
shellArgs
);
},
// proposed API
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
6bf0cde9
...
...
@@ -184,7 +184,7 @@ export abstract class MainThreadOutputServiceShape {
}
export
abstract
class
MainThreadTerminalServiceShape
{
$createTerminal
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[]):
TPromise
<
number
>
{
throw
ni
();
}
$createTerminal
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[]
,
waitOnExit
?:
boolean
):
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
浏览文件 @
6bf0cde9
...
...
@@ -20,14 +20,20 @@ export class ExtHostTerminal implements vscode.Terminal {
private
_pidPromise
:
TPromise
<
number
>
;
private
_pidPromiseComplete
:
TValueCallback
<
number
>
;
constructor
(
proxy
:
MainThreadTerminalServiceShape
,
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[])
{
constructor
(
proxy
:
MainThreadTerminalServiceShape
,
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[],
waitOnExit
?:
boolean
)
{
this
.
_name
=
name
;
this
.
_queuedRequests
=
[];
this
.
_proxy
=
proxy
;
this
.
_pidPromise
=
new
TPromise
<
number
>
(
c
=>
{
this
.
_pidPromiseComplete
=
c
;
});
this
.
_proxy
.
$createTerminal
(
name
,
shellPath
,
shellArgs
).
then
((
id
)
=>
{
this
.
_proxy
.
$createTerminal
(
name
,
shellPath
,
shellArgs
,
waitOnExit
).
then
((
id
)
=>
{
this
.
_id
=
id
;
this
.
_queuedRequests
.
forEach
((
r
)
=>
{
r
.
run
(
this
.
_proxy
,
this
.
_id
);
...
...
@@ -107,6 +113,12 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
return
terminal
;
}
public
createTerminalFromOptions
(
options
:
vscode
.
TerminalOptions
):
vscode
.
Terminal
{
let
terminal
=
new
ExtHostTerminal
(
this
.
_proxy
,
options
.
name
,
options
.
shellPath
,
options
.
shellArgs
,
options
.
waitOnExit
);
this
.
_terminals
.
push
(
terminal
);
return
terminal
;
}
public
get
onDidCloseTerminal
():
Event
<
vscode
.
Terminal
>
{
return
this
.
_onDidCloseTerminal
&&
this
.
_onDidCloseTerminal
.
event
;
}
...
...
src/vs/workbench/api/node/mainThreadTerminalService.ts
浏览文件 @
6bf0cde9
...
...
@@ -30,8 +30,8 @@ export class MainThreadTerminalService extends MainThreadTerminalServiceShape {
this
.
_toDispose
=
dispose
(
this
.
_toDispose
);
}
public
$createTerminal
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[]):
TPromise
<
number
>
{
return
TPromise
.
as
(
this
.
terminalService
.
createInstance
(
name
,
shellPath
,
shellArgs
,
true
).
id
);
public
$createTerminal
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[]
,
waitOnExit
?:
boolean
):
TPromise
<
number
>
{
return
TPromise
.
as
(
this
.
terminalService
.
createInstance
(
name
,
shellPath
,
shellArgs
,
waitOnExit
,
true
).
id
);
}
public
$show
(
terminalId
:
number
,
preserveFocus
:
boolean
):
void
{
...
...
src/vs/workbench/parts/terminal/common/terminal.ts
浏览文件 @
6bf0cde9
...
...
@@ -100,7 +100,7 @@ export interface ITerminalService {
onInstanceTitleChanged
:
Event
<
string
>
;
terminalInstances
:
ITerminalInstance
[];
createInstance
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[],
ignoreCustomCwd
?:
boolean
):
ITerminalInstance
;
createInstance
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[],
waitOnExit
?:
boolean
,
ignoreCustomCwd
?:
boolean
):
ITerminalInstance
;
getInstanceFromId
(
terminalId
:
number
):
ITerminalInstance
;
getInstanceLabels
():
string
[];
getActiveInstance
():
ITerminalInstance
;
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
浏览文件 @
6bf0cde9
...
...
@@ -60,10 +60,11 @@ export class TerminalService implements ITerminalService {
this
.
onInstanceDisposed
((
terminalInstance
)
=>
{
this
.
_removeInstance
(
terminalInstance
);
});
}
public
createInstance
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[],
ignoreCustomCwd
?:
boolean
):
ITerminalInstance
{
public
createInstance
(
name
?:
string
,
shellPath
?:
string
,
shellArgs
?:
string
[],
waitOnExit
?:
boolean
,
ignoreCustomCwd
?:
boolean
):
ITerminalInstance
{
let
shell
:
IShellLaunchConfig
=
{
executable
:
shellPath
,
args
:
shellArgs
,
waitOnExit
,
ignoreCustomCwd
};
let
terminalInstance
=
this
.
_instantiationService
.
createInstance
(
TerminalInstance
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录