Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4a8dc15b
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,发现更多精彩内容 >>
提交
4a8dc15b
编写于
3月 06, 2020
作者:
A
Alex Ross
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable inputs in user tasks
Fixes #91660
上级
1f720ae4
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
32 addition
and
16 deletion
+32
-16
src/vs/workbench/api/browser/mainThreadTask.ts
src/vs/workbench/api/browser/mainThreadTask.ts
+3
-2
src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts
src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts
+3
-3
src/vs/workbench/contrib/tasks/common/taskSystem.ts
src/vs/workbench/contrib/tasks/common/taskSystem.ts
+2
-1
src/vs/workbench/contrib/tasks/common/tasks.ts
src/vs/workbench/contrib/tasks/common/tasks.ts
+9
-0
src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts
...igurationResolver/browser/configurationResolverService.ts
+12
-8
src/vs/workbench/services/configurationResolver/common/configurationResolver.ts
...ces/configurationResolver/common/configurationResolver.ts
+3
-2
未找到文件。
src/vs/workbench/api/browser/mainThreadTask.ts
浏览文件 @
4a8dc15b
...
...
@@ -33,6 +33,7 @@ import {
RunOptionsDTO
}
from
'
vs/workbench/api/common/shared/tasks
'
;
import
{
IConfigurationResolverService
}
from
'
vs/workbench/services/configurationResolver/common/configurationResolver
'
;
import
{
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
namespace
TaskExecutionDTO
{
export
function
from
(
value
:
TaskExecution
):
TaskExecutionDTO
{
...
...
@@ -604,7 +605,7 @@ export class MainThreadTask implements MainThreadTaskShape {
return
URI
.
parse
(
`
${
info
.
scheme
}
://
${
info
.
authority
}${
path
}
`
);
},
context
:
this
.
_extHostContext
,
resolveVariables
:
(
workspaceFolder
:
IWorkspaceFolder
,
toResolve
:
ResolveSet
):
Promise
<
ResolvedVariables
>
=>
{
resolveVariables
:
(
workspaceFolder
:
IWorkspaceFolder
,
toResolve
:
ResolveSet
,
target
:
ConfigurationTarget
):
Promise
<
ResolvedVariables
>
=>
{
const
vars
:
string
[]
=
[];
toResolve
.
variables
.
forEach
(
item
=>
vars
.
push
(
item
));
return
Promise
.
resolve
(
this
.
_proxy
.
$resolveVariables
(
workspaceFolder
.
uri
,
{
process
:
toResolve
.
process
,
variables
:
vars
})).
then
(
values
=>
{
...
...
@@ -613,7 +614,7 @@ export class MainThreadTask implements MainThreadTaskShape {
partiallyResolvedVars
.
push
(
entry
.
value
);
});
return
new
Promise
<
ResolvedVariables
>
((
resolve
,
reject
)
=>
{
this
.
_configurationResolverService
.
resolveWithInteraction
(
workspaceFolder
,
partiallyResolvedVars
,
'
tasks
'
).
then
(
resolvedVars
=>
{
this
.
_configurationResolverService
.
resolveWithInteraction
(
workspaceFolder
,
partiallyResolvedVars
,
'
tasks
'
,
undefined
,
target
).
then
(
resolvedVars
=>
{
const
result
:
ResolvedVariables
=
{
process
:
undefined
,
variables
:
new
Map
<
string
,
string
>
()
...
...
src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts
浏览文件 @
4a8dc15b
...
...
@@ -33,7 +33,7 @@ import { IOutputService } from 'vs/workbench/contrib/output/common/output';
import
{
StartStopProblemCollector
,
WatchingProblemCollector
,
ProblemCollectorEventKind
,
ProblemHandlingStrategy
}
from
'
vs/workbench/contrib/tasks/common/problemCollectors
'
;
import
{
Task
,
CustomTask
,
ContributedTask
,
RevealKind
,
CommandOptions
,
ShellConfiguration
,
RuntimeType
,
PanelKind
,
TaskEvent
,
TaskEventKind
,
ShellQuotingOptions
,
ShellQuoting
,
CommandString
,
CommandConfiguration
,
ExtensionTaskSource
,
TaskScope
,
RevealProblemKind
,
DependsOrder
TaskEvent
,
TaskEventKind
,
ShellQuotingOptions
,
ShellQuoting
,
CommandString
,
CommandConfiguration
,
ExtensionTaskSource
,
TaskScope
,
RevealProblemKind
,
DependsOrder
,
TaskSourceKind
}
from
'
vs/workbench/contrib/tasks/common/tasks
'
;
import
{
ITaskSystem
,
ITaskSummary
,
ITaskExecuteResult
,
TaskExecuteKind
,
TaskError
,
TaskErrors
,
ITaskResolver
,
...
...
@@ -545,7 +545,7 @@ export class TerminalTaskSystem implements ITaskSystem {
resolveSet
.
process
.
path
=
envPath
;
}
}
resolvedVariables
=
taskSystemInfo
.
resolveVariables
(
workspaceFolder
,
resolveSet
).
then
(
async
(
resolved
)
=>
{
resolvedVariables
=
taskSystemInfo
.
resolveVariables
(
workspaceFolder
,
resolveSet
,
TaskSourceKind
.
toConfigurationTarget
(
task
.
_source
.
kind
)
).
then
(
async
(
resolved
)
=>
{
this
.
mergeMaps
(
alreadyResolved
,
resolved
.
variables
);
resolved
.
variables
=
new
Map
(
alreadyResolved
);
if
(
isProcess
)
{
...
...
@@ -563,7 +563,7 @@ export class TerminalTaskSystem implements ITaskSystem {
unresolved
.
forEach
(
variable
=>
variablesArray
.
push
(
variable
));
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
configurationResolverService
.
resolveWithInteraction
(
workspaceFolder
,
variablesArray
,
'
tasks
'
).
then
(
async
(
resolvedVariablesMap
:
Map
<
string
,
string
>
|
undefined
)
=>
{
this
.
configurationResolverService
.
resolveWithInteraction
(
workspaceFolder
,
variablesArray
,
'
tasks
'
,
undefined
,
TaskSourceKind
.
toConfigurationTarget
(
task
.
_source
.
kind
)
).
then
(
async
(
resolvedVariablesMap
:
Map
<
string
,
string
>
|
undefined
)
=>
{
if
(
resolvedVariablesMap
)
{
this
.
mergeMaps
(
alreadyResolved
,
resolvedVariablesMap
);
resolvedVariablesMap
=
new
Map
(
alreadyResolved
);
...
...
src/vs/workbench/contrib/tasks/common/taskSystem.ts
浏览文件 @
4a8dc15b
...
...
@@ -10,6 +10,7 @@ import { Event } from 'vs/base/common/event';
import
{
Platform
}
from
'
vs/base/common/platform
'
;
import
{
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
Task
,
TaskEvent
,
KeyedTaskIdentifier
}
from
'
./tasks
'
;
import
{
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
export
const
enum
TaskErrors
{
NotConfigured
,
...
...
@@ -118,7 +119,7 @@ export interface TaskSystemInfo {
platform
:
Platform
;
context
:
any
;
uriProvider
:
(
this
:
void
,
path
:
string
)
=>
URI
;
resolveVariables
(
workspaceFolder
:
IWorkspaceFolder
,
toResolve
:
ResolveSet
):
Promise
<
ResolvedVariables
>
;
resolveVariables
(
workspaceFolder
:
IWorkspaceFolder
,
toResolve
:
ResolveSet
,
target
:
ConfigurationTarget
):
Promise
<
ResolvedVariables
>
;
getDefaultShellAndArgs
():
Promise
<
{
shell
:
string
,
args
:
string
[]
|
string
|
undefined
}
>
;
}
...
...
src/vs/workbench/contrib/tasks/common/tasks.ts
浏览文件 @
4a8dc15b
...
...
@@ -15,6 +15,7 @@ import { IWorkspaceFolder, IWorkspace } from 'vs/platform/workspace/common/works
import
{
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
TaskDefinitionRegistry
}
from
'
vs/workbench/contrib/tasks/common/taskDefinitionRegistry
'
;
import
{
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
export
const
TASK_RUNNING_STATE
=
new
RawContextKey
<
boolean
>
(
'
taskRunning
'
,
false
);
...
...
@@ -377,6 +378,14 @@ export namespace TaskSourceKind {
export
const
InMemory
:
'
inMemory
'
=
'
inMemory
'
;
export
const
WorkspaceFile
:
'
workspaceFile
'
=
'
workspaceFile
'
;
export
const
User
:
'
user
'
=
'
user
'
;
export
function
toConfigurationTarget
(
kind
:
string
):
ConfigurationTarget
{
switch
(
kind
)
{
case
TaskSourceKind
.
User
:
return
ConfigurationTarget
.
USER
;
case
TaskSourceKind
.
WorkspaceFile
:
return
ConfigurationTarget
.
WORKSPACE
;
default
:
return
ConfigurationTarget
.
WORKSPACE_FOLDER
;
}
}
}
export
interface
TaskSourceConfigElement
{
...
...
src/vs/workbench/services/configurationResolver/browser/configurationResolverService.ts
浏览文件 @
4a8dc15b
...
...
@@ -11,7 +11,7 @@ import { Schemas } from 'vs/base/common/network';
import
{
toResource
}
from
'
vs/workbench/common/editor
'
;
import
{
IStringDictionary
,
forEach
,
fromMap
}
from
'
vs/base/common/collections
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IConfigurationService
,
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IWorkspaceFolder
,
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
...
...
@@ -86,12 +86,12 @@ export abstract class BaseConfigurationResolverService extends AbstractVariableR
},
envVariables
);
}
public
async
resolveWithInteractionReplace
(
folder
:
IWorkspaceFolder
|
undefined
,
config
:
any
,
section
?:
string
,
variables
?:
IStringDictionary
<
string
>
):
Promise
<
any
>
{
public
async
resolveWithInteractionReplace
(
folder
:
IWorkspaceFolder
|
undefined
,
config
:
any
,
section
?:
string
,
variables
?:
IStringDictionary
<
string
>
,
target
?:
ConfigurationTarget
):
Promise
<
any
>
{
// resolve any non-interactive variables and any contributed variables
config
=
this
.
resolveAny
(
folder
,
config
);
// resolve input variables in the order in which they are encountered
return
this
.
resolveWithInteraction
(
folder
,
config
,
section
,
variables
).
then
(
mapping
=>
{
return
this
.
resolveWithInteraction
(
folder
,
config
,
section
,
variables
,
target
).
then
(
mapping
=>
{
// finally substitute evaluated command variables (if there are any)
if
(
!
mapping
)
{
return
null
;
...
...
@@ -103,14 +103,14 @@ export abstract class BaseConfigurationResolverService extends AbstractVariableR
});
}
public
async
resolveWithInteraction
(
folder
:
IWorkspaceFolder
|
undefined
,
config
:
any
,
section
?:
string
,
variables
?:
IStringDictionary
<
string
>
):
Promise
<
Map
<
string
,
string
>
|
undefined
>
{
public
async
resolveWithInteraction
(
folder
:
IWorkspaceFolder
|
undefined
,
config
:
any
,
section
?:
string
,
variables
?:
IStringDictionary
<
string
>
,
target
?:
ConfigurationTarget
):
Promise
<
Map
<
string
,
string
>
|
undefined
>
{
// resolve any non-interactive variables and any contributed variables
const
resolved
=
await
this
.
resolveAnyMap
(
folder
,
config
);
config
=
resolved
.
newConfig
;
const
allVariableMapping
:
Map
<
string
,
string
>
=
resolved
.
resolvedVariables
;
// resolve input and command variables in the order in which they are encountered
return
this
.
resolveWithInputAndCommands
(
folder
,
config
,
variables
,
section
).
then
(
inputOrCommandMapping
=>
{
return
this
.
resolveWithInputAndCommands
(
folder
,
config
,
variables
,
section
,
target
).
then
(
inputOrCommandMapping
=>
{
if
(
this
.
updateMapping
(
inputOrCommandMapping
,
allVariableMapping
))
{
return
allVariableMapping
;
}
...
...
@@ -139,7 +139,7 @@ export abstract class BaseConfigurationResolverService extends AbstractVariableR
*
* @param variableToCommandMap Aliases for commands
*/
private
async
resolveWithInputAndCommands
(
folder
:
IWorkspaceFolder
|
undefined
,
configuration
:
any
,
variableToCommandMap
?:
IStringDictionary
<
string
>
,
section
?:
string
):
Promise
<
IStringDictionary
<
string
>
|
undefined
>
{
private
async
resolveWithInputAndCommands
(
folder
:
IWorkspaceFolder
|
undefined
,
configuration
:
any
,
variableToCommandMap
?:
IStringDictionary
<
string
>
,
section
?:
string
,
target
?:
ConfigurationTarget
):
Promise
<
IStringDictionary
<
string
>
|
undefined
>
{
if
(
!
configuration
)
{
return
Promise
.
resolve
(
undefined
);
...
...
@@ -148,9 +148,13 @@ export abstract class BaseConfigurationResolverService extends AbstractVariableR
// get all "inputs"
let
inputs
:
ConfiguredInput
[]
=
[];
if
(
folder
&&
this
.
workspaceContextService
.
getWorkbenchState
()
!==
WorkbenchState
.
EMPTY
&&
section
)
{
let
result
=
this
.
configurationService
.
getValue
<
any
>
(
section
,
{
resource
:
folder
.
uri
});
let
result
=
this
.
configurationService
.
inspect
(
section
,
{
resource
:
folder
.
uri
});
if
(
result
)
{
inputs
=
result
.
inputs
;
switch
(
target
)
{
case
ConfigurationTarget
.
USER
:
inputs
=
(
<
any
>
result
.
userValue
)?.
inputs
;
break
;
case
ConfigurationTarget
.
WORKSPACE
:
inputs
=
(
<
any
>
result
.
workspaceValue
)?.
inputs
;
break
;
default
:
inputs
=
(
<
any
>
result
.
workspaceFolderValue
)?.
inputs
;
}
}
}
...
...
src/vs/workbench/services/configurationResolver/common/configurationResolver.ts
浏览文件 @
4a8dc15b
...
...
@@ -6,6 +6,7 @@
import
{
IStringDictionary
}
from
'
vs/base/common/collections
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
export
const
IConfigurationResolverService
=
createDecorator
<
IConfigurationResolverService
>
(
'
configurationResolverService
'
);
...
...
@@ -29,13 +30,13 @@ export interface IConfigurationResolverService {
* @param section For example, 'tasks' or 'debug'. Used for resolving inputs.
* @param variables Aliases for commands.
*/
resolveWithInteractionReplace
(
folder
:
IWorkspaceFolder
|
undefined
,
config
:
any
,
section
?:
string
,
variables
?:
IStringDictionary
<
string
>
):
Promise
<
any
>
;
resolveWithInteractionReplace
(
folder
:
IWorkspaceFolder
|
undefined
,
config
:
any
,
section
?:
string
,
variables
?:
IStringDictionary
<
string
>
,
target
?:
ConfigurationTarget
):
Promise
<
any
>
;
/**
* Similar to resolveWithInteractionReplace, except without the replace. Returns a map of variables and their resolution.
* Keys in the map will be of the format input:variableName or command:variableName.
*/
resolveWithInteraction
(
folder
:
IWorkspaceFolder
|
undefined
,
config
:
any
,
section
?:
string
,
variables
?:
IStringDictionary
<
string
>
):
Promise
<
Map
<
string
,
string
>
|
undefined
>
;
resolveWithInteraction
(
folder
:
IWorkspaceFolder
|
undefined
,
config
:
any
,
section
?:
string
,
variables
?:
IStringDictionary
<
string
>
,
target
?:
ConfigurationTarget
):
Promise
<
Map
<
string
,
string
>
|
undefined
>
;
/**
* Contributes a variable that can be resolved later. Consumers that use resolveAny, resolveWithInteraction,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录