Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
ef28d166
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,发现更多精彩内容 >>
提交
ef28d166
编写于
6月 01, 2021
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Inline parameters to execution task start and end
上级
5c6ae4fc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
42 deletion
+26
-42
extensions/vscode-api-tests/src/singlefolder-tests/notebook.test.ts
.../vscode-api-tests/src/singlefolder-tests/notebook.test.ts
+5
-5
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+16
-32
src/vs/workbench/api/common/extHostNotebookKernels.ts
src/vs/workbench/api/common/extHostNotebookKernels.ts
+5
-5
未找到文件。
extensions/vscode-api-tests/src/singlefolder-tests/notebook.test.ts
浏览文件 @
ef28d166
...
...
@@ -69,7 +69,7 @@ class Kernel {
await
task
.
replaceOutput
([
new
vscode
.
NotebookCellOutput
([
vscode
.
NotebookCellOutputItem
.
text
(
'
my output
'
,
'
text/plain
'
)
])]);
task
.
end
(
{
success
:
true
}
);
task
.
end
(
true
);
}
}
...
...
@@ -188,7 +188,7 @@ suite('Notebook API tests', function () {
await
task
.
replaceOutput
([
new
vscode
.
NotebookCellOutput
([
vscode
.
NotebookCellOutputItem
.
text
(
'
my second output
'
,
'
text/plain
'
)
])]);
task
.
end
(
{
success
:
true
}
);
task
.
end
(
true
);
}
};
...
...
@@ -781,7 +781,7 @@ suite('Notebook API tests', function () {
await
task
.
replaceOutput
([
new
vscode
.
NotebookCellOutput
([
vscode
.
NotebookCellOutputItem
.
text
(
'
Canceled
'
,
'
text/plain
'
)
])]);
task
.
end
(
{}
);
task
.
end
(
undefined
);
});
}
...
...
@@ -826,7 +826,7 @@ suite('Notebook API tests', function () {
await
this
.
_task
!
.
replaceOutput
([
new
vscode
.
NotebookCellOutput
([
vscode
.
NotebookCellOutputItem
.
text
(
'
Interrupted
'
,
'
text/plain
'
)
])]);
this
.
_task
!
.
end
(
{}
);
this
.
_task
!
.
end
(
undefined
);
}
};
...
...
@@ -1188,7 +1188,7 @@ suite('Notebook API tests', function () {
])]);
assert
.
strictEqual
(
cell
.
notebook
.
cellAt
(
0
).
outputs
.
length
,
1
);
assert
.
deepStrictEqual
(
new
TextDecoder
().
decode
(
cell
.
notebook
.
cellAt
(
0
).
outputs
[
0
].
items
[
0
].
data
),
'
Some output
'
);
task
.
end
(
{}
);
task
.
end
(
undefined
);
called
=
true
;
}
};
...
...
src/vs/vscode.d.ts
浏览文件 @
ef28d166
...
...
@@ -11933,32 +11933,6 @@ declare module 'vscode' {
dispose
():
void
;
}
// todo@api jsdoc
// todo@api Inline unless we can come up with more (future) properties
export
interface
NotebookCellExecuteStartContext
{
/**
* The time that execution began, in milliseconds in the Unix epoch. Used to drive the clock
* that shows for how long a cell has been running. If not given, the clock won't be shown.
*/
startTime
?:
number
;
}
// todo@api jsdoc
// todo@api Inline unless we can come up with more (future) properties
export
interface
NotebookCellExecuteEndContext
{
/**
* If true, a green check is shown on the cell status bar.
* If false, a red X is shown.
* If undefined, no check or X icon is shown.
*/
success
?:
boolean
;
/**
* The time that execution finished, in milliseconds in the Unix epoch.
*/
endTime
?:
number
;
}
/**
* A NotebookCellExecution is how {@link NotebookController notebook controller} modify a notebook cell as
* it is executing.
...
...
@@ -11988,13 +11962,23 @@ declare module 'vscode' {
*/
executionOrder
:
number
|
undefined
;
// todo@API inline context object?
// @rob inline as arguments
start
(
context
?:
NotebookCellExecuteStartContext
):
void
;
/**
* Signal that the execution has begun.
*
* @param startTime The time that execution began, in milliseconds in the Unix epoch. Used to drive the clock
* that shows for how long a cell has been running. If not given, the clock won't be shown.
*/
start
(
startTime
?:
number
):
void
;
// todo@API inline context object?
// @rob inline as arguments
end
(
result
?:
NotebookCellExecuteEndContext
):
void
;
/**
* Signal that execution has ended.
*
* @param success If true, a green check is shown on the cell status bar.
* If false, a red X is shown.
* If undefined, no check or X icon is shown.
* @param endTime The time that execution finished, in milliseconds in the Unix epoch.
*/
end
(
success
:
boolean
|
undefined
,
endTime
?:
number
):
void
;
/**
* Clears the output of the cell that is executing or of another cell that is affected by this execution.
...
...
src/vs/workbench/api/common/extHostNotebookKernels.ts
浏览文件 @
ef28d166
...
...
@@ -447,7 +447,7 @@ class NotebookCellExecutionTask extends Disposable {
});
},
start
(
context
?:
vscode
.
NotebookCellExecuteStartContext
):
void
{
start
(
startTime
?:
number
):
void
{
if
(
that
.
_state
===
NotebookCellExecutionTaskState
.
Resolved
||
that
.
_state
===
NotebookCellExecutionTaskState
.
Started
)
{
throw
new
Error
(
'
Cannot call start again
'
);
}
...
...
@@ -457,11 +457,11 @@ class NotebookCellExecutionTask extends Disposable {
that
.
mixinMetadata
({
runState
:
NotebookCellExecutionState
.
Executing
,
runStartTime
:
context
?.
startTime
??
null
runStartTime
:
startTime
??
null
});
},
end
(
result
?:
vscode
.
NotebookCellExecuteEndContext
):
void
{
end
(
success
:
boolean
|
undefined
,
endTime
?:
number
):
void
{
if
(
that
.
_state
===
NotebookCellExecutionTaskState
.
Resolved
)
{
throw
new
Error
(
'
Cannot call resolve twice
'
);
}
...
...
@@ -471,8 +471,8 @@ class NotebookCellExecutionTask extends Disposable {
that
.
mixinMetadata
({
runState
:
null
,
lastRunSuccess
:
result
?.
success
??
null
,
runEndTime
:
result
?.
endTime
??
null
,
lastRunSuccess
:
success
??
null
,
runEndTime
:
endTime
??
null
,
});
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录