Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c3c933ad
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,体验更适合开发者的 AI 搜索 >>
提交
c3c933ad
编写于
9月 01, 2020
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prevent creation of terminals when processes aren't supported
上级
6d22bbd6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
24 deletion
+33
-24
src/vs/workbench/contrib/terminal/browser/terminalActions.ts
src/vs/workbench/contrib/terminal/browser/terminalActions.ts
+30
-24
src/vs/workbench/contrib/terminal/browser/terminalService.ts
src/vs/workbench/contrib/terminal/browser/terminalService.ts
+3
-0
未找到文件。
src/vs/workbench/contrib/terminal/browser/terminalActions.ts
浏览文件 @
c3c933ad
...
@@ -84,7 +84,7 @@ export class ToggleTerminalAction extends ToggleViewAction {
...
@@ -84,7 +84,7 @@ export class ToggleTerminalAction extends ToggleViewAction {
}
}
async
run
()
{
async
run
()
{
if
(
this
.
terminalService
.
terminalInstances
.
length
===
0
)
{
if
(
this
.
terminalService
.
isProcessSupportRegistered
&&
this
.
terminalService
.
terminalInstances
.
length
===
0
)
{
// If there is not yet an instance attempt to create it here so that we can suggest a
// If there is not yet an instance attempt to create it here so that we can suggest a
// new shell on Windows (and not do so when the panel is restored on reload).
// new shell on Windows (and not do so when the panel is restored on reload).
const
newTerminalInstance
=
this
.
terminalService
.
createTerminal
(
undefined
);
const
newTerminalInstance
=
this
.
terminalService
.
createTerminal
(
undefined
);
...
@@ -201,23 +201,25 @@ export class CreateNewTerminalAction extends Action {
...
@@ -201,23 +201,25 @@ export class CreateNewTerminalAction extends Action {
}
}
}
}
let
instance
:
ITerminalInstance
|
undefined
;
if
(
this
.
_terminalService
.
isProcessSupportRegistered
)
{
if
(
folders
.
length
<=
1
)
{
let
instance
:
ITerminalInstance
|
undefined
;
// Allow terminal service to handle the path when there is only a
if
(
folders
.
length
<=
1
)
{
// single root
// Allow terminal service to handle the path when there is only a
instance
=
this
.
_terminalService
.
createTerminal
(
undefined
);
// single root
}
else
{
instance
=
this
.
_terminalService
.
createTerminal
(
undefined
);
const
options
:
IPickOptions
<
IQuickPickItem
>
=
{
}
else
{
placeHolder
:
localize
(
'
workbench.action.terminal.newWorkspacePlaceholder
'
,
"
Select current working directory for new terminal
"
)
const
options
:
IPickOptions
<
IQuickPickItem
>
=
{
};
placeHolder
:
localize
(
'
workbench.action.terminal.newWorkspacePlaceholder
'
,
"
Select current working directory for new terminal
"
)
const
workspace
=
await
this
.
_commandService
.
executeCommand
(
PICK_WORKSPACE_FOLDER_COMMAND_ID
,
[
options
]);
};
if
(
!
workspace
)
{
const
workspace
=
await
this
.
_commandService
.
executeCommand
(
PICK_WORKSPACE_FOLDER_COMMAND_ID
,
[
options
]);
// Don't create the instance if the workspace picker was canceled
if
(
!
workspace
)
{
return
;
// Don't create the instance if the workspace picker was canceled
return
;
}
instance
=
this
.
_terminalService
.
createTerminal
({
cwd
:
workspace
.
uri
});
}
}
instance
=
this
.
_terminalService
.
createTerminal
({
cwd
:
workspace
.
uri
}
);
this
.
_terminalService
.
setActiveInstance
(
instance
);
}
}
this
.
_terminalService
.
setActiveInstance
(
instance
);
await
this
.
_terminalService
.
showPanel
(
true
);
await
this
.
_terminalService
.
showPanel
(
true
);
}
}
}
}
...
@@ -442,11 +444,13 @@ export function registerTerminalActions() {
...
@@ -442,11 +444,13 @@ export function registerTerminalActions() {
}
}
async
run
(
accessor
:
ServicesAccessor
)
{
async
run
(
accessor
:
ServicesAccessor
)
{
const
terminalService
=
accessor
.
get
(
ITerminalService
);
const
terminalService
=
accessor
.
get
(
ITerminalService
);
const
instance
=
terminalService
.
createTerminal
(
undefined
);
if
(
terminalService
.
isProcessSupportRegistered
)
{
if
(
!
instance
)
{
const
instance
=
terminalService
.
createTerminal
(
undefined
);
return
;
if
(
!
instance
)
{
return
;
}
terminalService
.
setActiveInstance
(
instance
);
}
}
terminalService
.
setActiveInstance
(
instance
);
await
terminalService
.
showPanel
(
true
);
await
terminalService
.
showPanel
(
true
);
}
}
});
});
...
@@ -1183,11 +1187,13 @@ export function registerTerminalActions() {
...
@@ -1183,11 +1187,13 @@ export function registerTerminalActions() {
}
}
async
run
(
accessor
:
ServicesAccessor
,
args
?:
{
cwd
?:
string
})
{
async
run
(
accessor
:
ServicesAccessor
,
args
?:
{
cwd
?:
string
})
{
const
terminalService
=
accessor
.
get
(
ITerminalService
);
const
terminalService
=
accessor
.
get
(
ITerminalService
);
const
instance
=
terminalService
.
createTerminal
({
cwd
:
args
?.
cwd
});
if
(
terminalService
.
isProcessSupportRegistered
)
{
if
(
!
instance
)
{
const
instance
=
terminalService
.
createTerminal
({
cwd
:
args
?.
cwd
});
return
;
if
(
!
instance
)
{
return
;
}
terminalService
.
setActiveInstance
(
instance
);
}
}
terminalService
.
setActiveInstance
(
instance
);
return
terminalService
.
showPanel
(
true
);
return
terminalService
.
showPanel
(
true
);
}
}
});
});
...
...
src/vs/workbench/contrib/terminal/browser/terminalService.ts
浏览文件 @
c3c933ad
...
@@ -607,6 +607,9 @@ export class TerminalService implements ITerminalService {
...
@@ -607,6 +607,9 @@ export class TerminalService implements ITerminalService {
}
}
public
createTerminal
(
shell
:
IShellLaunchConfig
=
{}):
ITerminalInstance
{
public
createTerminal
(
shell
:
IShellLaunchConfig
=
{}):
ITerminalInstance
{
if
(
!
this
.
isProcessSupportRegistered
)
{
throw
new
Error
(
'
Could not create terminal when process support is not registered
'
);
}
if
(
shell
.
hideFromUser
)
{
if
(
shell
.
hideFromUser
)
{
const
instance
=
this
.
createInstance
(
undefined
,
shell
);
const
instance
=
this
.
createInstance
(
undefined
,
shell
);
this
.
_backgroundedTerminalInstances
.
push
(
instance
);
this
.
_backgroundedTerminalInstances
.
push
(
instance
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录