Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
030af951
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,发现更多精彩内容 >>
提交
030af951
编写于
10月 22, 2019
作者:
A
Alex Ross
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Stabilize CustomExecution task API
Fixes #80375
上级
96701930
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
29 addition
and
54 deletion
+29
-54
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+18
-2
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+1
-34
src/vs/workbench/api/common/extHostTask.ts
src/vs/workbench/api/common/extHostTask.ts
+7
-7
src/vs/workbench/api/common/extHostTypes.ts
src/vs/workbench/api/common/extHostTypes.ts
+2
-10
src/vs/workbench/api/node/extHostTask.ts
src/vs/workbench/api/node/extHostTask.ts
+1
-1
未找到文件。
src/vs/vscode.d.ts
浏览文件 @
030af951
...
...
@@ -5241,6 +5241,22 @@ declare module 'vscode' {
options
?:
ShellExecutionOptions
;
}
/**
* Class used to execute an extension callback as a task.
*/
export
class
CustomExecution
{
/**
* Constructs a CustomExecution task object. The callback will be executed the task is run, at which point the
* extension should return the Pseudoterminal it will "run in". The task should wait to do further execution until
* [Pseudoterminal.open](#Pseudoterminal.open) is called. Task cancellation should be handled using
* [Pseudoterminal.close](#Pseudoterminal.close). When the task is complete fire
* [Pseudoterminal.onDidClose](#Pseudoterminal.onDidClose).
* @param process The [Pseudoterminal](#Pseudoterminal) to be used by the task to display output.
* @param callback The callback that will be called when the task is started by a user.
*/
constructor
(
callback
:
()
=>
Thenable
<
Pseudoterminal
>
);
}
/**
* The scope of a task.
*/
...
...
@@ -5283,7 +5299,7 @@ declare module 'vscode' {
* or '$eslint'. Problem matchers can be contributed by an extension using
* the `problemMatchers` extension point.
*/
constructor
(
taskDefinition
:
TaskDefinition
,
scope
:
WorkspaceFolder
|
TaskScope
.
Global
|
TaskScope
.
Workspace
,
name
:
string
,
source
:
string
,
execution
?:
ProcessExecution
|
ShellExecution
,
problemMatchers
?:
string
|
string
[]);
constructor
(
taskDefinition
:
TaskDefinition
,
scope
:
WorkspaceFolder
|
TaskScope
.
Global
|
TaskScope
.
Workspace
,
name
:
string
,
source
:
string
,
execution
?:
ProcessExecution
|
ShellExecution
|
CustomExecution
,
problemMatchers
?:
string
|
string
[]);
/**
* ~~Creates a new task.~~
...
...
@@ -5318,7 +5334,7 @@ declare module 'vscode' {
/**
* The task's execution engine
*/
execution
?:
ProcessExecution
|
ShellExecution
;
execution
?:
ProcessExecution
|
ShellExecution
|
CustomExecution
;
/**
* Whether the task is a background task or not.
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
030af951
...
...
@@ -895,45 +895,12 @@ declare module 'vscode' {
//#endregion
//#region CustomExecution
/**
* Class used to execute an extension callback as a task.
*/
export
class
CustomExecution
{
/**
* Constructs a CustomExecution task object. The callback will be executed the task is run, at which point the
* extension should return the Pseudoterminal it will "run in". The task should wait to do further execution until
* [Pseudoterminal.open](#Pseudoterminal.open) is called. Task cancellation should be handled using
* [Pseudoterminal.close](#Pseudoterminal.close). When the task is complete fire
* [Pseudoterminal.onDidClose](#Pseudoterminal.onDidClose).
* @param process The [Pseudoterminal](#Pseudoterminal) to be used by the task to display output.
* @param callback The callback that will be called when the task is started by a user.
*/
constructor
(
callback
:
()
=>
Thenable
<
Pseudoterminal
>
);
}
/**
* A task to execute
*/
export
class
Task2
extends
Task
{
/**
* Creates a new task.
*
* @param definition The task definition as defined in the taskDefinitions extension point.
* @param scope Specifies the task's scope. It is either a global or a workspace task or a task for a specific workspace folder.
* @param name The task's name. Is presented in the user interface.
* @param source The task's source (e.g. 'gulp', 'npm', ...). Is presented in the user interface.
* @param execution The process or shell execution.
* @param problemMatchers the names of problem matchers to use, like '$tsc'
* or '$eslint'. Problem matchers can be contributed by an extension using
* the `problemMatchers` extension point.
*/
constructor
(
taskDefinition
:
TaskDefinition
,
scope
:
WorkspaceFolder
|
TaskScope
.
Global
|
TaskScope
.
Workspace
,
name
:
string
,
source
:
string
,
execution
?:
ProcessExecution
|
ShellExecution
|
CustomExecution
,
problemMatchers
?:
string
|
string
[]);
/**
* The task's execution engine
*/
execution2
?:
ProcessExecution
|
ShellExecution
|
CustomExecution
;
detail
?:
string
;
}
...
...
src/vs/workbench/api/common/extHostTask.ts
浏览文件 @
030af951
...
...
@@ -225,8 +225,8 @@ export namespace TaskDTO {
execution
=
ProcessExecutionDTO
.
from
(
value
.
execution
);
}
else
if
(
value
.
execution
instanceof
types
.
ShellExecution
)
{
execution
=
ShellExecutionDTO
.
from
(
value
.
execution
);
}
else
if
(
(
<
vscode
.
Task2
>
value
).
execution2
&&
(
<
vscode
.
Task2
>
value
).
execution2
instanceof
types
.
CustomExecution
)
{
execution
=
CustomExecutionDTO
.
from
(
<
types
.
CustomExecution
>
(
<
vscode
.
Task2
>
value
).
execution2
);
}
else
if
(
value
.
execution
&&
value
.
execution
instanceof
types
.
CustomExecution
)
{
execution
=
CustomExecutionDTO
.
from
(
<
types
.
CustomExecution
>
value
.
execution
);
}
const
definition
:
tasks
.
TaskDefinitionDTO
|
undefined
=
TaskDefinitionDTO
.
from
(
value
.
definition
);
...
...
@@ -578,7 +578,7 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
}
if
(
CustomExecutionDTO
.
is
(
resolvedTaskDTO
.
execution
))
{
await
this
.
addCustomExecution
(
resolvedTaskDTO
,
<
vscode
.
Task2
>
resolvedTask
,
true
);
await
this
.
addCustomExecution
(
resolvedTaskDTO
,
resolvedTask
,
true
);
}
return
await
this
.
resolveTaskInternal
(
resolvedTaskDTO
);
...
...
@@ -592,12 +592,12 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
return
this
.
_handleCounter
++
;
}
protected
async
addCustomExecution
(
taskDTO
:
tasks
.
TaskDTO
,
task
:
vscode
.
Task
2
,
isProvided
:
boolean
):
Promise
<
void
>
{
protected
async
addCustomExecution
(
taskDTO
:
tasks
.
TaskDTO
,
task
:
vscode
.
Task
,
isProvided
:
boolean
):
Promise
<
void
>
{
const
taskId
=
await
this
.
_proxy
.
$createTaskId
(
taskDTO
);
if
(
!
isProvided
&&
!
this
.
_providedCustomExecutions2
.
has
(
taskId
))
{
this
.
_notProvidedCustomExecutions
.
add
(
taskId
);
}
this
.
_providedCustomExecutions2
.
set
(
taskId
,
<
types
.
CustomExecution
>
(
<
vscode
.
Task2
>
task
).
execution2
);
this
.
_providedCustomExecutions2
.
set
(
taskId
,
<
types
.
CustomExecution
>
task
.
execution
);
}
protected
async
getTaskExecution
(
execution
:
tasks
.
TaskExecutionDTO
|
string
,
task
?:
vscode
.
Task
):
Promise
<
TaskExecutionImpl
>
{
...
...
@@ -679,7 +679,7 @@ export class WorkerExtHostTask extends ExtHostTaskBase {
// in the provided custom execution map that is cleaned up after the
// task is executed.
if
(
CustomExecutionDTO
.
is
(
dto
.
execution
))
{
await
this
.
addCustomExecution
(
dto
,
<
vscode
.
Task2
>
task
,
false
);
await
this
.
addCustomExecution
(
dto
,
task
,
false
);
}
else
{
throw
new
Error
(
'
Not implemented
'
);
}
...
...
@@ -701,7 +701,7 @@ export class WorkerExtHostTask extends ExtHostTaskBase {
// The ID is calculated on the main thread task side, so, let's call into it here.
// We need the task id's pre-computed for custom task executions because when OnDidStartTask
// is invoked, we have to be able to map it back to our data.
taskIdPromises
.
push
(
this
.
addCustomExecution
(
taskDTO
,
<
vscode
.
Task2
>
task
,
true
));
taskIdPromises
.
push
(
this
.
addCustomExecution
(
taskDTO
,
task
,
true
));
}
else
{
console
.
warn
(
'
Only custom execution tasks supported.
'
);
}
...
...
src/vs/workbench/api/common/extHostTypes.ts
浏览文件 @
030af951
...
...
@@ -1929,19 +1929,11 @@ export class Task implements vscode.Task2 {
this
.
_name
=
value
;
}
get
execution
():
ProcessExecution
|
ShellExecution
|
undefined
{
return
(
this
.
_execution
instanceof
CustomExecution
)
?
undefined
:
this
.
_execution
;
}
set
execution
(
value
:
ProcessExecution
|
ShellExecution
|
undefined
)
{
this
.
execution2
=
value
;
}
get
execution2
():
ProcessExecution
|
ShellExecution
|
CustomExecution
|
undefined
{
get
execution
():
ProcessExecution
|
ShellExecution
|
CustomExecution
|
undefined
{
return
this
.
_execution
;
}
set
execution
2
(
value
:
ProcessExecution
|
ShellExecution
|
CustomExecution
|
undefined
)
{
set
execution
(
value
:
ProcessExecution
|
ShellExecution
|
CustomExecution
|
undefined
)
{
if
(
value
===
null
)
{
value
=
undefined
;
}
...
...
src/vs/workbench/api/node/extHostTask.ts
浏览文件 @
030af951
...
...
@@ -57,7 +57,7 @@ export class ExtHostTask extends ExtHostTaskBase {
// in the provided custom execution map that is cleaned up after the
// task is executed.
if
(
CustomExecutionDTO
.
is
(
dto
.
execution
))
{
await
this
.
addCustomExecution
(
dto
,
<
vscode
.
Task2
>
task
,
false
);
await
this
.
addCustomExecution
(
dto
,
task
,
false
);
}
return
this
.
_proxy
.
$executeTask
(
dto
).
then
(
value
=>
this
.
getTaskExecution
(
value
,
task
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录