Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
9d907212
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,发现更多精彩内容 >>
未验证
提交
9d907212
编写于
5月 27, 2021
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename NotebookCellExecutionTask to NotebookCellExecution
上级
23fb4207
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
27 addition
and
26 deletion
+27
-26
extensions/vscode-api-tests/src/singlefolder-tests/notebook.test.ts
.../vscode-api-tests/src/singlefolder-tests/notebook.test.ts
+6
-6
extensions/vscode-notebook-tests/src/extension.ts
extensions/vscode-notebook-tests/src/extension.ts
+1
-1
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+8
-7
src/vs/workbench/api/common/extHostNotebookKernels.ts
src/vs/workbench/api/common/extHostNotebookKernels.ts
+4
-4
src/vs/workbench/test/browser/api/extHostNotebookKernel2.test.ts
...workbench/test/browser/api/extHostNotebookKernel2.test.ts
+8
-8
未找到文件。
extensions/vscode-api-tests/src/singlefolder-tests/notebook.test.ts
浏览文件 @
9d907212
...
...
@@ -56,7 +56,7 @@ class Kernel {
}
protected
async
_runCell
(
cell
:
vscode
.
NotebookCell
)
{
const
task
=
this
.
controller
.
createNotebookCellExecution
Task
(
cell
);
const
task
=
this
.
controller
.
createNotebookCellExecution
(
cell
);
task
.
start
();
task
.
executionOrder
=
1
;
if
(
cell
.
notebook
.
uri
.
path
.
endsWith
(
'
customRenderer.vsctestnb
'
))
{
...
...
@@ -180,7 +180,7 @@ suite('Notebook API tests', function () {
}
override
async
_runCell
(
cell
:
vscode
.
NotebookCell
)
{
const
task
=
this
.
controller
.
createNotebookCellExecution
Task
(
cell
);
const
task
=
this
.
controller
.
createNotebookCellExecution
(
cell
);
task
.
start
();
await
task
.
replaceOutput
([
new
vscode
.
NotebookCellOutput
([
vscode
.
NotebookCellOutputItem
.
text
(
'
my second output
'
,
'
text/plain
'
,
undefined
)
...
...
@@ -772,7 +772,7 @@ suite('Notebook API tests', function () {
override
async
_execute
(
cells
:
vscode
.
NotebookCell
[])
{
for
(
const
cell
of
cells
)
{
const
task
=
this
.
controller
.
createNotebookCellExecution
Task
(
cell
);
const
task
=
this
.
controller
.
createNotebookCellExecution
(
cell
);
task
.
start
();
task
.
token
.
onCancellationRequested
(
async
()
=>
{
await
task
.
replaceOutput
([
new
vscode
.
NotebookCellOutput
([
...
...
@@ -812,10 +812,10 @@ suite('Notebook API tests', function () {
this
.
controller
.
interruptHandler
=
this
.
interrupt
.
bind
(
this
);
}
private
_task
:
vscode
.
NotebookCellExecution
Task
|
undefined
;
private
_task
:
vscode
.
NotebookCellExecution
|
undefined
;
override
async
_execute
(
cells
:
vscode
.
NotebookCell
[])
{
this
.
_task
=
this
.
controller
.
createNotebookCellExecution
Task
(
cells
[
0
]);
this
.
_task
=
this
.
controller
.
createNotebookCellExecution
(
cells
[
0
]);
this
.
_task
.
start
();
}
...
...
@@ -1178,7 +1178,7 @@ suite('Notebook API tests', function () {
override
async
_execute
(
cells
:
vscode
.
NotebookCell
[])
{
const
[
cell
]
=
cells
;
const
task
=
this
.
controller
.
createNotebookCellExecution
Task
(
cell
);
const
task
=
this
.
controller
.
createNotebookCellExecution
(
cell
);
task
.
start
();
await
task
.
replaceOutput
([
new
vscode
.
NotebookCellOutput
([
vscode
.
NotebookCellOutputItem
.
text
(
'
Some output
'
,
'
text/plain
'
,
undefined
)
...
...
extensions/vscode-notebook-tests/src/extension.ts
浏览文件 @
9d907212
...
...
@@ -66,7 +66,7 @@ export function activate(context: vscode.ExtensionContext): any {
controller
.
executeHandler
=
(
cells
)
=>
{
for
(
const
cell
of
cells
)
{
const
task
=
controller
.
createNotebookCellExecution
Task
(
cell
);
const
task
=
controller
.
createNotebookCellExecution
(
cell
);
task
.
start
();
task
.
replaceOutput
([
new
vscode
.
NotebookCellOutput
([
vscode
.
NotebookCellOutputItem
.
text
(
'
test output
'
,
'
text/html
'
,
undefined
)
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
9d907212
...
...
@@ -1562,20 +1562,21 @@ declare module 'vscode' {
endTime
?:
number
;
}
// todo@API jsdoc slightly outdated: kernel, notebook.createNotebookCellExecution
Task
// todo@API jsdoc slightly outdated: kernel, notebook.createNotebookCellExecution
/**
* A NotebookCellExecution
Task
is how the kernel modifies a notebook cell as it is executing. When
* {@link notebook.createNotebookCellExecution
Task `createNotebookCellExecutionTask
`} is called, the cell
* A NotebookCellExecution is how the kernel modifies a notebook cell as it is executing. When
* {@link notebook.createNotebookCellExecution
`createNotebookCellExecution
`} is called, the cell
* enters the Pending state. When `start()` is called on the execution task, it enters the Executing state. When
* `end()` is called, it enters the Idle state. While in the Executing state, cell outputs can be
* modified with the methods on the run task.
*
* All outputs methods operate on this NotebookCellExecution
Task
's cell by default. They optionally take
* All outputs methods operate on this NotebookCellExecution's cell by default. They optionally take
* a cellIndex parameter that allows them to modify the outputs of other cells. `appendOutputItems` and
* `replaceOutputItems` operate on the output with the given ID, which can be an output on any cell. They
* all resolve once the output edit has been applied.
*/
export
interface
NotebookCellExecutionTask
{
export
interface
NotebookCellExecution
{
readonly
document
:
NotebookDocument
;
readonly
cell
:
NotebookCell
;
readonly
token
:
CancellationToken
;
...
...
@@ -1653,7 +1654,7 @@ declare module 'vscode' {
/**
* The interrupt handler is invoked the interrupt all execution. This is contrary to cancellation (available via
* [`NotebookCellExecution
Task#token`](NotebookCellExecutionTask
#token)) and should only be used when
* [`NotebookCellExecution
#token`](NotebookCellExecution
#token)) and should only be used when
* execution-level cancellation is supported
*/
interruptHandler
?:
NotebookInterruptHandler
...
...
@@ -1690,7 +1691,7 @@ declare module 'vscode' {
* @returns A notebook cell execution.
*/
// todo@API rename to NotebookCellExecution
createNotebookCellExecution
Task
(
cell
:
NotebookCell
):
NotebookCellExecutionTask
;
createNotebookCellExecution
(
cell
:
NotebookCell
):
NotebookCellExecution
;
// todo@API find a better name than "preloads"
// todo@API allow add, not remove
...
...
src/vs/workbench/api/common/extHostNotebookKernels.ts
浏览文件 @
9d907212
...
...
@@ -164,7 +164,7 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape {
data
.
supportsInterrupt
=
Boolean
(
value
);
_update
();
},
createNotebookCellExecution
Task
(
cell
)
{
createNotebookCellExecution
(
cell
)
{
if
(
isDisposed
)
{
throw
new
Error
(
'
notebook controller is DISPOSED
'
);
}
...
...
@@ -290,7 +290,7 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape {
// ---
_createNotebookCellExecution
(
cell
:
vscode
.
NotebookCell
):
vscode
.
NotebookCellExecution
Task
{
_createNotebookCellExecution
(
cell
:
vscode
.
NotebookCell
):
vscode
.
NotebookCellExecution
{
if
(
cell
.
index
<
0
)
{
throw
new
Error
(
'
CANNOT execute cell that has been REMOVED from notebook
'
);
}
...
...
@@ -403,9 +403,9 @@ class NotebookCellExecutionTask extends Disposable {
});
}
asApiObject
():
vscode
.
NotebookCellExecution
Task
{
asApiObject
():
vscode
.
NotebookCellExecution
{
const
that
=
this
;
return
Object
.
freeze
(
<
vscode
.
NotebookCellExecution
Task
>
{
return
Object
.
freeze
(
<
vscode
.
NotebookCellExecution
>
{
get
token
()
{
return
that
.
_tokenSource
.
token
;
},
get
document
()
{
return
that
.
_document
.
apiNotebook
;
},
get
cell
()
{
return
that
.
_cell
.
apiCell
;
},
...
...
src/vs/workbench/test/browser/api/extHostNotebookKernel2.test.ts
浏览文件 @
9d907212
...
...
@@ -165,28 +165,28 @@ suite('NotebookKernel', function () {
assert
.
strictEqual
(
first
.
label
,
'
Far
'
);
});
test
(
'
execute - simple createNotebookCellExecution
Task
'
,
function
()
{
test
(
'
execute - simple createNotebookCellExecution
'
,
function
()
{
const
kernel
=
extHostNotebookKernels
.
createNotebookController
(
nullExtensionDescription
,
'
foo
'
,
'
*
'
,
'
Foo
'
);
extHostNotebookKernels
.
$acceptNotebookAssociation
(
0
,
notebook
.
uri
,
true
);
const
cell1
=
notebook
.
apiNotebook
.
cellAt
(
0
);
const
task
=
kernel
.
createNotebookCellExecution
Task
(
cell1
);
const
task
=
kernel
.
createNotebookCellExecution
(
cell1
);
task
.
start
();
task
.
end
();
});
test
(
'
createNotebookCellExecution
Task
, must be selected/associated
'
,
function
()
{
test
(
'
createNotebookCellExecution, must be selected/associated
'
,
function
()
{
const
kernel
=
extHostNotebookKernels
.
createNotebookController
(
nullExtensionDescription
,
'
foo
'
,
'
*
'
,
'
Foo
'
);
assert
.
throws
(()
=>
{
kernel
.
createNotebookCellExecution
Task
(
notebook
.
apiNotebook
.
cellAt
(
0
));
kernel
.
createNotebookCellExecution
(
notebook
.
apiNotebook
.
cellAt
(
0
));
});
extHostNotebookKernels
.
$acceptNotebookAssociation
(
0
,
notebook
.
uri
,
true
);
kernel
.
createNotebookCellExecution
Task
(
notebook
.
apiNotebook
.
cellAt
(
0
));
kernel
.
createNotebookCellExecution
(
notebook
.
apiNotebook
.
cellAt
(
0
));
});
test
(
'
createNotebookCellExecution
Task
, cell must be alive
'
,
function
()
{
test
(
'
createNotebookCellExecution, cell must be alive
'
,
function
()
{
const
kernel
=
extHostNotebookKernels
.
createNotebookController
(
nullExtensionDescription
,
'
foo
'
,
'
*
'
,
'
Foo
'
);
const
cell1
=
notebook
.
apiNotebook
.
cellAt
(
0
);
...
...
@@ -203,7 +203,7 @@ suite('NotebookKernel', function () {
assert
.
strictEqual
(
cell1
.
index
,
-
1
);
assert
.
throws
(()
=>
{
kernel
.
createNotebookCellExecution
Task
(
cell1
);
kernel
.
createNotebookCellExecution
(
cell1
);
});
});
...
...
@@ -218,7 +218,7 @@ suite('NotebookKernel', function () {
const
cell1
=
notebook
.
apiNotebook
.
cellAt
(
0
);
const
task
=
kernel
.
createNotebookCellExecution
Task
(
cell1
);
const
task
=
kernel
.
createNotebookCellExecution
(
cell1
);
task
.
token
.
onCancellationRequested
(()
=>
tokenCancelCount
+=
1
);
await
extHostNotebookKernels
.
$cancelCells
(
0
,
notebook
.
uri
,
[
0
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录