Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
bfa3db2f
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,发现更多精彩内容 >>
提交
bfa3db2f
编写于
9月 05, 2019
作者:
A
Alex Ross
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow one-off global tasks if they have a cwd
Fixes #78817
上级
e85f2a3b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
16 deletion
+12
-16
src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts
src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts
+12
-16
未找到文件。
src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts
浏览文件 @
bfa3db2f
...
...
@@ -60,7 +60,7 @@ interface ActiveTerminalData {
class
VariableResolver
{
constructor
(
public
workspaceFolder
:
IWorkspaceFolder
,
public
taskSystemInfo
:
TaskSystemInfo
|
undefined
,
private
_values
:
Map
<
string
,
string
>
,
private
_service
:
IConfigurationResolverService
|
undefined
)
{
constructor
(
public
workspaceFolder
:
IWorkspaceFolder
|
undefined
,
public
taskSystemInfo
:
TaskSystemInfo
|
undefined
,
private
_values
:
Map
<
string
,
string
>
,
private
_service
:
IConfigurationResolverService
|
undefined
)
{
}
resolve
(
value
:
string
):
string
{
return
value
.
replace
(
/
\$\{(
.*
?)\}
/g
,
(
match
:
string
,
variable
:
string
)
=>
{
...
...
@@ -389,7 +389,7 @@ export class TerminalTaskSystem implements ITaskSystem {
}
}
private
resolveVariablesFromSet
(
taskSystemInfo
:
TaskSystemInfo
|
undefined
,
workspaceFolder
:
IWorkspaceFolder
,
task
:
CustomTask
|
ContributedTask
,
variables
:
Set
<
string
>
):
Promise
<
ResolvedVariables
>
{
private
resolveVariablesFromSet
(
taskSystemInfo
:
TaskSystemInfo
|
undefined
,
workspaceFolder
:
IWorkspaceFolder
|
undefined
,
task
:
CustomTask
|
ContributedTask
,
variables
:
Set
<
string
>
):
Promise
<
ResolvedVariables
>
{
let
isProcess
=
task
.
command
&&
task
.
command
.
runtime
===
RuntimeType
.
Process
;
let
options
=
task
.
command
&&
task
.
command
.
options
?
task
.
command
.
options
:
undefined
;
let
cwd
=
options
?
options
.
cwd
:
undefined
;
...
...
@@ -406,7 +406,7 @@ export class TerminalTaskSystem implements ITaskSystem {
}
let
resolvedVariables
:
Promise
<
ResolvedVariables
>
;
if
(
taskSystemInfo
)
{
if
(
taskSystemInfo
&&
workspaceFolder
)
{
let
resolveSet
:
ResolveSet
=
{
variables
};
...
...
@@ -463,10 +463,7 @@ export class TerminalTaskSystem implements ITaskSystem {
private
executeCommand
(
task
:
CustomTask
|
ContributedTask
,
trigger
:
string
):
Promise
<
ITaskSummary
>
{
const
workspaceFolder
=
this
.
currentTask
.
workspaceFolder
=
task
.
getWorkspaceFolder
();
if
(
workspaceFolder
===
undefined
)
{
return
Promise
.
reject
(
new
Error
(
`Must have workspace folder
${
task
.
_label
}
`
));
}
const
systemInfo
=
this
.
currentTask
.
systemInfo
=
this
.
taskSystemInfoResolver
(
workspaceFolder
);
const
systemInfo
:
TaskSystemInfo
|
undefined
=
this
.
currentTask
.
systemInfo
=
workspaceFolder
?
this
.
taskSystemInfoResolver
(
workspaceFolder
)
:
undefined
;
let
variables
=
new
Set
<
string
>
();
this
.
collectTaskVariables
(
variables
,
task
);
...
...
@@ -515,7 +512,7 @@ export class TerminalTaskSystem implements ITaskSystem {
}
}
private
async
executeInTerminal
(
task
:
CustomTask
|
ContributedTask
,
trigger
:
string
,
resolver
:
VariableResolver
,
workspaceFolder
:
IWorkspaceFolder
):
Promise
<
ITaskSummary
>
{
private
async
executeInTerminal
(
task
:
CustomTask
|
ContributedTask
,
trigger
:
string
,
resolver
:
VariableResolver
,
workspaceFolder
:
IWorkspaceFolder
|
undefined
):
Promise
<
ITaskSummary
>
{
let
terminal
:
ITerminalInstance
|
undefined
=
undefined
;
let
executedCommand
:
string
|
undefined
=
undefined
;
let
error
:
TaskError
|
undefined
=
undefined
;
...
...
@@ -761,7 +758,7 @@ export class TerminalTaskSystem implements ITaskSystem {
});
}
private
createTerminalName
(
task
:
CustomTask
|
ContributedTask
,
workspaceFolder
:
IWorkspaceFolder
):
string
{
private
createTerminalName
(
task
:
CustomTask
|
ContributedTask
):
string
{
const
needsFolderQualification
=
this
.
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
WORKSPACE
;
return
nls
.
localize
(
'
TerminalTaskSystem.terminalName
'
,
'
Task - {0}
'
,
needsFolderQualification
?
task
.
getQualifiedLabel
()
:
task
.
configurationProperties
.
name
);
}
...
...
@@ -774,11 +771,11 @@ export class TerminalTaskSystem implements ITaskSystem {
return
URI
.
from
({
scheme
:
Schemas
.
file
,
path
:
this
.
environmentService
.
userHome
});
}
private
async
createShellLaunchConfig
(
task
:
CustomTask
|
ContributedTask
,
workspaceFolder
:
IWorkspaceFolder
,
variableResolver
:
VariableResolver
,
platform
:
Platform
.
Platform
,
options
:
CommandOptions
,
command
:
CommandString
,
args
:
CommandString
[],
waitOnExit
:
boolean
|
string
):
Promise
<
IShellLaunchConfig
|
undefined
>
{
private
async
createShellLaunchConfig
(
task
:
CustomTask
|
ContributedTask
,
workspaceFolder
:
IWorkspaceFolder
|
undefined
,
variableResolver
:
VariableResolver
,
platform
:
Platform
.
Platform
,
options
:
CommandOptions
,
command
:
CommandString
,
args
:
CommandString
[],
waitOnExit
:
boolean
|
string
):
Promise
<
IShellLaunchConfig
|
undefined
>
{
let
shellLaunchConfig
:
IShellLaunchConfig
;
let
isShellCommand
=
task
.
command
.
runtime
===
RuntimeType
.
Shell
;
let
needsFolderQualification
=
this
.
contextService
.
getWorkbenchState
()
===
WorkbenchState
.
WORKSPACE
;
let
terminalName
=
this
.
createTerminalName
(
task
,
workspaceFolder
);
let
terminalName
=
this
.
createTerminalName
(
task
);
let
originalCommand
=
task
.
command
.
name
;
if
(
isShellCommand
)
{
const
defaultConfig
=
await
this
.
terminalInstanceService
.
getDefaultShellAndArgs
(
true
,
platform
);
...
...
@@ -846,7 +843,7 @@ export class TerminalTaskSystem implements ITaskSystem {
shellArgs
.
push
(
commandLine
);
shellLaunchConfig
.
args
=
windowsShellArgs
?
shellArgs
.
join
(
'
'
)
:
shellArgs
;
if
(
task
.
command
.
presentation
&&
task
.
command
.
presentation
.
echo
)
{
if
(
needsFolderQualification
)
{
if
(
needsFolderQualification
&&
workspaceFolder
)
{
shellLaunchConfig
.
initialText
=
`\x1b[1m> Executing task in folder
${
workspaceFolder
.
name
}
:
${
commandLine
}
<\x1b[0m\n`
;
}
else
{
shellLaunchConfig
.
initialText
=
`\x1b[1m> Executing task:
${
commandLine
}
<\x1b[0m\n`
;
...
...
@@ -875,7 +872,7 @@ export class TerminalTaskSystem implements ITaskSystem {
}
return
args
.
join
(
'
'
);
};
if
(
needsFolderQualification
)
{
if
(
needsFolderQualification
&&
workspaceFolder
)
{
shellLaunchConfig
.
initialText
=
`\x1b[1m> Executing task in folder
${
workspaceFolder
.
name
}
:
${
shellLaunchConfig
.
executable
}
${
getArgsToEcho
(
shellLaunchConfig
.
args
)}
<\x1b[0m\n`
;
}
else
{
shellLaunchConfig
.
initialText
=
`\x1b[1m> Executing task:
${
shellLaunchConfig
.
executable
}
${
getArgsToEcho
(
shellLaunchConfig
.
args
)}
<\x1b[0m\n`
;
...
...
@@ -886,7 +883,6 @@ export class TerminalTaskSystem implements ITaskSystem {
if
(
options
.
cwd
)
{
let
cwd
=
options
.
cwd
;
if
(
!
path
.
isAbsolute
(
cwd
))
{
let
workspaceFolder
=
task
.
getWorkspaceFolder
();
if
(
workspaceFolder
&&
(
workspaceFolder
.
uri
.
scheme
===
'
file
'
))
{
cwd
=
path
.
join
(
workspaceFolder
.
uri
.
fsPath
,
cwd
);
}
...
...
@@ -900,7 +896,7 @@ export class TerminalTaskSystem implements ITaskSystem {
return
shellLaunchConfig
;
}
private
async
createTerminal
(
task
:
CustomTask
|
ContributedTask
,
resolver
:
VariableResolver
,
workspaceFolder
:
IWorkspaceFolder
):
Promise
<
[
ITerminalInstance
|
undefined
,
string
|
undefined
,
TaskError
|
undefined
]
>
{
private
async
createTerminal
(
task
:
CustomTask
|
ContributedTask
,
resolver
:
VariableResolver
,
workspaceFolder
:
IWorkspaceFolder
|
undefined
):
Promise
<
[
ITerminalInstance
|
undefined
,
string
|
undefined
,
TaskError
|
undefined
]
>
{
let
platform
=
resolver
.
taskSystemInfo
?
resolver
.
taskSystemInfo
.
platform
:
Platform
.
platform
;
let
options
=
this
.
resolveOptions
(
resolver
,
task
.
command
.
options
);
...
...
@@ -929,7 +925,7 @@ export class TerminalTaskSystem implements ITaskSystem {
this
.
currentTask
.
shellLaunchConfig
=
launchConfigs
=
{
isExtensionTerminal
:
true
,
waitOnExit
,
name
:
this
.
createTerminalName
(
task
,
workspaceFolder
),
name
:
this
.
createTerminalName
(
task
),
initialText
:
task
.
command
.
presentation
&&
task
.
command
.
presentation
.
echo
?
`\x1b[1m> Executing task:
${
task
.
_label
}
<\x1b[0m\n`
:
undefined
};
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录